ЛР 6 — БПИ2302 — Нурлыгаянова — на 3

This commit is contained in:
Nurlygayanova Ekaterina
2026-11-13 11:32:45 +03:00
parent 470d9d6f1e
commit 69a190be0e
164 changed files with 25947 additions and 29 deletions
+54
View File
@@ -0,0 +1,54 @@
global
log stdout format raw local0 info
resolvers docker
nameserver dns 127.0.0.11:53
accepted_payload_size 8192
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 5s
hold obsolete 5s
defaults
mode http
log global
option httplog
option dontlognull
retries 2
retry-on conn-failure
option redispatch 1
timeout connect 500ms
timeout client 30s
timeout server 15s
timeout http-request 10s
timeout http-keep-alive 30s
timeout queue 5s
timeout check 1500ms
# Ответы самого LB в формате контракта: схема Error и X-Request-Id, совпадающий с request_id.
# Контракт разрешает таким ответам не иметь X-Instance-Id. Ответы реплик эти правила не меняют.
http-error status 502 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Service temporarily unavailable","request_id":"%[var(txn.request_id)]"}}'
http-error status 503 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Service temporarily unavailable","request_id":"%[var(txn.request_id)]"}}'
http-error status 504 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Service temporarily unavailable","request_id":"%[var(txn.request_id)]"}}'
frontend public
bind :8080
# Идентификатор для ответов самого LB. У ответов реплик свой X-Request-Id.
http-request set-var(txn.request_id) uuid()
default_backend api
backend api
balance roundrobin
option httpchk GET /health/ready
http-check expect status 200
default-server check init-state down inter 1s fall 2 rise 2 observe layer4 error-limit 2 on-error mark-down resolvers docker init-addr none resolve-prefer ipv4
server-template api 1-8 api:8080
frontend stats
bind 127.0.0.1:8404
monitor-uri /health
stats enable
stats uri /stats