Files
mtusi2026lab4/infra/haproxy/haproxy.cfg
T
drunkdiente 935307d412 Реализовать ЛР4: S3-хранилище и вложения на оценку 3
Стенд: PostgreSQL 16 + две API-реплики за HAProxy + SeaweedFS S3 в приватном bucket. Метаданные вложений в PostgreSQL, байты в S3, object key назначает сервер. Лимиты 10 MiB и 40 млн пикселей, MIME по магическим байтам, проверка filename. Добавлены smoke/негативные тесты, хуки restart/stop-one, сценарий отказа S3 и отчёт с доказательствами.
2026-11-08 14:29:02 +03:00

48 lines
1.5 KiB
INI

global
log stdout format raw local0
maxconn 4096
# Docker's embedded DNS. Re-resolving the replica names periodically prevents a
# stale address from being used if a container is recreated with another IP
# (a name resolved once at startup can otherwise point to the wrong replica).
resolvers docker
nameserver dns1 127.0.0.11:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 5s
hold nx 1s
hold timeout 1s
hold refused 1s
hold other 1s
defaults
mode http
log global
option httplog
option dontlognull
option redispatch
# Close the server-side connection after each response so that roundrobin
# distributes every request instead of reusing one idle backend connection.
option http-server-close
retries 2
# A stopped container's IP silently drops packets, so a short connect
# timeout bounds how long a request waits before redispatch to a live peer.
timeout connect 500ms
timeout client 60s
timeout server 60s
frontend public_http
bind *:8080
default_backend api_backend
backend api_backend
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
# Fast detection: a stopped replica must leave rotation within a couple of
# seconds, otherwise in-flight writes fail while the LB still routes to it.
default-server check inter 1s fastinter 200ms downinter 500ms fall 2 rise 1
server api1 api1:8080 check resolvers docker init-addr none
server api2 api2:8080 check resolvers docker init-addr none