Healthcheck Summary¶
Overview¶
All services across all environments (qualification, production, development) now have healthchecks configured. This ensures proper container health monitoring and enables Docker Compose to manage service dependencies correctly.
Healthcheck Configuration¶
Standard Healthcheck Pattern¶
Most services use the following standard healthcheck configuration:
healthcheck:
test: ["CMD-SHELL", "wget --quiet --tries=1 --spider http://127.0.0.1:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
Service-Specific Healthchecks¶
Frontend Services¶
- public-fo (Nginx): Checks port 80
CMS Services¶
- strapi-cms: Checks port 1337
Identity Provider¶
- keycloak: Checks
/health/readyendpoint on port 8080
NestJS Services (Express-style endpoints)¶
These services expose /api/health endpoints:
- notification-service
- analytics-service
- review-service
- file-service
Express Services¶
These services expose /health endpoints:
- api-gateway
- user-management
- booking-service
- experience-service
- payment-service
- auth-service
Note: Some services use nc -z (netcat) instead of wget for port checks:
- api-gateway-qual
- auth-service-qual
- payment-service-qual
- file-service-qual
Environment Coverage¶
Qualification Environment (qualification.yml)¶
All 14 services have healthchecks: - ✅ public-fo-qual - ✅ strapi-cms-qual - ✅ api-gateway-qual - ✅ keycloak-qual - ✅ auth-service-qual - ✅ user-management-qual - ✅ booking-service-qual - ✅ experience-service-qual - ✅ payment-service-qual - ✅ notification-service-qual - ✅ analytics-service-qual - ✅ file-service-qual - ✅ review-service-qual
Production Environment (production.yml)¶
All 14 services have healthchecks: - ✅ public-fo-prod - ✅ strapi-cms-prod - ✅ api-gateway-prod - ✅ keycloak-prod - ✅ user-management-prod - ✅ booking-service-prod - ✅ experience-service-prod - ✅ payment-service-prod - ✅ notification-service-prod - ✅ analytics-service-prod - ✅ file-service-prod - ✅ review-service-prod - ✅ auth-service-prod
Development Environment (development.yml)¶
All services already had healthchecks configured.
Shared Infrastructure (shared.yml)¶
All infrastructure services have healthchecks: - ✅ traefik - ✅ postgres - ✅ redis - ✅ rabbitmq - ✅ adminer - ✅ minio
Healthcheck Parameters¶
- interval: 30s (10s for Traefik)
- timeout: 10s (5s for Traefik)
- retries: 5 (3 for Traefik)
- start_period:
- 30s for most services
- 60s for Strapi and Keycloak (longer initialization)
- 10s for Traefik
Benefits¶
-
Service Dependencies: Docker Compose can use
depends_onwithcondition: service_healthyto ensure services start in the correct order. -
Container Status:
docker psshows health status (healthy,unhealthy,starting). -
Automatic Restart: Unhealthy containers can be automatically restarted based on restart policies.
-
Monitoring: Healthcheck status can be monitored by external tools (Prometheus, Grafana).
-
Debugging: Healthcheck failures help identify service startup issues quickly.
Verification¶
To verify all services have healthchecks:
# Count healthchecks in qualification.yml
grep -c "healthcheck:" infrastructure/compose/qualification.yml
# Count healthchecks in production.yml
grep -c "healthcheck:" infrastructure/compose/production.yml
# View health status of running containers
docker ps --format "table {{.Names}}\t{{.Status}}"