Добавить балансировщик HAProxy, две реплики API и хуки отказа

This commit is contained in:
Pavel Grigorev
2026-11-12 19:45:14 +03:00
parent 291dfe65bf
commit 5263d3ec7a
9 changed files with 328 additions and 5 deletions
+53
View File
@@ -0,0 +1,53 @@
global
log stdout format raw local0 info
maxconn 2000
defaults
mode http
log global
option httplog
option http-server-close
option forwardfor
option redispatch
retries 2
retry-on conn-failure
timeout connect 1s
timeout client 30s
timeout server 10s
timeout check 1s
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 2
timeout resolve 1s
timeout retry 1s
hold valid 2s
hold obsolete 2s
hold nx 2s
accepted_payload_size 8192
frontend messenger
bind :8080
monitor-uri /lb/health
use_backend api_live if { nbsrv(api) lt 1 }
default_backend api
backend api
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
default-server check inter 1s fall 2 rise 2 resolvers docker init-addr none
server-template api 1-4 api:8080
backend api_live
balance roundrobin
option httpchk GET /health/live
http-check expect status 200
default-server check inter 1s fall 2 rise 2 resolvers docker init-addr none
server-template live 1-4 api:8080
listen stats
bind :8404
stats enable
stats uri /
stats refresh 2s