112 lines
3.0 KiB
Markdown
112 lines
3.0 KiB
Markdown
|
|
# Docker Health Check Fix - Complete
|
|||
|
|
|
|||
|
|
## Problem
|
|||
|
|
|
|||
|
|
The `start-docker-apps.sh` script was failing because:
|
|||
|
|
1. Health checks were too impatient (only 5 seconds wait)
|
|||
|
|
2. The script exited with error if services weren't ready immediately
|
|||
|
|
3. Services like Grafana and SearXNG need 30-60 seconds to fully start
|
|||
|
|
4. Fedimint image had a platform mismatch warning on ARM64 Macs
|
|||
|
|
|
|||
|
|
## Solutions Applied
|
|||
|
|
|
|||
|
|
### 1. Improved Health Check Logic (`start-docker-apps.sh`)
|
|||
|
|
|
|||
|
|
**Before:**
|
|||
|
|
```bash
|
|||
|
|
# Wait 5 seconds, check once, fail if not ready
|
|||
|
|
sleep 5
|
|||
|
|
check_service "Grafana" "http://localhost:3000"
|
|||
|
|
check_service "SearXNG" "http://localhost:8082"
|
|||
|
|
# If not ready, exit with error
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**After:**
|
|||
|
|
```bash
|
|||
|
|
# Wait up to 60 seconds with retries
|
|||
|
|
MAX_ATTEMPTS=30
|
|||
|
|
ATTEMPT=0
|
|||
|
|
|
|||
|
|
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
|||
|
|
READY_COUNT=0
|
|||
|
|
|
|||
|
|
check_service "Grafana" "http://localhost:3000" && ((READY_COUNT++)) || true
|
|||
|
|
check_service "SearXNG" "http://localhost:8082" && ((READY_COUNT++)) || true
|
|||
|
|
check_service "Endurain" "http://localhost:8084" && ((READY_COUNT++)) || true
|
|||
|
|
check_service "MorphOS" "http://localhost:8081" && ((READY_COUNT++)) || true
|
|||
|
|
|
|||
|
|
if [ $READY_COUNT -ge 2 ]; then
|
|||
|
|
echo " ✅ Core services are ready!"
|
|||
|
|
break
|
|||
|
|
fi
|
|||
|
|
|
|||
|
|
sleep 2
|
|||
|
|
((ATTEMPT++))
|
|||
|
|
done
|
|||
|
|
|
|||
|
|
# Non-blocking - informational only
|
|||
|
|
if [ $READY_COUNT -lt 2 ]; then
|
|||
|
|
echo " ℹ️ Some services are still starting (this is normal)"
|
|||
|
|
echo " 💡 They will be available shortly. Check with: docker compose ps"
|
|||
|
|
fi
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**Key improvements:**
|
|||
|
|
- Retries up to 30 times (60 seconds total)
|
|||
|
|
- Non-blocking (doesn't fail if services aren't ready)
|
|||
|
|
- Informational messages to reassure users
|
|||
|
|
- Continues startup even if services are still initializing
|
|||
|
|
|
|||
|
|
### 2. Fixed Fedimint Platform Warning (`docker-compose.yml`)
|
|||
|
|
|
|||
|
|
**Before:**
|
|||
|
|
```yaml
|
|||
|
|
fedimint:
|
|||
|
|
image: fedimint/fedimintd:v0.3.0
|
|||
|
|
container_name: archy-fedimint
|
|||
|
|
ports:
|
|||
|
|
- "8173:8173"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**After:**
|
|||
|
|
```yaml
|
|||
|
|
fedimint:
|
|||
|
|
image: fedimint/fedimintd:v0.3.0
|
|||
|
|
container_name: archy-fedimint
|
|||
|
|
platform: linux/amd64 # Emulate x86 on ARM Macs
|
|||
|
|
ports:
|
|||
|
|
- "8173:8173"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
This tells Docker to use x86 emulation for Fedimint on ARM Macs, eliminating the warning.
|
|||
|
|
|
|||
|
|
## Testing
|
|||
|
|
|
|||
|
|
Run the dev server again:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd scripts
|
|||
|
|
bash dev-start.sh
|
|||
|
|
# Choose option 2 (Full stack)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**Expected behavior:**
|
|||
|
|
1. Docker containers create and start successfully
|
|||
|
|
2. Health check waits patiently for services
|
|||
|
|
3. Script continues even if some services are still initializing
|
|||
|
|
4. No platform mismatch warnings
|
|||
|
|
5. Backend and frontend start without errors
|
|||
|
|
|
|||
|
|
## Files Modified
|
|||
|
|
|
|||
|
|
- `/Users/dorian/Projects/archy/start-docker-apps.sh` - Improved health check logic
|
|||
|
|
- `/Users/dorian/Projects/archy/docker-compose.yml` - Added platform specification for Fedimint
|
|||
|
|
|
|||
|
|
## Next Steps
|
|||
|
|
|
|||
|
|
Once you confirm this works:
|
|||
|
|
1. Bitcoin Core should appear in the My Apps section
|
|||
|
|
2. You should be able to launch it and see the custom UI
|
|||
|
|
3. Stop/Start functionality should work
|
|||
|
|
4. All 13 Docker apps should be running in the background
|