fix: 修复 docker-compose.yml 中所有服务的健康检查
问题: - docker-compose.yml 的 healthcheck 覆盖了 Dockerfile 的 HEALTHCHECK - 使用 wget 而不是 curl - 健康检查 URL 不正确,导致所有服务显示 unhealthy 修复: 1. 统一使用 curl -f 代替 wget 2. 修正所有服务的健康检查 URL: - identity-service: /health → /api/v1/health - wallet-service: /health → /api/v1/health - backup-service: /health ✓ (保持不变) - planting-service: /health → /api/v1/health - referral-service: /health ✓ (保持不变) - reward-service: /health ✓ (保持不变) - mpc-service: /api/v1/health ✓ (已正确,改用 curl) - leaderboard-service: /health → /api/health - reporting-service: /health → /api/v1/health - authorization-service: /health ✓ (保持不变,改用 curl) 3. 统一 timeout 为 3s (原来是 10s) 4. admin-web: 优化 timeout 为 3s Docker HEALTHCHECK 机制: - 在容器内部执行 curl localhost:PORT/path - 不经过 Nginx 或外部网络 - 需要与服务实际端点匹配 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ace7145b4c
commit
17ff0d951e
|
|
@ -132,9 +132,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -168,9 +168,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3001/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3001/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -198,9 +198,9 @@ services:
|
|||
postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3002/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3002/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -234,9 +234,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3003/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3003/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -270,9 +270,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3004/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3004/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -306,9 +306,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3005/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3005/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -345,9 +345,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3006/api/v1/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3006/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -381,9 +381,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3007/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3007/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -417,9 +417,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3008/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3008/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
@ -453,9 +453,9 @@ services:
|
|||
kafka:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3009/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3009/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
restart: unless-stopped
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ services:
|
|||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
networks:
|
||||
|
|
|
|||
Loading…
Reference in New Issue