Реализовать Lab 3: балансировка и отказоустойчивость

This commit is contained in:
2026-10-27 22:05:10 +03:00
parent 0ab3a341aa
commit cc51344be3
50 changed files with 1434 additions and 47 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
# Restart API, entrypoint and shared stores without removing named volumes.
docker compose restart postgres redis api lb
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?test provides X-Instance-Id of the target replica}"
for container in $(docker compose ps -q api); do
instance_id=$(docker inspect --format '{{.Config.Hostname}}' "$container")
if [ "$instance_id" = "$TARGET_INSTANCE_ID" ]; then
# Manual stop leaves this replica out of service until the operator restores it.
docker stop --timeout 1 "$container" >/dev/null
exit 0
fi
done
printf '%s\n' 'target API replica was not found; no container was stopped' >&2
exit 1