From e7ae82e51d6c9396b5fd83f0759099680d59fb3a Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 20 Feb 2026 00:10:38 -0800 Subject: [PATCH] feat: add healthcheck to all services in docker-compose NestJS services use wget to check API endpoints. voice-service uses curl to check FastAPI /docs endpoint. web-admin uses wget to check Next.js root. Co-Authored-By: Claude Opus 4.6 --- deploy/docker/docker-compose.yml | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml index d92aaf0..100ada9 100644 --- a/deploy/docker/docker-compose.yml +++ b/deploy/docker/docker-compose.yml @@ -85,6 +85,12 @@ services: - JWT_SECRET=${JWT_SECRET:-dev-jwt-secret} - JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET:-dev-jwt-refresh-secret} - AUTH_SERVICE_PORT=3001 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3001/api/v1/auth || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -113,6 +119,12 @@ services: - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} - AGENT_ENGINE_TYPE=claude_code_cli - AGENT_SERVICE_PORT=3002 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3002/api/v1/agent || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -139,6 +151,12 @@ services: - DB_DATABASE=${POSTGRES_DB:-it0} - REDIS_URL=redis://redis:6379 - OPS_SERVICE_PORT=3003 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3003/api/v1/ops || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -166,6 +184,12 @@ services: - REDIS_URL=redis://redis:6379 - VAULT_MASTER_KEY=${VAULT_MASTER_KEY:-dev-vault-key} - INVENTORY_SERVICE_PORT=3004 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3004/api/v1/inventory || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -190,6 +214,12 @@ services: - DB_DATABASE=${POSTGRES_DB:-it0} - REDIS_URL=redis://redis:6379 - MONITOR_SERVICE_PORT=3005 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3005/api/v1/monitor || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -217,6 +247,12 @@ services: - TWILIO_AUTH_TOKEN=${TWILIO_AUTH_TOKEN} - TWILIO_PHONE_NUMBER=${TWILIO_PHONE_NUMBER} - COMM_SERVICE_PORT=3006 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3006/api/v1/comm || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -243,6 +279,12 @@ services: - DB_DATABASE=${POSTGRES_DB:-it0} - REDIS_URL=redis://redis:6379 - AUDIT_SERVICE_PORT=3007 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3007/api/v1/audit || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: postgres: condition: service_healthy @@ -261,6 +303,12 @@ services: - WHISPER_MODEL=${WHISPER_MODEL:-large-v3} - KOKORO_MODEL=${KOKORO_MODEL:-kokoro-82m} - DEVICE=${VOICE_DEVICE:-cpu} + healthcheck: + test: ["CMD-SHELL", "curl -sf http://localhost:3008/docs || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s depends_on: - agent-service networks: @@ -277,6 +325,12 @@ services: - API_BASE_URL=http://api-gateway:8000 - NEXT_PUBLIC_API_BASE_URL=/api/proxy - NEXT_PUBLIC_WS_URL=ws://localhost:18000 + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3000/ || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 15s depends_on: - api-gateway networks: