Добавила всё необходимое для корректного выполнения теста resilience.py

This commit is contained in:
vasyukova
2026-10-08 20:51:24 +03:00
parent 8688f66fd5
commit 5da3ada550
5 changed files with 88 additions and 59 deletions
+27 -32
View File
@@ -1,38 +1,33 @@
worker_processes auto;
events { worker_connections 1024; }
# vhost для nginx: монтируется в /etc/nginx/conf.d/default.conf.
http {
# access_log / error_log по умолчанию в stdout/stderr образа nginx.
upstream api_backend {
# max_fails=1 fail_timeout=5s: после первой ошибки реплика сразу
# исключается из ротации на 5 секунд. Иначе resilience-тест
# «too few successful writes after stop» будет падать.
server api:8080 max_fails=1 fail_timeout=5s;
}
upstream api_backend {
# Docker DNS отдаёт все IP реплик сервиса api.
server api:8080 max_fails=2 fail_timeout=5s;
keepalive 32;
server {
listen 80 default_server;
server_name _;
proxy_connect_timeout 1s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
location / {
proxy_pass http://api_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
server {
listen 80;
# Короткие таймауты, чтобы мёртвый backend быстро исключался.
proxy_connect_timeout 2s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
location / {
proxy_pass http://api_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
# readiness LB напрямую проверяет свой upstream через api (docker healthcheck).
location = /lb/health {
return 200 "ok\n";
add_header Content-Type text/plain;
}
location = /lb/health {
return 200 "ok\n";
add_header Content-Type text/plain;
}
}