Disable mastodon web server in haproxy before updates

This commit is contained in:
Ivan R. 2024-11-28 12:52:31 +05:00
parent 2145aebaf3
commit 13118717af
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
2 changed files with 45 additions and 25 deletions

View file

@ -40,31 +40,10 @@
mode: '0660'
owner: root
group: root
- name: Create web container
become: true
community.docker.docker_container:
name: mastodon-web-{{ item }}
image: ghcr.io/mastodon/mastodon:{{ version }}
env_file: /etc/mastodon/.env
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
networks:
- name: mastodon
- name: postgresql
- name: minio
- name: haproxy
- name: authentik
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"]
- include_tasks: start_web_server.yml
loop: [1, 2]
loop_control:
loop_var: server_idx
- name: Create streaming container
become: true
community.docker.docker_container:

View file

@ -0,0 +1,41 @@
---
- name: Disable web server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
backend: mastodon
host: s{{ server_idx }}
fail_on_not_found: true
- name: Create web container
become: true
community.docker.docker_container:
name: mastodon-web-{{ server_idx }}
image: ghcr.io/mastodon/mastodon:{{ version }}
env_file: /etc/mastodon/.env
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
networks:
- name: mastodon
- name: postgresql
- name: minio
- name: haproxy
- name: authentik
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
- name: Enable web server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: mastodon
host: s{{ server_idx }}
fail_on_not_found: true