Complete lab 3 load balancing and resilience

This commit is contained in:
sinveria
2026-11-05 18:29:36 +03:00
parent 0ab3a341aa
commit 1e1fd22ccf
73 changed files with 4507 additions and 26 deletions
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
project="${COMPOSE_PROJECT_NAME:-mtusi-lab3}"
found=""
for id in $(docker ps -q --filter "label=com.docker.compose.project=${project}" --filter "label=com.docker.compose.service=api"); do
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$id")
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
found="$id"
break
fi
done
if [ -z "$found" ]; then
echo "No running API container matches TARGET_INSTANCE_ID" >&2
exit 1
fi
docker stop --time 3 "$found" >/dev/null