healthchecks #32

Merged
moritz merged 8 commits from healthchecks into main 2023-01-12 21:16:32 +00:00
3 changed files with 25 additions and 0 deletions

View File

@ -31,6 +31,12 @@ services:
backupbot.backup.pre-hook: 'mkdir -p /tmp/backup/ && mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" nextcloud > /tmp/backup/backup.sql'
backupbot.backup.post-hook: "rm -rf /tmp/backup"
backupbot.backup.path: "/tmp/backup/"
healthcheck:
test: ["CMD-SHELL", 'mysqladmin -p"$$(cat /run/secrets/db_root_password)" ping']
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
configs:
my_tune:
name: ${STACK_NAME}_my_cnf_${MY_CNF_VERSION}

View File

@ -33,6 +33,12 @@ services:
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
healthcheck:
test: ["CMD-SHELL", 'curl -s -N curl -Ns localhost/status.php | grep "installed\":true"']
interval: 30s
timeout: 10s
moritz marked this conversation as resolved Outdated

localhost/ocs/v2.php/apps/serverinfo/api/v1/info There's two version strings in this URI? I wonder if they'll change? Could be some breakages here... any other way to do it?

`localhost/ocs/v2.php/apps/serverinfo/api/v1/info` There's two version strings in this URI? I wonder if they'll change? Could be some breakages here... any other way to do it?

This uses the https://github.com/nextcloud/serverinfo app, which is installed per default. It is able to check the nextcloud health in more depth.
https://github.com/nextcloud/docker/issues/676
But I can't guarantee that this app won't change in future.
A more future prove approach is to use /status.php as for the php-fpm healthcheck.

This uses the https://github.com/nextcloud/serverinfo app, which is installed per default. It is able to check the nextcloud health in more depth. https://github.com/nextcloud/docker/issues/676 But I can't guarantee that this app won't change in future. A more future prove approach is to use /status.php as for the php-fpm healthcheck.
retries: 10
start_period: 1m
app:
image: nextcloud:25.0.1-fpm
@ -83,6 +89,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-SHELL", 'SCRIPT_NAME=status SCRIPT_FILENAME=/var/www/html/status.php REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000 | grep "installed\":true"']
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
cron:
image: nextcloud:25.0.1-fpm
@ -102,6 +114,11 @@ services:
- internal
volumes:
- "redis:/data"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 5s
retries: 20
secrets:
db_root_password:

View File

@ -34,6 +34,8 @@ if ! [[ $(grep {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} lib/public/AppFramework/Ht
fi
{{ end }}
# Required for healthcheck
which cgi-fcgi > /dev/null || (apt-get update && apt-get install -y libfcgi-bin)
/entrypoint.sh php-fpm