From 1d05df6ec988380de9d880fa28cab530c976574b Mon Sep 17 00:00:00 2001 From: LouisLam Date: Thu, 9 Sep 2021 11:41:28 +0800 Subject: [PATCH] [docker healthcheck] use retries instead, longer start-period causes starting problem in Docker Swarm mode --- dockerfile | 2 +- dockerfile-alpine | 2 +- extra/healthcheck.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfile b/dockerfile index 3dabf513e..ddb5f4e8c 100644 --- a/dockerfile +++ b/dockerfile @@ -24,7 +24,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune EXPOSE 3001 VOLUME ["/app/data"] -HEALTHCHECK --interval=600s --timeout=130s --start-period=300s CMD node extra/healthcheck.js +HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js CMD ["node", "server/server.js"] FROM release AS nightly diff --git a/dockerfile-alpine b/dockerfile-alpine index 1dd6b6b53..c8bead8bb 100644 --- a/dockerfile-alpine +++ b/dockerfile-alpine @@ -19,7 +19,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune EXPOSE 3001 VOLUME ["/app/data"] -HEALTHCHECK --interval=600s --timeout=130s --start-period=300s CMD node extra/healthcheck.js +HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js CMD ["node", "server/server.js"] FROM release AS nightly diff --git a/extra/healthcheck.js b/extra/healthcheck.js index ed4e3eb23..ba3569db7 100644 --- a/extra/healthcheck.js +++ b/extra/healthcheck.js @@ -11,7 +11,7 @@ if (process.env.SSL_KEY && process.env.SSL_CERT) { let options = { host: process.env.HOST || "127.0.0.1", port: parseInt(process.env.PORT) || 3001, - timeout: 120 * 1000, + timeout: 28 * 1000, }; let request = client.request(options, (res) => {