forked from mtusi2026/mtusi2026lab5
lab5: RabbitMQ, relay и worker в стенде; reconciler lab4 убран
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> broker: RabbitMQ 4.3.7 (тег+digest), quorum queue + DLX/DLQ из definitions, пользователи relay (только publish в exchange) и worker (только consume), без management UI и портов. relay: outbox -> publish с publisher confirm, reaper истёкших lease, страховка от потерянных сообщений. worker: claim + heartbeat lease, варианты, публикация с fencing, ack после COMMIT, graceful stop, уборка staging и мусора попыток. S3: два bucket и четыре identity (admin, api, worker, auditor) с проверкой модели доступа в s3-init. Отдельная сеть queue. Reconciler lab4 (трек прошлой лабы) удалён: его роль выполняет уборка по журналу попыток.
This commit is contained in:
@@ -29,23 +29,23 @@ test-failover:
|
||||
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
|
||||
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
# ---------------------------------------------------------------------------
|
||||
# Student solution (lab 4, Python). On Windows: PowerShell/Git Bash with GNU make, public
|
||||
# Student solution (lab 5, Python). On Windows: PowerShell/Git Bash with GNU make, public
|
||||
# tests need PYTHONUTF8=1, and the hooks are started through scripts/*.cmd (Git Bash).
|
||||
.PHONY: secrets up down logs ps migrate student-test unit-test explain lb-status restore rolling-update failover-series reconcile reconcile-apply bench-memory bench-reconcile
|
||||
.PHONY: secrets up down logs ps migrate student-test unit-test explain lb-status restore rolling-update failover-series bench-memory worker-stop worker-start jobs failed audit track2
|
||||
|
||||
secrets:
|
||||
$(PYTHON) scripts/init_secrets.py
|
||||
|
||||
# Build, apply migrations ONCE (service migrate), start API replicas and the LB, wait for healthy.
|
||||
# Build, apply migrations ONCE (service migrate), start broker, API replicas, LB, relay and worker.
|
||||
up: secrets
|
||||
docker compose up -d --build --wait
|
||||
|
||||
# Safe stop: containers stop, named volumes (data) stay.
|
||||
# Safe stop: containers stop, named volumes (data, queue) stay.
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
logs:
|
||||
docker compose logs --tail 50 api lb
|
||||
docker compose logs --tail 50 api lb relay worker
|
||||
|
||||
ps:
|
||||
docker compose ps -a
|
||||
@@ -67,10 +67,32 @@ restore:
|
||||
rolling-update:
|
||||
sh scripts/rolling-update.sh
|
||||
|
||||
# Level 4: stop each replica in turn under load, measure RPS/errors/recovery (evidence/failover/).
|
||||
# Lab 3: stop each replica in turn under load, measure RPS/errors/recovery (evidence/failover/).
|
||||
failover-series:
|
||||
$(PYTHON) bench/failover_series.py --output evidence/failover
|
||||
|
||||
# Lab 5 demo: stop the worker (uploads still get 202, content answers 409), start it again.
|
||||
worker-stop:
|
||||
docker compose stop worker
|
||||
|
||||
worker-start:
|
||||
docker compose start worker
|
||||
|
||||
# Lab 5 operator view: jobs by state + outbox backlog; failed registry (replay: see REPORT.md).
|
||||
jobs:
|
||||
docker compose run --rm --no-deps jobctl stats
|
||||
|
||||
failed:
|
||||
docker compose run --rm --no-deps jobctl list-failed
|
||||
|
||||
# Track 2: read-only check of the pipeline invariants over PostgreSQL and both buckets.
|
||||
audit:
|
||||
docker compose run --rm --no-deps auditor
|
||||
|
||||
# Track 2: automatic fault-injection matrix (duplicate, reorder, crashes, stale versions).
|
||||
track2:
|
||||
$(PYTHON) bench/pipeline_faults.py --output evidence/track2
|
||||
|
||||
# Own tests: unit + black-box against the running stand (needs requirements*.txt in a venv).
|
||||
student-test:
|
||||
$(PYTHON) -m pytest student-tests -v
|
||||
@@ -81,17 +103,6 @@ unit-test:
|
||||
explain:
|
||||
$(PYTHON) scripts/explain_history.py --output evidence/explain-history.txt
|
||||
|
||||
# Track 2: reconciler of S3 objects vs attachment rows (dry-run by default, read-only).
|
||||
reconcile:
|
||||
docker compose run --rm reconciler
|
||||
|
||||
reconcile-apply:
|
||||
docker compose run --rm reconciler --apply
|
||||
|
||||
# Level 4: peak RAM of the replicas under 16 simultaneous uploads (evidence/memory/).
|
||||
# Lab 4: peak RAM of the replicas under 16 simultaneous uploads (evidence/memory/).
|
||||
bench-memory:
|
||||
$(PYTHON) bench/upload_memory.py --output evidence/memory
|
||||
|
||||
# Track 2: cost of one reconciler pass for 1k/10k/50k attachments (evidence/reconcile/).
|
||||
bench-reconcile:
|
||||
$(PYTHON) bench/reconcile_cost.py --output evidence/reconcile
|
||||
|
||||
Reference in New Issue
Block a user