ЛР 3: HAProxy + 2 реплики, общая идемпотентность, rolling update

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LOSYASH
2026-10-22 18:21:19 +03:00
co-authored by Claude Opus 5.5
parent 0ab3a341aa
commit a71c582195
54 changed files with 3192 additions and 40 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# Failover hook для make test-failover.
# X-Instance-Id реплики = hostname контейнера = короткий ID контейнера Docker.
# Останавливаем РОВНО этот контейнер, и только если он относится к сервису api
# (БД, Redis и LB этот скрипт не трогает). Реплика остаётся остановленной;
# вернуть её: scripts/restore-api.sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
cd "$(dirname "$0")/.."
cid=$(docker ps -q --filter "id=${TARGET_INSTANCE_ID}" --filter "label=com.docker.compose.service=api")
[ -n "$cid" ] || { echo "no running api container for ${TARGET_INSTANCE_ID}" >&2; exit 1; }
docker stop -t 8 "$cid" >/dev/null