forked from mtusi2026/mtusi2026lab4
S3-вложения и сверка Postgresql с MinIO
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Останавливает одну API-реплику и оставляет её остановленной.
|
||||
# TARGET_INSTANCE_ID — значение X-Instance-Id (hostname контейнера).
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
|
||||
target=$(printf '%s' "$TARGET_INSTANCE_ID" | tr -d '[:space:]')
|
||||
found=""
|
||||
for id in $(docker compose --env-file .env ps -q api); do
|
||||
host=$(docker inspect -f '{{.Config.Hostname}}' "$id")
|
||||
full=$(docker inspect -f '{{.Id}}' "$id")
|
||||
short=$(printf '%s' "$full" | cut -c1-12)
|
||||
if [ "$host" = "$target" ] || [ "$short" = "$target" ] || [ "$full" = "$target" ]; then
|
||||
found=$id
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
echo "API replica not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
docker stop -t 8 "$found" >/dev/null
|
||||
Reference in New Issue
Block a user