chore: port lab4 solution as lab5 base

This commit is contained in:
2026-11-15 14:42:12 +03:00
parent 276dbdad8a
commit 19dda6e286
90 changed files with 18537 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
project="${COMPOSE_PROJECT_NAME:-messenger-lab5}"
labels=$(docker inspect -f '{{index .Config.Labels "com.docker.compose.project"}}/{{index .Config.Labels "com.docker.compose.service"}}' "$TARGET_INSTANCE_ID")
if [ "$labels" != "$project/api" ]; then
echo "refusing to stop $TARGET_INSTANCE_ID: not an api replica of $project ($labels)" >&2
exit 1
fi
docker stop -t 8 "$TARGET_INSTANCE_ID" >/dev/null
docker inspect -f '{{.Name}} {{.State.Status}} finished={{.State.FinishedAt}}' "$TARGET_INSTANCE_ID"