add a health check endpoint to nginx.
This commit is contained in:
parent
5d704fd447
commit
c82ac9bad2
2 changed files with 8 additions and 2 deletions
|
@ -106,7 +106,7 @@ EXPOSE 443
|
|||
# A moderately long start period is important because while it IS serving a HTTP 200 immediately, it might not have
|
||||
# completed probing the docker socket and generating the config yet.
|
||||
HEALTHCHECK --start-period=30s \
|
||||
CMD curl -s -o /dev/null -w "200" http://localhost:80/ || exit 1
|
||||
CMD curl -s -o /dev/null -w "200" http://localhost:80/health || exit 1
|
||||
|
||||
# checkov:skip=CKV_DOCKER_3 This is a test container.
|
||||
FROM ghcr.io/benzine-framework/php:nginx-8.2 AS test-app
|
||||
|
|
|
@ -22,8 +22,14 @@ server {
|
|||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Health check endpoint
|
||||
location /health {
|
||||
access_log off;
|
||||
add_header 'Content-Type' 'application/json';
|
||||
return 200 '{"status":"Healthy"}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue