Реализовать лабораторную 3 на оценку 5 (трек 1)

This commit is contained in:
Чиняева
2026-11-07 00:57:10 +03:00
parent 0ab3a341aa
commit 2c4f0a5a61
96 changed files with 7784 additions and 45 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Stop exactly ONE API replica identified by the X-Instance-Id value supplied
# in TARGET_INSTANCE_ID. The container hostname is the instance id, so the
# mapping is deterministic and does not rely on container names.
# Leave the replica stopped; restore it explicitly after the test.
set -eu
cd "$(dirname "$0")/.."
target="${TARGET_INSTANCE_ID:?test provides target API instance alias}"
for id in $(docker compose --env-file .env ps -q api); do
host=$(docker inspect --format '{{.Config.Hostname}}' "$id")
if [ "$host" = "$target" ]; then
docker stop --time 1 "$id" >/dev/null
exit 0
fi
done
printf '%s\n' "target API replica not found: $target" >&2
exit 1