Реализовать lab3: HAProxy, API×N, идемпотентность и трек 1.

Горизонтальное масштабирование за LB с общими сессиями Redis, X-Instance-Id,
обязательным Idempotency-Key в PostgreSQL, сценариями failover/persistence и
измерением цены масштабирования при фиксированном CPU/RAM бюджете.
This commit is contained in:
Mlvn
2026-11-06 21:07:00 +03:00
parent 0ab3a341aa
commit b1972bcfd8
56 changed files with 3893 additions and 28 deletions
+16 -2
View File
@@ -4,10 +4,12 @@ CA_FILE ?=
ACTION_SCRIPT ?=
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
.PHONY: help check validate test load test-persistence test-failover
GO ?= go
.PHONY: help check validate test load test-persistence test-failover student-test up down track1
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@echo "up: build+scale API behind LB; test/test-persistence/test-failover/student-test/track1"
check:
$(PYTHON) scripts/check_contract.py
@@ -15,6 +17,12 @@ check:
validate:
$(PYTHON) scripts/validate_openapi.py
up:
bash scripts/up.sh
down:
docker compose --env-file .env down
test:
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
@@ -28,3 +36,9 @@ test-persistence:
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-test:
$(GO) test ./student-tests/ -v -count=1 -timeout 180s
track1:
bash scripts/run_track1.sh