Files
mtusi2026lab7/scripts/stop-one.sh
T
vika baafe2a3ae
Skeleton contracts / contracts (pull_request) Canceled after 0s
Добавить стенд лабораторной 7 с mTLS, OpenBao и least privilege worker.
Закрывает обязательный минимум и трек 1: ротация leaf и секрета, sealed OpenBao и сохранность queued-задачи.
2026-11-07 20:46:02 +03:00

24 lines
628 B
Bash

#!/bin/sh
# Map the public random alias to the compose service and stop only that replica.
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
found=""
for dir in run/instances/*; do
[ -f "$dir/id" ] || continue
current=$(tr -d '\r\n' < "$dir/id")
if [ "$current" = "$TARGET_INSTANCE_ID" ]; then
found=$(basename "$dir")
break
fi
done
if [ -z "$found" ]; then
echo "unknown instance alias" >&2
exit 1
fi
case "$found" in
api-1|api-2) ;;
*) echo "alias does not belong to an API replica" >&2; exit 1 ;;
esac
docker compose --env-file .env stop -t 2 "$found"