diff --git a/abra.sh b/abra.sh index ac87c25..54b382e 100644 --- a/abra.sh +++ b/abra.sh @@ -4,6 +4,7 @@ export FPM_TUNE_VERSION=v5 export NGINX_CONF_VERSION=v4 export MY_CNF_VERSION=v4 export ENTRYPOINT_VERSION=v3 +export HEALTHCHECK_VERSION=v1 run_occ(){ su -p www-data -s /bin/sh -c "/var/www/html/occ $@" diff --git a/compose.yml b/compose.yml index 3a80490..e137e4d 100644 --- a/compose.yml +++ b/compose.yml @@ -52,6 +52,9 @@ services: - source: entrypoint target: /custom-entrypoint.sh mode: 555 + - source: healthcheck + target: /healthcheck.sh + mode: 555 entrypoint: /custom-entrypoint.sh secrets: - db_password @@ -90,6 +93,12 @@ services: - "coop-cloud.${STACK_NAME}.version=3.0.1+25.0.1-fpm" - "backupbot.backup=true" - "backupbot.backup.path=/var/www/html/config/,/var/www/html/data/,/var/www/html/custom_apps/" + healthcheck: + test: ["CMD", '/healthcheck.sh'] + interval: 30s + timeout: 10s + retries: 10 + start_period: 1m cron: image: nextcloud:25.0.1-fpm @@ -147,6 +156,9 @@ configs: name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} file: entrypoint.sh.tmpl template_driver: golang + healthcheck: + name: ${STACK_NAME}_healthcheck_${HEALTHCHECK_VERSION} + file: healthcheck.sh networks: proxy: diff --git a/healthcheck.sh b/healthcheck.sh new file mode 100644 index 0000000..6ebcfaf --- /dev/null +++ b/healthcheck.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +which cgi-fcgi > /dev/null || (apt-get update && apt-get install -y libfcgi-bin) + +SCRIPT_NAME=/var/www/html/status.php \ +SCRIPT_FILENAME=/var/www/html/status.php \ +REQUEST_METHOD=GET \ +cgi-fcgi -bind -connect 127.0.0.1:9000 | grep 'installed":true'