Added healthcheck

master
Florian Meissner 2023-07-14 23:11:08 +02:00
parent c7231d648c
commit b11c4b4e9f
3 changed files with 23 additions and 3 deletions

View File

@ -38,3 +38,7 @@ ENV TZ=Etc/UTC
COPY etc/ /etc
WORKDIR /var/www/html
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD ["curl", "--fail", "http://localhost/healthcheck"]

View File

@ -32,6 +32,12 @@ server {
server_name ${NGINX_HOST}
index index.php index.htm;
location /healthcheck {
access_log off;
error_log off;
return 200 'ok';
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass ${PHP_HOST}:9000;
@ -39,10 +45,17 @@ server {
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location /status {
include fastcgi_params;
fastcgi_pass ${PHP_HOST}:9000;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location / {
#try_files $uri $uri/ /index.php?$query_string =404;
rewrite ^ index.php last;
try_files $uri $uri/ /index.php?$query_string =404;
#rewrite ^ index.php last;
}
}

View File

@ -41,10 +41,13 @@ COPY etc/php /usr/local/etc/php/conf.d
# Install dependencies
RUN apk update && \
apk upgrade && \
apk add git && \
apk add git fcgi && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \
rm -rf /var/cache/apk/*
# Enable php fpm status page
RUN set -xe && echo "pm.status_path = /status" >> /usr/local/etc/php-fpm.d/zz-docker.conf
# Install and execute own entrypoint script. This scrpit should hold all instructions that are not
# executed while the image is build (use RUN in this file therefore) but that are run when the
# container starts up. One major advanatge is that mounted volumes are already available when this