diff --git a/deploy/ansible/roles/app/tasks/main.yml b/deploy/ansible/roles/app/tasks/main.yml index 0bc9642..2c5df00 100644 --- a/deploy/ansible/roles/app/tasks/main.yml +++ b/deploy/ansible/roles/app/tasks/main.yml @@ -217,12 +217,11 @@ docker kill -s HUP rustyip-haproxy changed_when: true - - name: Force new backend out of maintenance via stats admin + - name: Force new backend out of maintenance via admin socket ansible.builtin.shell: | sleep 1 - docker exec rustyip-haproxy wget -qO- \ - --post-data='s=app/{{ deploy_target }}&action=ready' \ - "http://127.0.0.1:9000/stats" 2>/dev/null + docker exec rustyip-haproxy sh -c \ + 'echo "set server app/{{ deploy_target }} state ready" | socat stdio unix:/var/run/haproxy/admin.sock' changed_when: true - name: Wait for new backend to be UP in HAProxy @@ -282,12 +281,11 @@ changed_when: true failed_when: false - - name: Force original backend out of maintenance via stats admin + - name: Force original backend out of maintenance via admin socket ansible.builtin.shell: | sleep 1 - docker exec rustyip-haproxy wget -qO- \ - --post-data='s=app/{{ current_active }}&action=ready' \ - "http://127.0.0.1:9000/stats" 2>/dev/null + docker exec rustyip-haproxy sh -c \ + 'echo "set server app/{{ current_active }} state ready" | socat stdio unix:/var/run/haproxy/admin.sock' changed_when: true failed_when: false diff --git a/deploy/ansible/roles/app/templates/docker-compose.yml.j2 b/deploy/ansible/roles/app/templates/docker-compose.yml.j2 index f69cedf..1d394c8 100644 --- a/deploy/ansible/roles/app/templates/docker-compose.yml.j2 +++ b/deploy/ansible/roles/app/templates/docker-compose.yml.j2 @@ -9,6 +9,7 @@ services: - ./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro - ./haproxy/ipv4_domain.lst:/usr/local/etc/haproxy/ipv4_domain.lst:ro - ./haproxy/certs:/etc/haproxy/certs:ro + - haproxy_run:/var/run/haproxy {% if ipv4_domain %} - ./haproxy/certs-ipv4:/etc/haproxy/certs-ipv4:ro {% endif %} @@ -64,6 +65,7 @@ services: - internal volumes: + haproxy_run: db_data_blue: db_data_green: diff --git a/deploy/ansible/roles/app/templates/haproxy.cfg.j2 b/deploy/ansible/roles/app/templates/haproxy.cfg.j2 index 6f73f2e..23119eb 100644 --- a/deploy/ansible/roles/app/templates/haproxy.cfg.j2 +++ b/deploy/ansible/roles/app/templates/haproxy.cfg.j2 @@ -1,6 +1,7 @@ global log stderr local0 err maxconn 10000 + stats socket /var/run/haproxy/admin.sock mode 660 level admin # Performance tuning for high-throughput tune.bufsize 16384 tune.maxrewrite 1024 @@ -137,7 +138,6 @@ frontend stats_internal stats enable stats uri /stats stats refresh 2s - stats admin if TRUE resolvers docker_dns nameserver dns1 127.0.0.11:53