Собрать стенд lab3 с двумя репликами API за Traefik.

Общие PostgreSQL, Valkey и идемпотентность сообщений нужны, чтобы чтение и запись переживали остановку одной реплики.
This commit is contained in:
samsik
2026-10-23 01:14:48 +03:00
parent 0ab3a341aa
commit eb9c378b9c
28 changed files with 2335 additions and 37 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
cd "$(dirname "$0")/.."
found=""
for cid in $(docker compose --env-file .env -f compose.yaml ps -q api); do
host=$(docker inspect -f '{{.Config.Hostname}}' "$cid")
short=$(printf '%s' "$cid" | cut -c1-12)
if [ "$host" = "$TARGET_INSTANCE_ID" ] || [ "$short" = "$TARGET_INSTANCE_ID" ]; then
found=$cid
break
fi
done
if [ -z "$found" ]; then
echo "API replica was not found" >&2
exit 1
fi
# docker stop + restart: unless-stopped оставляет реплику выключенной.
docker stop -t 8 "$found" >/dev/null