ЛР 3: балансировка, 2 реплики API и общая идемпотентность (оценка 3)

This commit is contained in:
Яковлев Матвей Дмитриевич
2026-11-16 23:34:49 +01:00
parent 0ab3a341aa
commit c8ee2a50b8
18 changed files with 1204 additions and 21 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
# Explicit failover hook: stop exactly ONE API replica selected by the test.
# TARGET_INSTANCE_ID is the X-Instance-Id served by that replica (api1 or api2).
# DB, volume and load balancer are untouched. Return quickly; leave the replica stopped.
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
case "$TARGET_INSTANCE_ID" in
api1|api2) docker compose stop "$TARGET_INSTANCE_ID" ;;
*) echo "unknown target instance: $TARGET_INSTANCE_ID" >&2; exit 1 ;;
esac