Round robin on all haproxy backup servers for blue-green deploys.

This commit is contained in:
Samuel Clay 2025-02-02 21:43:47 -08:00
parent 934caff501
commit ec41e9abaf
2 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,7 @@
# serial: "50%"
vars_files:
- ../env_vars/base.yml
- roles/letsencrypt/defaults/main.yml
vars:
haproxy_host: "{{ 'hstaging' if 'staging' in inventory_hostname else 'hwww' }}"
@ -232,6 +233,7 @@
- name: Update HAProxy config to use new server
delegate_to: "{{ haproxy_host }}"
run_once: true
block:
- name: Generate temporary HAProxy config with new server
template:

View file

@ -103,6 +103,8 @@ backend nginx
{% endfor %}
backend app_django
balance roundrobin
option allbackups
option httpchk GET /_haproxychk
default-server check inter 1000ms on-error mark-down fall 2 rise 2 resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.hdjango %}
@ -115,6 +117,7 @@ backend app_django
backend app_count
balance roundrobin
option allbackups
option httpchk GET /_haproxychk
default-server check inter 1000ms on-error mark-down fall 2 rise 2 resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.hcount %}
@ -128,6 +131,7 @@ backend app_count
backend app_refresh
balance roundrobin
option allbackups
option httpchk GET /_haproxychk
default-server check inter 2000ms on-error mark-down fall 2 rise 2 resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.hrefresh %}
@ -141,6 +145,7 @@ backend app_refresh
backend app_push
balance roundrobin
option allbackups
option httpchk GET /_haproxychk
default-server check inter 2000ms resolvers consul resolve-prefer ipv4 resolve-opts allow-dup-ip init-addr none
{% for host in groups.hpush %}