This commit is contained in:
2026-10-25 21:46:21 +03:00
parent 5300a1a1e0
commit a7d6487e2d
33 changed files with 5965 additions and 556 deletions
+7
View File
@@ -0,0 +1,7 @@
FROM haproxy:3.2-alpine@sha256:dfba86f031bd4c9039f10f8cc5de75991d1b6766d5460f0335b980408503baad
COPY infrastructure/haproxy/haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
USER haproxy
EXPOSE 8080
+66
View File
@@ -0,0 +1,66 @@
global
log stdout format raw local0
maxconn 2048
defaults
log global
mode http
option httplog
timeout connect 1s
timeout client 30s
timeout server 30s
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 1s
hold other 1s
hold refused 1s
hold nx 1s
hold timeout 1s
hold obsolete 1s
frontend public
bind :8080
acl api_request path_beg /api/ /web-api/ /health/
acl web_api path_beg /web-api/
acl has_session req.cook(mtusi_session) -m found
acl message_create method POST
acl message_path path_reg ^/(api|web-api)/v1/chats/[^/]+/messages$
http-request del-header Authorization if web_api
http-request set-header Authorization "Bearer %[req.cook(mtusi_session)]" if web_api has_session
http-request del-header Cookie if api_request
http-request replace-path ^/web-api/(.*)$ /api/\1 if web_api
use_backend message_backend if message_create message_path
use_backend api_backend if api_request
default_backend frontend_backend
backend api_backend
balance leastconn
option httpchk
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
http-check expect status 200
default-server check inter 1s fastinter 500ms downinter 1s fall 2 rise 2 resolvers docker init-addr libc,none
server-template api 8 api:8080
backend message_backend
balance leastconn
option httpchk
option redispatch
option http-buffer-request
retries 3
retry-on conn-failure empty-response response-timeout 502 503 504
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
http-check expect status 200
default-server check inter 1s fastinter 500ms downinter 1s fall 2 rise 2 resolvers docker init-addr libc,none
server-template api 8 api:8080
backend frontend_backend
option httpchk GET /
http-check expect status 200
server frontend frontend:8080 check inter 2s fall 2 rise 2 resolvers docker init-addr libc,none