From a4397f7298feaa88b3c33bb50d0555cad5363df2 Mon Sep 17 00:00:00 2001 From: Mark Adams Date: Tue, 28 Jan 2020 11:22:06 -0800 Subject: [PATCH] Add a healthcheck endpoint: /healthcheck returns status 200, 'ok' payload. --- web/Dockerfile | 5 ++++- web/healthcheck.patch | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 web/healthcheck.patch diff --git a/web/Dockerfile b/web/Dockerfile index d009648..6eb59b1 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -98,6 +98,10 @@ RUN echo "postfix postfix/main_mailer_type string Local only" \ RUN sed -i 's/^\(daemonize\s*\)yes\s*$/\1no/g' /etc/redis/redis.conf RUN sed -i 's/^\(bind\s*\)127.0.0.1 ::1\s*$/\1127.0.0.1/g' /etc/redis/redis.conf +# Add a healthcheck endpoint +COPY healthcheck.patch healthcheck.patch +RUN patch /var/www/MISP/INSTALL/apache.misp.ubuntu < healthcheck.patch + # Apache Setup RUN cp /var/www/MISP/INSTALL/apache.misp.ubuntu /etc/apache2/sites-available/misp.conf && \ a2dissite 000-default && \ @@ -178,7 +182,6 @@ RUN sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng ADD run.sh /run.sh RUN chmod 0755 /run.sh && touch /.firstboot.tmp - # Make a backup of /var/www/MISP to restore it to the local moint point at first boot WORKDIR /var/www/MISP RUN tar czpf /root/MISP.tgz . diff --git a/web/healthcheck.patch b/web/healthcheck.patch new file mode 100644 index 0000000..860dbcc --- /dev/null +++ b/web/healthcheck.patch @@ -0,0 +1,16 @@ +diff --git a/INSTALL/apache.misp.ubuntu b/INSTALL/apache.misp.ubuntu +index 6581951ea..17ed67982 100644 +--- a/INSTALL/apache.misp.ubuntu ++++ b/INSTALL/apache.misp.ubuntu +@@ -2,6 +2,11 @@ + ServerAdmin me@me.local + ServerName misp.local + DocumentRoot /var/www/MISP/app/webroot ++ ++ ErrorDocument 200 "ok" ++ RewriteEngine On ++ RewriteRule "/healthcheck" - [R=200] ++ + + Options -Indexes + AllowOverride all