feat: port lab3 backend foundation to lab4

This commit is contained in:
sinveria
2026-11-09 19:17:48 +03:00
parent ec540a1a72
commit aaa834e412
42 changed files with 2787 additions and 0 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