Disable website server in haproxy before updates

This commit is contained in:
Ivan R. 2024-11-29 16:12:42 +05:00
parent 95aed66fe5
commit 00fa6b31e2
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
3 changed files with 39 additions and 15 deletions

View file

@ -16,17 +16,7 @@
become: true
community.docker.docker_volume:
name: comfycamp
- name: Create comfycamp container
become: true
community.docker.docker_container:
name: comfycamp
image: git.comfycamp.space/lumin/comfycamp:v2.3.1
networks:
- name: postgresql
- name: haproxy
volumes:
- /etc/comfycamp/config.local.toml:/usr/src/comfycamp/config.local.toml:ro
- comfycamp:/var/lib/comfycamp
env:
RUST_LOG: warn
restart_policy: unless-stopped
- include_tasks: start_server.yml
loop: [1, 2]
loop_control:
loop_var: server_idx

View file

@ -0,0 +1,33 @@
---
- name: Disable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
drain: true
wait: true
backend: comfycamp
host: s{{ server_idx }}
fail_on_not_found: true
- name: Create comfycamp container
become: true
community.docker.docker_container:
name: comfycamp-{{ server_idx }}
image: git.comfycamp.space/lumin/comfycamp:v2.3.1
networks:
- name: postgresql
- name: haproxy
volumes:
- /etc/comfycamp/config.local.toml:/usr/src/comfycamp/config.local.toml:ro
- comfycamp:/var/lib/comfycamp
env:
RUST_LOG: warn
restart_policy: unless-stopped
- name: Enable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: comfycamp
host: s{{ server_idx }}
fail_on_not_found: true

View file

@ -143,7 +143,8 @@ backend comfycamp
option httpchk GET /health
http-check expect status 200
http-response set-header Onion-Location http://comfycgmgfvowbbw2ckkobuvk4cejo2e56uxrhznravxnrl7itftpkad.onion%[capture.req.uri]
server s1 comfycamp:4000 check inter 15s
server s1 comfycamp-1:4000 check inter 15s
server s2 comfycamp-2:4000 check inter 15s
backend mastodon
mode http