Set up load balancing and health checks for nextcloud

This commit is contained in:
Ivan R. 2024-11-15 15:50:05 +05:00
parent 29f838b2f1
commit d154afd699
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
2 changed files with 15 additions and 2 deletions

View file

@ -201,7 +201,12 @@ backend authentik_ldap
backend nextcloud backend nextcloud
mode http 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 backend mta_sts
mode http mode http

View file

@ -34,7 +34,15 @@
- /mnt/hdd/nextcloud/data:/var/www/html/data - /mnt/hdd/nextcloud/data:/var/www/html/data
recreate: "{{ cfg.changed }}" recreate: "{{ cfg.changed }}"
restart_policy: unless-stopped 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 - name: Schedule background jobs
become: true become: true
ansible.builtin.cron: ansible.builtin.cron: