feat: add HAproxy and 2 api instances

This commit is contained in:
TAskMAster339
2026-10-10 13:20:58 +03:00
parent a856733fe9
commit 771951cad7
23 changed files with 742 additions and 213 deletions
+46
View File
@@ -0,0 +1,46 @@
global
log stdout format raw local0
maxconn 1024
defaults
log global
mode http
option httplog
timeout connect 1s
timeout client 15s
timeout server 12s
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 2 api:8080 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 uri /stats
stats refresh 2s