1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improving docker file, adding heartbeat url

This commit is contained in:
Patrik J. Braun 2019-12-30 17:52:12 +01:00
parent 9516fba85b
commit 34267e8ed8
3 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,7 @@ RUN mkdir -p /app/data/config && \
FROM node:12-alpine3.10 FROM node:12-alpine3.10
WORKDIR /app WORKDIR /app
# command line arg orverride the config.json with these settings # 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 # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible
"--expose-gc", \ "--expose-gc", \
"--config-path=/app/data/config/config.json", \ "--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 vips ffmpeg
COPY --from=builder /app /app COPY --from=builder /app /app
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] 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 \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80 || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -11,7 +11,7 @@ RUN mkdir -p /app/data/config && \
FROM node:12-stretch-slim FROM node:12-stretch-slim
WORKDIR /app WORKDIR /app
# command line arg orverride the config.json with these settings # 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 # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible
"--expose-gc", \ "--expose-gc", \
"--config-path=/app/data/config/config.json", \ "--config-path=/app/data/config/config.json", \
@ -23,6 +23,6 @@ ENV NODE_ENV=production
RUN apt-get update && apt-get install -y ffmpeg RUN apt-get update && apt-get install -y ffmpeg
COPY --from=builder /app /app COPY --from=builder /app /app
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] 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 \ CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:80 || exit 1 http://localhost:80/heartbeat || exit 1

View File

@ -78,6 +78,11 @@ export class PublicRouter {
return next(); return next();
}); });
app.get('/heartbeat',
(req: Request, res: Response, next: NextFunction) => {
res.sendStatus(200);
}
);
app.get(['/', '/login', '/gallery*', '/share*', '/admin', '/duplicates', '/faces', '/search*'], app.get(['/', '/login', '/gallery*', '/share*', '/admin', '/duplicates', '/faces', '/search*'],
AuthenticationMWs.tryAuthenticate, AuthenticationMWs.tryAuthenticate,
@ -110,6 +115,7 @@ export class PublicRouter {
setLocale, setLocale,
AuthenticationMWs.normalizePathParam('file'), AuthenticationMWs.normalizePathParam('file'),
renderFile()); renderFile());
} }
} }