forked from mtusi2026/mtusi2026lab5
Переиспользован стек lab4 (LB/2 реплики/Postgres/SeaweedFS). upload теперь 202 queued; отдельный worker-процесс генерирует thumbnail/crop/optimized. Transactional outbox закрывает разрыв COMMIT/publish; durable retry (job_retry_schedule) переживает падение worker во время backoff; lease recovery через XAUTOCLAIM; DLQ-реестр (job_failures) с явным operator replay (scripts/replay_failed.py). make test/test-persistence/test-failover/ validate зелёные; в процессе экспериментов найдены и исправлены два реальных бага (неполный try/except вокруг S3-записи вариантов, ошибка типов asyncpg в построении interval) — см. REPORT.md и evidence/. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
33 lines
1.2 KiB
Nginx Configuration File
33 lines
1.2 KiB
Nginx Configuration File
worker_processes 1;
|
|
# A single worker keeps the round-robin counter shared and deterministic for
|
|
# the lab's small replica count; a production LB would instead rely on a
|
|
# shared/consistent balancing policy across workers.
|
|
events { worker_connections 1024; }
|
|
|
|
http {
|
|
upstream messenger_api {
|
|
# Passive health check: a backend failing 1 probe is removed for 3s,
|
|
# which keeps failover detection well under the 10s budget.
|
|
server api1:8080 max_fails=1 fail_timeout=3s;
|
|
server api2:8080 max_fails=1 fail_timeout=3s;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
# Slightly above the app's own 10 MiB attachment limit so the API --
|
|
# not Nginx's default HTML error page -- produces the contract's
|
|
# JSON 413 envelope. The API still enforces the exact byte budget.
|
|
client_max_body_size 11M;
|
|
|
|
location / {
|
|
proxy_pass http://messenger_api;
|
|
proxy_connect_timeout 1s;
|
|
proxy_read_timeout 5s;
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
proxy_next_upstream_tries 2;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
}
|
|
}
|