From 39272ab05c35d05366c35a8ebfd25e87ea7f41de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20S=C3=A4nger?= Date: Tue, 16 Oct 2018 21:38:12 +0200 Subject: [PATCH] add healthcheck for http services --- core/admin/Dockerfile | 4 +++- core/nginx/Dockerfile | 4 +++- docs/Dockerfile | 8 ++++++-- optional/radicale/Dockerfile | 4 +++- services/rspamd/Dockerfile | 4 +++- setup/Dockerfile | 4 +++- webmails/rainloop/Dockerfile | 4 +++- webmails/roundcube/Dockerfile | 4 +++- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/core/admin/Dockerfile b/core/admin/Dockerfile index 2e637206..083bec80 100644 --- a/core/admin/Dockerfile +++ b/core/admin/Dockerfile @@ -4,7 +4,7 @@ RUN mkdir -p /app WORKDIR /app COPY requirements-prod.txt requirements.txt -RUN apk add --no-cache openssl \ +RUN apk add --no-cache openssl curl \ && apk add --no-cache --virtual build-dep openssl-dev libffi-dev python-dev build-base \ && pip install -r requirements.txt \ && apk del --no-cache build-dep @@ -20,3 +20,5 @@ EXPOSE 80/tcp VOLUME ["/data"] CMD ["/start.sh"] + +HEALTHCHECK CMD curl -f -L http://localhost/ui || exit 1 diff --git a/core/nginx/Dockerfile b/core/nginx/Dockerfile index 1b61447a..87951c03 100644 --- a/core/nginx/Dockerfile +++ b/core/nginx/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.8 -RUN apk add --no-cache certbot nginx nginx-mod-mail openssl \ +RUN apk add --no-cache certbot nginx nginx-mod-mail openssl curl \ python py-jinja2 py-requests-toolbelt py-pip \ && pip install --upgrade pip \ && pip install idna @@ -12,3 +12,5 @@ EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 100 VOLUME ["/certs"] CMD /start.py + +HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1 diff --git a/docs/Dockerfile b/docs/Dockerfile index af481a27..b058e0e2 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -3,7 +3,7 @@ FROM python:3-alpine COPY requirements.txt /requirements.txt RUN pip install -r /requirements.txt \ - && apk add --no-cache nginx \ + && apk add --no-cache nginx curl \ && mkdir /run/nginx COPY ./nginx.conf /etc/nginx/conf.d/default.conf @@ -11,4 +11,8 @@ COPY . /docs RUN sphinx-build /docs /build -CMD nginx -g "daemon off;" \ No newline at end of file +EXPOSE 80/tcp + +CMD nginx -g "daemon off;" + +HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1 diff --git a/optional/radicale/Dockerfile b/optional/radicale/Dockerfile index b82a0804..4616d53d 100644 --- a/optional/radicale/Dockerfile +++ b/optional/radicale/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:edge RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ - && apk add --no-cache radicale@testing py-dulwich@testing + && apk add --no-cache radicale@testing py-dulwich@testing curl COPY radicale.conf /radicale.conf @@ -9,3 +9,5 @@ EXPOSE 5232/tcp VOLUME ["/data"] CMD radicale -f -S -C /radicale.conf + +HEALTHCHECK CMD curl -f -L http://localhost:5232/ || exit 1 diff --git a/services/rspamd/Dockerfile b/services/rspamd/Dockerfile index 7239ddaf..d87a64f5 100644 --- a/services/rspamd/Dockerfile +++ b/services/rspamd/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.8 -RUN apk add --no-cache python py-jinja2 rspamd rspamd-controller rspamd-proxy ca-certificates py-pip \ +RUN apk add --no-cache python py-jinja2 rspamd rspamd-controller rspamd-proxy ca-certificates py-pip curl \ && pip install --upgrade pip \ && pip install tenacity @@ -17,3 +17,5 @@ EXPOSE 11332/tcp 11334/tcp VOLUME ["/var/lib/rspamd"] CMD /start.py + +HEALTHCHECK CMD curl -f -L http://localhost:11334/ || exit 1 diff --git a/setup/Dockerfile b/setup/Dockerfile index 1fc808f1..0da1eb7b 100644 --- a/setup/Dockerfile +++ b/setup/Dockerfile @@ -4,7 +4,7 @@ RUN mkdir -p /app WORKDIR /app COPY requirements.txt requirements.txt -RUN apk add --no-cache git \ +RUN apk add --no-cache git curl \ && pip install -r requirements.txt COPY server.py ./server.py @@ -16,3 +16,5 @@ RUN python setup.py https://github.com/mailu/mailu /data EXPOSE 80/tcp CMD gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload main:app + +HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1 diff --git a/webmails/rainloop/Dockerfile b/webmails/rainloop/Dockerfile index 889c8486..5d751716 100644 --- a/webmails/rainloop/Dockerfile +++ b/webmails/rainloop/Dockerfile @@ -3,7 +3,7 @@ FROM php:7.2-apache ENV RAINLOOP_URL https://github.com/RainLoop/rainloop-webmail/releases/download/v1.12.1/rainloop-community-1.12.1.zip RUN apt-get update && apt-get install -y \ - unzip python3 python3-jinja2 \ + unzip python3 python3-jinja2 curl \ && rm -rf /var/www/html/ \ && mkdir /var/www/html \ && cd /var/www/html \ @@ -29,3 +29,5 @@ EXPOSE 80/tcp VOLUME ["/data"] CMD /start.py + +HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1 diff --git a/webmails/roundcube/Dockerfile b/webmails/roundcube/Dockerfile index 50a58a4f..6250e6df 100644 --- a/webmails/roundcube/Dockerfile +++ b/webmails/roundcube/Dockerfile @@ -3,7 +3,7 @@ FROM php:7.2-apache ENV ROUNDCUBE_URL https://github.com/roundcube/roundcubemail/releases/download/1.3.7/roundcubemail-1.3.7-complete.tar.gz RUN apt-get update && apt-get install -y \ - zlib1g-dev \ + zlib1g-dev curl \ && docker-php-ext-install zip \ && echo date.timezone=UTC > /usr/local/etc/php/conf.d/timezone.ini \ && rm -rf /var/www/html/ \ @@ -28,3 +28,5 @@ EXPOSE 80/tcp VOLUME ["/data"] CMD ["/start.sh"] + +HEALTHCHECK CMD curl -f -L http://localhost/ || exit 1