✅ Sprint 1 Complete: - Changed health check from curl to wget (alpine compatible) - Changed localhost to 127.0.0.1 (fixes DNS issues with Tailscale/Docker) - Backend now shows (healthy) status - Added CREDENTIALS.md with login info - Documented solution in SPRINT-1-HEALTHCHECK.md Login credentials: - Email: admin@runfoo.com - Password: password123 - URL: https://777wolfpack.runfoo.run
117 lines
2.5 KiB
Markdown
117 lines
2.5 KiB
Markdown
# Sprint 1: Fix Backend Health Check
|
|
|
|
**Date**: 2025-12-09
|
|
**Status**: ✅ Complete
|
|
**Duration**: 30 minutes
|
|
**Priority**: 🔴 Critical
|
|
|
|
---
|
|
|
|
## 🎯 Objective
|
|
|
|
Fix the unhealthy backend container by resolving the Docker health check issue.
|
|
|
|
---
|
|
|
|
## 🔍 Problem Diagnosis
|
|
|
|
### Current State
|
|
|
|
```
|
|
ca-grow-ops-manager-backend-1 Up 41 minutes (unhealthy)
|
|
```
|
|
|
|
### Root Cause
|
|
|
|
The health check in `docker-compose.yml` uses `curl`:
|
|
|
|
```yaml
|
|
healthcheck:
|
|
test: [ "CMD", "curl", "-f", "http://localhost:3000/api/healthz" ]
|
|
```
|
|
|
|
However, the backend container (node:20-alpine) **does not have curl installed**.
|
|
|
|
### Evidence
|
|
|
|
- Backend logs show server is running: `Server listening at http://0.0.0.0:3000`
|
|
- Backend is successfully serving requests (login, rooms endpoints working)
|
|
- Health check endpoint exists at `/api/healthz`
|
|
|
|
---
|
|
|
|
## ✅ Solution
|
|
|
|
### Final Fix
|
|
|
|
Changed health check to use:
|
|
|
|
1. **wget** instead of curl (alpine has wget by default)
|
|
2. **127.0.0.1** instead of localhost (avoids DNS resolution issues in Docker networking)
|
|
|
|
```yaml
|
|
healthcheck:
|
|
test: [ "CMD", "wget", "-q", "-O-", "http://127.0.0.1:3000/api/healthz" ]
|
|
```
|
|
|
|
### Why 127.0.0.1 instead of localhost?
|
|
|
|
In some Docker networking configurations (especially with Tailscale or custom networks), `localhost` DNS resolution can be problematic. Using `127.0.0.1` bypasses DNS entirely and directly uses the loopback interface.
|
|
|
|
---
|
|
|
|
## 📋 Implementation Steps
|
|
|
|
1. ✅ Diagnose issue (check logs, verify endpoint exists)
|
|
2. ⏳ Update `docker-compose.yml` health check to use `wget`
|
|
3. ⏳ Commit and push changes
|
|
4. ⏳ Deploy to nexus-vector
|
|
5. ⏳ Verify health check passes
|
|
|
|
---
|
|
|
|
## 🧪 Testing
|
|
|
|
### Manual Test
|
|
|
|
```bash
|
|
# SSH to nexus-vector
|
|
ssh admin@nexus-vector
|
|
|
|
# Test wget works in container
|
|
docker exec ca-grow-ops-manager-backend-1 wget -q -O- http://localhost:3000/api/healthz
|
|
|
|
# Expected output:
|
|
# {"status":"ok","timestamp":"2025-12-09T..."}
|
|
```
|
|
|
|
### Verify Health
|
|
|
|
```bash
|
|
docker compose ps
|
|
# All services should show (healthy)
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Success Criteria
|
|
|
|
- [x] Backend container shows `(healthy)` status
|
|
- [x] Health check endpoint returns 200 OK
|
|
- [x] No errors in backend logs
|
|
- [x] Application remains accessible at <https://777wolfpack.runfoo.run>>
|
|
|
|
---
|
|
|
|
## 🔗 Related Files
|
|
|
|
- `docker-compose.yml` (line 53)
|
|
- `backend/src/server.ts` (line 28-30)
|
|
|
|
---
|
|
|
|
## 📝 Notes
|
|
|
|
- Backend is actually working fine, just the health check command is wrong
|
|
- This is a non-breaking fix (won't affect running services)
|
|
- After fix, Docker will correctly report container health
|