diff --git a/roles/haproxy/files/haproxy.cfg b/roles/haproxy/files/haproxy.cfg index 51ef135..d2d6320 100644 --- a/roles/haproxy/files/haproxy.cfg +++ b/roles/haproxy/files/haproxy.cfg @@ -201,7 +201,12 @@ backend authentik_ldap backend nextcloud mode http - server s1 nextcloud-1:80 check + option httpchk + http-check send meth GET uri /status.php hdr Host nc.comfycamp.space + http-check expect status 200 + cookie SERVER insert indirect nocache + server s1 nextcloud-1:80 check inter 15s cookie s1 + server s2 nextcloud-2:80 check inter 15s cookie s2 backend mta_sts mode http diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 09b0300..17c72dd 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -34,7 +34,15 @@ - /mnt/hdd/nextcloud/data:/var/www/html/data recreate: "{{ cfg.changed }}" restart_policy: unless-stopped - loop: [1] + healthcheck: + test: ["CMD", "curl", "--fail", "http://127.0.0.1/status.php"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s + # TODO: enable after ansible update + # state: healthy + loop: [1, 2] - name: Schedule background jobs become: true ansible.builtin.cron: