Add a healthcheck endpoint: /healthcheck returns status 200, 'ok' payload.

Mark Adams 2020-01-28 11:22:06 -08:00
parent 3a3ed2ee59
commit a4397f7298
2 changed files with 20 additions and 1 deletions

View File

@ -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 .

16
web/healthcheck.patch Normal file
View File

@ -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
+ <Location "/healthcheck">
+ ErrorDocument 200 "ok"
+ RewriteEngine On
+ RewriteRule "/healthcheck" - [R=200]
+ </Location>
<Directory /var/www/MISP/app/webroot>
Options -Indexes
AllowOverride all