Исправить readiness LB и ресурсные лимиты

This commit is contained in:
EgorAnti
2026-11-05 12:48:30 +03:00
parent 7080fdd3e2
commit 9c3e4fd126
24 changed files with 466 additions and 45 deletions
@@ -0,0 +1,32 @@
# Readiness gate and Compose limits — 2026-11-05
Command:
```text
python -B student_tests/readiness_gate.py --base-url http://localhost:8080
```
Observed result:
```text
PASS: 2 unhealthy API containers refused business traffic with 503 and recovered after schema restoration
table_state=true|false
```
The test temporarily renamed `message_idempotency`, waited until both Docker
API health states became `unhealthy`, and verified JSON 503 from both
`/health/ready` and authenticated `/api/v1/users/me` through Nginx. Its
`finally` block restored the table. Both API containers then became `healthy`,
and readiness/business requests returned 200.
Applied `docker inspect` values:
| Service | NanoCpus | Memory bytes |
| --- | ---: | ---: |
| PostgreSQL | 1,000,000,000 | 805,306,368 |
| Redis | 250,000,000 | 268,435,456 |
| API (each) | 750,000,000 | 805,306,368 |
| Nginx | 250,000,000 | 134,217,728 |
The one-shot Compose migration service is configured with 0.75 CPU and 768 MiB.
The Swarm migration job uses the same explicit limits.