Files
mtusi2026lab2/openspec/changes/archive/2026-10-28-add-lab3-failover-operations/tasks.md
T
ArtyomandClaude Opus 5.5 1210dd899c Carry over the agent context and openspec history from lab 4
Bring the Claude Code settings, the lint hook, the opsx commands and
skills, the architecture notes, the lab 1 to lab 4 specs and the
archived lab 1 to lab 4 changes into the lab 5 skeleton, so lab 5
continues the same spec history instead of starting from scratch. The
files come from the lab 4 solution commit d2744bc.

Rewrite AGENTS.md and the openspec context and rules for lab 5: upload
answers 202 queued after the original is in a private staging prefix
and the attachment, the job and the outbox row are committed in one
transaction, a separate relay publishes the outbox to RabbitMQ with
publisher confirms, a separate worker built from the same image
consumes the queue through FastStream with a manual ack after the
result commit, PostgreSQL stays the source of truth for job states,
Out of scope moves to labs 6-7, track 1 and broker HA, and the rules
add the failure windows between PostgreSQL and the broker, the effect
key and the lease to specs and designs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 00:32:37 +03:00

36 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. Остановка и готовность (платформа)
- [x] 1.1 `DRAINING` в `shared/entrypoints/health.py`: `/health/ready` отвечает `503 unavailable`, пока флаг поднят
- [x] 1.2 `DrainingServer` и `MessengerWorker._serve` в `gunicorn_conf.py`: окно `DRAIN_SECONDS`, затем штатная остановка; uvicorn дообрабатывает `SHUTDOWN_TIMEOUT_SECONDS − DRAIN_SECONDS`
- [x] 1.3 Пинг readiness: 0,4 с на соединение и 0,4 с на запрос
- [x] 1.4 Проверка группы: тесты — ready `503` при флаге и live `200`; настоящий gunicorn по `SIGTERM` держит окно, закрывает порт и выходит с кодом 0 за срок
## 2. Стенд и таймауты
- [x] 2.1 `compose.yaml`: явные `DRAIN_SECONDS`, `DB_ACQUIRE_TIMEOUT_SECONDS`, `DB_COMMAND_TIMEOUT_SECONDS` у `api`; сервис `k6` под профилем `bench`; `.env.example`, Dockerfile
- [x] 2.2 Тест цепочки таймаутов по `compose.yaml`, `haproxy.cfg` и `scripts/stop-one.sh`
- [x] 2.3 HAProxy `init-state fully-down`: вернувшаяся через DNS реплика ждёт `rise 2` проверок
- [x] 2.4 Проверка группы: `docker compose --profile bench config --quiet`, `make student-test -k "timeouts or drain"`
## 3. Нагрузка и зонд
- [x] 3.1 `infra/k6/messages.js`, `scripts/k6.sh` (запуск от uid хоста)
- [x] 3.2 `scripts/probe.py`: `load` (k6 + зонд + опрос LB, `action.txt`, счётчики повторов LB, `--expect dip|replace`, `pass`), `detect` (действие фоном, `--max`, `--until`, `--within-action`, `--lb-status`, `--restore`), `check --rounds`
- [x] 3.3 Проверка группы: `make lint`, `make check` (разбор `scripts/*.py` интерпретатором CI), `k6 inspect`
## 4. Сценарии уровня «4»
- [x] 4.1 `scripts/detection.sh` и `make detection`: `SIGTERM`, `docker kill`, `docker pause`, остановка PostgreSQL с заявленными максимумами
- [x] 4.2 `scripts/failover-each.sh` и `make failover-each`: остановка, 10 с без реплики и возврат каждой реплики под нагрузкой
- [x] 4.3 `scripts/limits.py` и `make limits`: политика лимитов, портов, секретов, volumes, сетей
- [x] 4.4 `scripts/rolling-update.sh` и `make rolling-update [FROM_REV=…]`: `migrate` один раз, замена с запасом +1, журнал образов
- [x] 4.5 Тест отказа PostgreSQL через LB: ответы `503`, live внутри реплики `200`, LB исключает все реплики и сам отвечает `503`
- [x] 4.6 CI: `make limits`, `make detection` в acceptance
- [x] 4.7 Проверка группы: `make up`, `make limits`, `make lb-check`, `make detection`, `make failover-each`, `make rolling-update FROM_REV=8d28d45`, `make test-faults`
## 5. Отчёт
- [x] 5.1 `evidence/`: detection, failover-each, rolling, limits, lb-check, повторные прогоны уровня «3» на новом коде
- [x] 5.2 `REPORT.md`: таймауты и обнаружение, строки 4.1–4.4, таблица отказов уровня «4», ограничения
- [x] 5.3 Проверка группы: `make check`, `make validate`, `make lint`, `make student-test`, `make test`, `make test-persistence ACTION_SCRIPT=scripts/restart.sh`, `make test-failover ACTION_SCRIPT=scripts/stop-one.sh` для обеих реплик