feat: put API replicas behind HAProxy

HAProxy 3.4 is the only published entry point; api runs as
API_REPLICAS replicas without ports, found through Docker DNS and
checked on /health/ready. Retries only on connection failure, LB errors
in the contract error format, resource limits and per-service secrets.
Adds scripts/stop-one.sh, LB-aware restart.sh, make replicas /
instances / lb_stats and replica tests driven by EXPECT_REPLICAS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 18:05:05 +03:00
co-authored by Claude Opus 5.5
parent 8e15e02898
commit ab71c3b51e
31 changed files with 1295 additions and 240 deletions
+9
View File
@@ -59,6 +59,15 @@ paths:
базовый замер снимается заново. Профили лабы 2 (`full`, `restore*`)
продолжают работать и после перехода на N реплик.
До `graceful-failover` override `bench/bench.compose.yml` держит один
API: у `api` `deploy.replicas: 1` и `container_name` (k6 ходит к нему
по имени), `haproxy` не запускается (`up -d --no-deps api`), его порт
сброшен. Лимиты `api`, `postgres` и `valkey` — в форме
`deploy.resources.limits` с теми же `BENCH_*` (основной compose задаёт
лимиты так же, и `cpus` / `mem_limit` рядом с ними compose не
принимает); `memswap_limit` — на уровне сервиса. `NanoCpus` и `Memory`
контейнеров при этом те же, метки сравнимы.
Стенд — свой проект compose `mtusi-bench`: тот же `docker-compose.yml`
с override `bench/bench.compose.yml` (по образцу `make failure_checks`),
подстановки — `bench/bench.env`, а не `.env` рабочего стенда. Пароли