Disable server in haproxy before updating

This will reduce the number of errors for users.
The experiments were carried out on immich, it is not so important.
This commit is contained in:
Ivan R. 2024-11-28 12:41:38 +05:00
parent 1944a88df3
commit d3b27d3565
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 45 additions and 18 deletions

View file

@ -1,7 +1,6 @@
global global
log /dev/stderr local0 warning log /dev/stderr local0 warning
user haproxy stats socket /run/haproxy/admin.sock user haproxy group haproxy mode 660 level admin expose-fd listeners
group haproxy
# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384

View file

@ -48,6 +48,14 @@
src: errors/{{ item }}.http src: errors/{{ item }}.http
dest: /etc/haproxy/errors/{{ item }}.http dest: /etc/haproxy/errors/{{ item }}.http
loop: [400, 403, 408, 500, 502, 503, 504] loop: [400, 403, 408, 500, 502, 503, 504]
- name: Create haproxy socket dir
become: true
ansible.builtin.file:
path: /run/haproxy
state: directory
mode: "1750"
owner: "99"
group: "99"
- name: Create haproxy container - name: Create haproxy container
become: true become: true
community.docker.docker_container: community.docker.docker_container:
@ -57,6 +65,7 @@
- name: haproxy - name: haproxy
volumes: volumes:
- /etc/haproxy:/usr/local/etc/haproxy:ro - /etc/haproxy:/usr/local/etc/haproxy:ro
- /run/haproxy:/run/haproxy
sysctls: sysctls:
net.ipv4.ip_unprivileged_port_start: 0 net.ipv4.ip_unprivileged_port_start: 0
ports: ports:

View file

@ -33,22 +33,10 @@
become: true become: true
community.docker.docker_volume: community.docker.docker_volume:
name: "immich-model-cache" name: "immich-model-cache"
- name: Start immich server container - include_tasks: start_server.yml
become: true loop: [1]
community.docker.docker_container: loop_control:
name: immich-1 loop_var: server_idx
image: ghcr.io/immich-app/immich-server:{{ tag }}
env_file: /etc/immich/_data/immich.env
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/hdd/immich:/usr/src/app/upload
- /etc/immich/_data:/etc/immich
networks:
- name: haproxy
- name: immich
- name: postgresql
recreate: "{{ cfg.changed }}"
restart_policy: unless-stopped
- name: Start immich machine learning container - name: Start immich machine learning container
become: true become: true
community.docker.docker_container: community.docker.docker_container:

View file

@ -0,0 +1,31 @@
---
- name: Disable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
backend: immich
host: s{{ server_idx }}
- name: Start immich server container
become: true
community.docker.docker_container:
name: immich-{{ server_idx }}
image: ghcr.io/immich-app/immich-server:{{ tag }}
env_file: /etc/immich/_data/immich.env
volumes:
- /etc/localtime:/etc/localtime:ro
- /mnt/hdd/immich:/usr/src/app/upload
- /etc/immich/_data:/etc/immich
networks:
- name: haproxy
- name: immich
- name: postgresql
recreate: "{{ cfg.changed }}"
restart_policy: unless-stopped
- name: Enable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: immich
host: s{{ server_idx }}