Files
dotcom-arcade/docs/09-deployment/health-checks.md
branderson 4130adfe58 docs: document Dotcom Arcade, streaming, proxy sign-in and saves
A new README for the combined project with setup from the Flashpoint
Ultimate torrent. New feature docs for streaming, proxy sign-in and
game saves; deployment, upgrade and streaming READMEs updated for the
single compose file; the project renamed throughout.
2026-10-13 19:31:06 -07:00

3.7 KiB

Health Checks Configuration

Docker container health checks for Dotcom Arcade services.

Health Check Configuration

All services include wget-based health checks in docker-compose files.

Backend Service:

healthcheck:
  test:
    [
      'CMD',
      'wget',
      '--quiet',
      '--tries=1',
      '--spider',
      'http://localhost:3100/api/health',
    ]
  interval: 30s
  timeout: 10s
  retries: 3
  start_period: 40s

Response:

{
  "status": "healthy",
  "timestamp": "2026-01-30T12:00:00.000Z",
  "uptime": 3600,
  "databases": {
    "flashpoint": { "connected": true },
    "user": { "connected": true }
  },
  "services": {
    "gameService": { "status": "integrated" }
  }
}

Frontend Service (Nginx):

healthcheck:
  test: ['CMD', 'wget', '--quiet', '--tries=1', '--spider', 'http://localhost/']
  interval: 30s
  timeout: 3s
  retries: 3
  start_period: 10s

Check Health Status

# View health status
docker-compose ps

# Detailed health check logs
docker inspect flashpoint-backend --format='{{json .State.Health}}' | jq

# Manual test (from host)
curl http://localhost:3100/api/health

# Manual test (from inside container)
docker-compose exec backend wget --quiet --tries=1 --spider http://localhost:3100/api/health
echo $?  # 0 = success, non-zero = failure

Monitoring Health in Real-Time

# Watch health status updates
watch -n 2 'docker-compose ps'

# Docker stats with status
docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.Status}}"

Service Dependencies

Startup order controlled by health checks:

frontend:
  depends_on:
    backend:
      condition: service_healthy

Sequence:

  1. Backend → health check → healthy (40s)
  2. Frontend → health check → healthy (10s)

Troubleshooting

Container Marked Unhealthy:

# Check logs
docker-compose logs backend

# View health history
docker inspect flashpoint-backend --format='{{range .State.Health.Log}}{{.ExitCode}} {{.Output}}{{end}}'

Health Check Keeps Failing:

  1. Service not fully started: Increase start_period

    healthcheck:
      start_period: 60s
    
  2. Database issues: Verify flashpoint.sqlite exists and is readable

    docker-compose exec backend ls -la /data/flashpoint/Data/flashpoint.sqlite
    
  3. Port conflicts: Ensure ports are available

    netstat -tulpn | grep -E '(3100|80)'
    
  4. Resource constraints: Check memory usage

    docker stats
    

Adjust timing for slow systems:

healthcheck:
  interval: 60s # Check less frequently
  timeout: 30s # Allow more time
  retries: 5 # More retries
  start_period: 90s # Longer grace period

Integration with Orchestrators

Docker Swarm:

docker service create \
  --health-cmd "wget --quiet --tries=1 --spider http://localhost/" \
  --health-interval 30s \
  flashpoint-frontend:latest

Kubernetes (convert to liveness/readiness probes):

livenessProbe:
  httpGet:
    path: /api/health
    port: 3100
  initialDelaySeconds: 40
  periodSeconds: 30
  timeoutSeconds: 10
  failureThreshold: 3

readinessProbe:
  httpGet:
    path: /api/health
    port: 3100
  initialDelaySeconds: 10
  periodSeconds: 5

Best Practices

  1. Use appropriate timeouts (Frontend: 3s, Backend/Game: 10s)
  2. Set realistic start periods (account for initialization time)
  3. Don't over-check (30s interval is sufficient)
  4. Keep health checks in docker-compose files (not Dockerfiles)
  5. Monitor for persistent failures with alerts

References