From f6db675c95af70888c54ffb20ab2019334027ecf Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 14 Jun 2022 11:58:57 +0800 Subject: [PATCH] fix: docker add health check --- docker-compose.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1123ed50..9c7f0064 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: app: container_name: mx-server image: innei/mx-server:latest - command: node index.js --redis_host=redis --db_host=mongo --allowed_origins=${ALLOWED_ORIGINS} --jwt_secret=${JWT_SECRET} --color --cluster + command: node index.js --redis_host=redis --db_host=mongo --allowed_origins=${ALLOWED_ORIGINS} --jwt_secret=${JWT_SECRET} --color environment: - TZ=Asia/Shanghai - NODE_ENV=production @@ -21,6 +21,12 @@ services: networks: - app-network restart: always + healthcheck: + test: ['CMD', 'curl', '-f', 'http://127.0.0.1:2333/api/v2/ping'] + interval: 1m30s + timeout: 30s + retries: 5 + start_period: 30s mongo: container_name: mongo @@ -41,7 +47,7 @@ services: networks: - app-network restart: always - + networks: app-network: driver: bridge