Complete Lab 5 for Grade 4

This commit is contained in:
paflove
2026-11-23 17:20:36 +03:00
parent 276dbdad8a
commit 93744ea8d0
26 changed files with 2568 additions and 15 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -e
for cid in $(docker compose ps -q api); do
inst_id=$(docker exec "$cid" curl -s -i http://localhost:8000/health/live | grep -i "^x-instance-id:" | tr -d '\r' | awk '{print $2}')
if [ -z "$TARGET_INSTANCE_ID" ] || [ "$inst_id" = "$TARGET_INSTANCE_ID" ]; then
echo "Stopping container $cid (X-Instance-Id: $inst_id)"
docker stop -t 2 "$cid"
exit 0
fi
done
echo "Target replica not found"
exit 1