50 lines
2.3 KiB
INI
50 lines
2.3 KiB
INI
global
|
|
log stdout format raw local0
|
|
maxconn 256
|
|
stats socket /tmp/haproxy.sock mode 600 level user
|
|
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
|
|
ssl-default-server-options ssl-min-ver TLSv1.2 no-tls-tickets
|
|
|
|
defaults
|
|
mode http
|
|
log global
|
|
timeout connect 1s
|
|
timeout client 20s
|
|
timeout server 15s
|
|
timeout check 2s
|
|
timeout queue 2s
|
|
retries 0
|
|
|
|
resolvers docker
|
|
nameserver dns 127.0.0.11:53
|
|
resolve_retries 3
|
|
timeout resolve 1s
|
|
timeout retry 1s
|
|
hold valid 1s
|
|
hold obsolete 1s
|
|
hold nx 1s
|
|
|
|
frontend public
|
|
bind :8443 ssl crt /run/tls/identity/combined.pem
|
|
http-request set-var(txn.lb_request_id) uuid()
|
|
http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No ready API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { nbsrv(apis) eq 0 } !{ path /health/live }
|
|
http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No live API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { path /health/live } { nbsrv(live_apis) eq 0 }
|
|
use_backend live_apis if { path /health/live }
|
|
default_backend apis
|
|
|
|
backend apis
|
|
balance roundrobin
|
|
option httpchk GET /health/ready
|
|
http-check expect status 200
|
|
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2
|
|
server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none
|
|
|
|
# Liveness remains observable when a dependency seals and readiness is false.
|
|
# This backend exposes only the exact liveness path, still through LB mTLS.
|
|
backend live_apis
|
|
balance roundrobin
|
|
option httpchk GET /health/live
|
|
http-check expect status 200
|
|
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2
|
|
server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none
|