[docker healthcheck] use retries instead, longer start-period causes starting problem in Docker Swarm mode

This commit is contained in:
LouisLam 2021-09-09 11:41:28 +08:00
parent dd283423ab
commit 1d05df6ec9
3 changed files with 3 additions and 3 deletions

View file

@ -24,7 +24,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune
EXPOSE 3001 EXPOSE 3001
VOLUME ["/app/data"] 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"] CMD ["node", "server/server.js"]
FROM release AS nightly FROM release AS nightly

View file

@ -19,7 +19,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune
EXPOSE 3001 EXPOSE 3001
VOLUME ["/app/data"] 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"] CMD ["node", "server/server.js"]
FROM release AS nightly FROM release AS nightly

View file

@ -11,7 +11,7 @@ if (process.env.SSL_KEY && process.env.SSL_CERT) {
let options = { let options = {
host: process.env.HOST || "127.0.0.1", host: process.env.HOST || "127.0.0.1",
port: parseInt(process.env.PORT) || 3001, port: parseInt(process.env.PORT) || 3001,
timeout: 120 * 1000, timeout: 28 * 1000,
}; };
let request = client.request(options, (res) => { let request = client.request(options, (res) => {