Skip to content

Commit

Permalink
add healthcheck to containers
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Nov 27, 2024
1 parent 7fcccac commit f73e6ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions infra/docker/nginx-client-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ WORKDIR /var/app

ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

HEALTHCHECK --start-interval=1s --start-period=30s --retries=60 --interval=60s \
CMD wget -O /dev/null http://127.0.0.1/index.html?healthcheck || exit 1
3 changes: 3 additions & 0 deletions infra/docker/nginx-fpm-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ COPY tpl /etc/nginx/tpl
ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

HEALTHCHECK --start-interval=1s --start-period=20s --retries=20 --interval=60s \
CMD wget -O /dev/null http://127.0.0.1/favicon.ico?healthcheck || exit 1

ENV UPLOAD_MAX_FILE_SIZE=5M

EXPOSE 80
8 changes: 7 additions & 1 deletion infra/docker/php-fpm-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
# Increase process-timeout for "composer test" which downloads phpunit
&& composer config --global process-timeout 2000 \
&& adduser -D -u 1000 app \
&& printf "\nuser = app\ngroup = app\n" >> /usr/local/etc/php-fpm.d/zz-docker.conf
&& printf "\nuser = app\ngroup = app\n" >> /usr/local/etc/php-fpm.d/zz-docker.conf \
&& wget -O /usr/local/bin/php-fpm-healthcheck https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/v0.5.0/php-fpm-healthcheck \
&& chmod +x /usr/local/bin/php-fpm-healthcheck \
&& printf "pm.status_path = /status\n" >> /usr/local/etc/php-fpm.d/zz-docker.conf

WORKDIR /srv/app

RUN chown -R app:app .

CMD ["true"]

HEALTHCHECK --start-interval=2s --start-period=30s --retries=50 --interval=60s --timeout=3s \
CMD php-fpm-healthcheck || exit 1

0 comments on commit f73e6ce

Please sign in to comment.