From 2c3628753abd5bb4eecf2c0ca3c1aa90e2410e73 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 3 Jun 2018 13:32:31 +0200 Subject: [PATCH] Fix watcherd startup behaviour --- Dockerfile | 2 +- data/docker-entrypoint.d/10-supervisord.sh | 9 +++++++-- data/docker-entrypoint.sh | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcc69d8..e35f0ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ ENV RUN_DEPS \ ENV MY_USER=daemon ENV MY_GROUP=daemon ENV HTTPD_START="httpd-foreground" -ENV HTTPD_RELOAD="/usr/local/apache2/bin/httpd -k restart" +ENV HTTPD_RELOAD="/usr/local/apache2/bin/httpd -k stop" ### diff --git a/data/docker-entrypoint.d/10-supervisord.sh b/data/docker-entrypoint.d/10-supervisord.sh index 9df56d4..abfc66a 100755 --- a/data/docker-entrypoint.d/10-supervisord.sh +++ b/data/docker-entrypoint.d/10-supervisord.sh @@ -29,8 +29,11 @@ supervisord_create() { echo echo "[program:httpd]" echo "command=${httpd_command}" - echo "autostart=false" - echo "autorestart=false" + echo "priority=1" + echo "autostart=true" + echo "startretries=100" + echo "startsecs=1" + echo "autorestart=true" echo "stdout_logfile=/dev/stdout" echo "stdout_logfile_maxbytes=0" echo "stderr_logfile=/dev/stderr" @@ -40,6 +43,8 @@ supervisord_create() { echo echo "[program:watcherd]" echo "command=${watcherd_command}" + echo "priority=999" + echo "autostart=true" echo "autorestart=false" echo "stdout_logfile=/dev/stdout" echo "stdout_logfile_maxbytes=0" diff --git a/data/docker-entrypoint.sh b/data/docker-entrypoint.sh index cece499..498183f 100755 --- a/data/docker-entrypoint.sh +++ b/data/docker-entrypoint.sh @@ -23,6 +23,10 @@ CA_CRT=/ca/devilbox-ca.crt CONFIG_DIR="/docker-entrypoint.d" +# Wait this many seconds to start watcherd after httpd has been started +WATCHERD_STARTUP_DELAY="3" + + ### ### Source libs ### @@ -224,7 +228,7 @@ if [ "${MASS_VHOST_ENABLE}" -eq "1" ]; then supervisord_create \ "${HTTPD_START}" \ - "watcherd -v -p /shared/httpd -a \"${watcherd_add}\" -d \"${watcherd_del}\" -t \"${watcherd_tri}\"" \ + "bash -c 'sleep ${WATCHERD_STARTUP_DELAY} && exec watcherd -v -p /shared/httpd -a \"${watcherd_add}\" -d \"${watcherd_del}\" -t \"${watcherd_tri}\"'" \ "/etc/supervisord.conf" log "info" "Starting supervisord: $(supervisord -v)" "${DEBUG_LEVEL}"