global # Operator access only inside this container; no host port is published. stats socket ipv4@127.0.0.1:9999 level admin log stdout format raw local0 maxconn 1024 defaults log global mode http option httplog timeout connect 1s timeout client 35s timeout server 35s timeout check 1s # Let the client decide which failed POST is safe to repeat. retries 0 # Docker returns the current addresses of all containers of the api service. resolvers docker nameserver docker_dns 127.0.0.11:53 accepted_payload_size 8192 resolve_retries 3 timeout resolve 1s timeout retry 1s hold valid 1s hold obsolete 1s hold nx 1s hold timeout 1s hold refused 1s hold other 1s frontend api_entry bind :8080 default_backend api_replicas backend api_replicas balance roundrobin option httpchk GET /health/ready http-check expect status 200 # Separate slots receive distinct Docker DNS addresses. No sticky sessions. server-template api "${API_REPLICAS}" "api:${APP_PORT}" check inter 1s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr libc,none # Local teaching aid: backend addresses, UP/DOWN state and request counters. listen statistics bind :8404 stats enable stats show-legends stats uri /stats stats refresh 2s