diff --git a/roles/haproxy/files/haproxy.cfg b/roles/haproxy/files/haproxy.cfg index 1d6f036..ff56231 100644 --- a/roles/haproxy/files/haproxy.cfg +++ b/roles/haproxy/files/haproxy.cfg @@ -138,16 +138,20 @@ backend comfycamp backend mastodon mode http + option httpchk GET /health + http-check expect status 200 http-response set-header Referrer-Policy same-origin http-response set-header Onion-Location http://mcomfyzeyibt2unmkttoxa2li2dzpsljcp3sasrioqsks4ayrl5kk2ad.onion%[capture.req.uri] - server s1 mastodon-web-1:3000 check - server s2 mastodon-web-2:3000 check + server s1 mastodon-web-1:3000 check inter 10s + server s2 mastodon-web-2:3000 check inter 10s backend mastodon_streaming mode http + option httpchk GET /api/v1/streaming/health + http-check expect status 200 option http-server-close timeout tunnel 1h - server green mastodon-streaming:4000 check + server green mastodon-streaming:4000 check inter 10s backend vaultwarden mode http diff --git a/roles/mastodon/tasks/main.yml b/roles/mastodon/tasks/main.yml index c840411..eee3162 100644 --- a/roles/mastodon/tasks/main.yml +++ b/roles/mastodon/tasks/main.yml @@ -56,6 +56,14 @@ volumes: - mastodon-public-system:/mastodon/public/system restart_policy: unless-stopped + healthcheck: + test: ["CMD", "curl", "--fail", "127.0.0.1:3000/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s + # TODO: enable after ansible update + # state: healthy loop: ["1", "2"] - name: Create streaming container become: true @@ -69,6 +77,14 @@ - name: postgresql - name: haproxy restart_policy: unless-stopped + healthcheck: + test: ["CMD", "curl", "--fail", "127.0.0.1:4000/api/v1/streaming/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s + # TODO: enable after ansible update + # state: healthy - name: Create sidekiq container become: true community.docker.docker_container: