Update healthcheck configuration in docker-compose.yml for improved reliability

- Changed healthcheck command to use 'http' module for better error handling.
- Increased timeout to 10s, retries to 8, and start period to 120s to accommodate cold starts.
This commit is contained in:
Первов Артем
2026-04-21 00:52:36 +03:00
parent b60c4ee0ed
commit c4e5962912

View File

@@ -46,18 +46,19 @@ services:
S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE:-true} S3_FORCE_PATH_STYLE: ${S3_FORCE_PATH_STYLE:-true}
S3_PUBLIC_BASE_URL: ${S3_PUBLIC_BASE_URL:-} S3_PUBLIC_BASE_URL: ${S3_PUBLIC_BASE_URL:-}
S3_OBJECT_PREFIX: ${S3_OBJECT_PREFIX:-toir-light/equipment} S3_OBJECT_PREFIX: ${S3_OBJECT_PREFIX:-toir-light/equipment}
# migrate deploy runs before the HTTP server listens; cold start can exceed 20s.
healthcheck: healthcheck:
test: test:
[ [
"CMD", "CMD",
"node", "node",
"-e", "-e",
"fetch('http://127.0.0.1:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))", "require('http').get('http://127.0.0.1:3000/health',(r)=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))",
] ]
interval: 15s interval: 15s
timeout: 5s timeout: 10s
retries: 5 retries: 8
start_period: 20s start_period: 120s
expose: expose:
- "3000" - "3000"
networks: networks: