feat(lab3): add nginx load balancing, scaling, idempotency and failover script

This commit is contained in:
2026-10-23 03:54:09 +03:00
parent 0ab3a341aa
commit a99e4c72c6
21 changed files with 973 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
upstream api_backend {
# Nginx будет автоматически резолвить имена через Docker DNS
server api:8080 max_fails=1 fail_timeout=5s;
}
server {
listen 8080;
# Проксирование ВСЕХ запросов на API реплики
location / {
proxy_pass http://api_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Request-Id $http_x_request_id;
# Таймауты для graceful shutdown
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
}
}