From 34267e8ed8613a84dbeb7759c66be740c5e4b44c Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 30 Dec 2019 17:52:12 +0100 Subject: [PATCH] improving docker file, adding heartbeat url --- docker/alpine/Dockerfile.build | 6 +++--- docker/debian-stretch/Dockerfile.build | 6 +++--- src/backend/routes/PublicRouter.ts | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 54704ddb..f4003a8a 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -13,7 +13,7 @@ RUN mkdir -p /app/data/config && \ FROM node:12-alpine3.10 WORKDIR /app # command line arg orverride the config.json with these settings -ENTRYPOINT ["npm", "start", "--", \ +ENTRYPOINT ["node", "./src/backend/index", \ # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible "--expose-gc", \ "--config-path=/app/data/config/config.json", \ @@ -26,6 +26,6 @@ RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alp vips ffmpeg COPY --from=builder /app /app VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] -HEALTHCHECK --interval=30s --timeout=20s --retries=4 --start-period=60s \ +HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ CMD wget --quiet --tries=1 --no-check-certificate --spider \ - http://localhost:80 || exit 1 + http://localhost:80/heartbeat || exit 1 diff --git a/docker/debian-stretch/Dockerfile.build b/docker/debian-stretch/Dockerfile.build index 0728b96d..a338aa28 100644 --- a/docker/debian-stretch/Dockerfile.build +++ b/docker/debian-stretch/Dockerfile.build @@ -11,7 +11,7 @@ RUN mkdir -p /app/data/config && \ FROM node:12-stretch-slim WORKDIR /app # command line arg orverride the config.json with these settings -ENTRYPOINT ["npm", "start", "--", \ +ENTRYPOINT ["node", "./src/backend/index", \ # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible "--expose-gc", \ "--config-path=/app/data/config/config.json", \ @@ -23,6 +23,6 @@ ENV NODE_ENV=production RUN apt-get update && apt-get install -y ffmpeg COPY --from=builder /app /app VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] -HEALTHCHECK --interval=30s --timeout=20s --retries=4 --start-period=60s \ +HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ CMD wget --quiet --tries=1 --no-check-certificate --spider \ - http://localhost:80 || exit 1 + http://localhost:80/heartbeat || exit 1 diff --git a/src/backend/routes/PublicRouter.ts b/src/backend/routes/PublicRouter.ts index 7b1f4c2a..81b7dcec 100644 --- a/src/backend/routes/PublicRouter.ts +++ b/src/backend/routes/PublicRouter.ts @@ -78,6 +78,11 @@ export class PublicRouter { return next(); }); + app.get('/heartbeat', + (req: Request, res: Response, next: NextFunction) => { + res.sendStatus(200); + } + ); app.get(['/', '/login', '/gallery*', '/share*', '/admin', '/duplicates', '/faces', '/search*'], AuthenticationMWs.tryAuthenticate, @@ -110,6 +115,7 @@ export class PublicRouter { setLocale, AuthenticationMWs.normalizePathParam('file'), renderFile()); + } }