Nginx Healthcheck endpoint + Dockerfile healthcheck (#23)

Co-authored-by: modem7 <modem7@gmail.com>
This commit is contained in:
Paramtamtam 2021-09-06 11:47:10 +05:00 committed by GitHub
parent 501d141ce7
commit ce98410e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -4,6 +4,15 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
## v1.8.0
### Added
- Nginx health-check endpoint (`/health/live`) and dockerfile `HEALTHCHECK` to utilise (thx [@modem7](https://github.com/modem7)) [#22], [#23]
[#22]:https://github.com/tarampampam/error-pages/pull/22
[#23]:https://github.com/tarampampam/error-pages/pull/23
## v1.7.2
### Changed

View File

@ -30,7 +30,7 @@ RUN set -x \
&& mv /src/docker/nginx-server.conf ./etc/nginx/conf.d/default.conf
# Image page: <https://hub.docker.com/_/nginx>
FROM nginx:1.21-alpine as runtime
FROM nginx:1.21.1-alpine as runtime
LABEL \
# Docs: <https://github.com/opencontainers/image-spec/blob/master/annotations.md>
@ -44,4 +44,9 @@ LABEL \
# Import from builder
COPY --from=builder /tmp/rootfs /
# Docs: <https://docs.docker.com/engine/reference/builder/#healthcheck>
HEALTHCHECK --interval=15s --timeout=2s --retries=2 --start-period=2s CMD [ \
"wget", "--spider", "-q", "http://127.0.0.1:8080/health/live" \
]
RUN chown -R nginx:nginx /opt/html

View File

@ -19,6 +19,13 @@ server {
root /opt/html;
}
# Health-check (liveness probe)
location = /health/live {
access_log off;
default_type text/plain;
return 200 "healthy\n";
}
location / {
try_files $uri =404;
}