ЛР 3: балансировка и отказ API-реплики

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-11-13 18:40:22 +03:00
co-authored by Copilot
parent 0ab3a341aa
commit a4ef70be38
18 changed files with 1279 additions and 15 deletions
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
set -eu
docker compose up -d --build --force-recreate
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
for service in api1 api2; do
container="$(docker compose ps -q "$service")"
[ -n "$container" ] || continue
if docker inspect -f '{{range .Config.Env}}{{println .}}{{end}}' "$container" |
grep -Fx "INSTANCE_ID=$TARGET_INSTANCE_ID" >/dev/null; then
docker compose stop "$service"
exit 0
fi
done
exit 1