feat: add rolling update with LB drain and rollout load profile

scripts/rolling-update.sh (make rolling_update) replaces API replicas one
by one: build, migrations once, new replica UP in HAProxy, old replica
drained and put into maintenance through the LB runtime API on loopback,
then stopped and removed; the slot is reset once DNS drops the address.
Expand migration adds messages.instance_id with a lock timeout. The bench
rollout profile runs the same script under constant load, starting from
the image of an older commit built with git archive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 00:49:50 +03:00
co-authored by Claude Opus 5.5
parent 9a00795de1
commit d2148ac566
20 changed files with 1907 additions and 102 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ Evidence снимается с закоммиченного кода: комми
## 1. Приложение: колонка `messages.instance_id`
- [ ] 1.1 Модель `Message` и ревизия alembic по решению 7:
- [x] 1.1 Модель `Message` и ревизия alembic по решению 7:
- `instance_id: Mapped[str | None]` (Text, NULL) с комментарием;
- ревизия `added message instance id` через `uv run alembic revision
--autogenerate` против базы на прежней ревизии, только чтение схемы.
@@ -37,7 +37,7 @@ Evidence снимается с закоммиченного кода: комми
## 2. Балансировщик и скрипт замены
- [ ] 2.1 `infra/haproxy/haproxy.cfg`: `stats socket
- [x] 2.1 `infra/haproxy/haproxy.cfg`: `stats socket
ipv4@127.0.0.1:9999 level admin` в `global` с комментарием (решение
2). Проверка: `haproxy -c` в закреплённом образе с `API_PORT=8080` —
`Configuration file is valid`.
@@ -58,11 +58,11 @@ Evidence снимается с закоммиченного кода: комми
## 3. Профиль `rollout` стенда `bench/`
- [ ] 3.1 `bench/rollout.py` (решение 8): разбор строк скрипта, событий
- [x] 3.1 `bench/rollout.py` (решение 8): разбор строк скрипта, событий
Docker проекта и журнала LB по шагам замены; шкала с `old_ok` /
`new_ok`; окна до, во время и после; строка прогона; строки по
репликам; `summary.md`. Только stdlib, парсеры — из `failover.py`.
- [ ] 3.2 `bench/run.py`:
- [x] 3.2 `bench/run.py`:
- профили `rollout` и `rollout_quick`, поля `Profile`;
- `--from` для отладки;
- образ прежнего commit через `git archive`, тег `bench-from` и
@@ -102,7 +102,7 @@ Evidence снимается с закоммиченного кода: комми
## 5. Общая проверка кода и коммит
- [ ] 5.1 `make lint`, `make check`, `openspec validate rolling-update
- [x] 5.1 `make lint`, `make check`, `openspec validate rolling-update
--strict`, `haproxy -c`. Проверка: все с кодом 0.
- [ ] 5.2 Самопроверки на своих стендах, рабочий не трогается:
- `make test_isolated` — новая ревизия на временной базе, smoke и