Files
mtusi2026lab4/infra/haproxy.cfg
DaniilKuznetsovandЮгай Артур Рустамович 0c5c19bb09 ЛР4 на 3
Co-authored-by: Югай Артур Рустамович <f1ekserr@yandex.ru>
2026-11-16 22:00:33 +03:00

45 lines
1.2 KiB
INI

global
log stdout format raw local0
maxconn 256
defaults
mode http
log global
timeout connect 1s
timeout client 60s
timeout server 60s
timeout check 3s
retries 0
http-error status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"API temporarily unavailable","request_id":"%[unique-id]"}}' hdr X-Request-Id %[unique-id]
resolvers docker
nameserver local 127.0.0.11:53
resolve_retries 2
timeout resolve 1s
timeout retry 1s
hold valid 1s
hold nx 1s
hold obsolete 1s
frontend public
bind :8080
unique-id-format %[uuid()]
use_backend api_live if { path /health/live }
default_backend api_ready
backend api_ready
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none
server first api1:8080 check
server second api2:8080 check
backend api_live
balance roundrobin
option httpchk GET /health/live
http-check expect status 200
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none
server first api1:8080 check
server second api2:8080 check