feat: port verified messenger from lab 6

This commit is contained in:
Dmitrii Grishko
2026-11-14 19:16:28 +03:00
parent 20afc2c790
commit e3d7df4e72
142 changed files with 13702 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?Set TARGET_INSTANCE_ID to the X-Instance-Id of an API replica}"
for container in $(docker compose --project-name highload-lab7 --env-file .env -f compose.yml ps -q api); do
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$container")
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
# Only containers from this Compose project's api service are eligible.
docker stop --timeout 8 "$container" >/dev/null
printf 'Stopped API instance %s\n' "$hostname"
exit 0
fi
done
printf 'No running API replica matches TARGET_INSTANCE_ID\n' >&2
exit 1