feat:level4

This commit is contained in:
Оля Мороз
2026-10-20 18:35:44 +03:00
parent 4349a539d9
commit ae53d39ccc
20 changed files with 775 additions and 26 deletions
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
set -eu
# Перезапуск API + всех state stores, volumes сохраняются.
docker compose restart postgres redis api1 api2 lb
# Ждём готовности.
for i in $(seq 1 60); do
if docker compose exec -T lb wget -qO- http://127.0.0.1:8080/health/ready >/dev/null 2>&1; then
echo "ready after ${i}s"
exit 0
fi
sleep 1
done
echo "stack did not become ready in 60s" >&2
exit 1
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?}"
case "$TARGET_INSTANCE_ID" in
api-1) SERVICE=api1 ;;
api-2) SERVICE=api2 ;;
*) exit 2 ;;
esac
docker compose start "$SERVICE"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
# TARGET_INSTANCE_ID приходит от теста: alias обслужившей реплики.
# В compose alias = INSTANCE_ID = "api-1" / "api-2".
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
case "$TARGET_INSTANCE_ID" in
api-1) SERVICE=api1 ;;
api-2) SERVICE=api2 ;;
*) echo "unknown instance: $TARGET_INSTANCE_ID" >&2; exit 2 ;;
esac
# Останавливаем ТОЛЬКО эту реплику, оставляем остановленной.
docker compose stop "$SERVICE"
echo "stopped $SERVICE ($TARGET_INSTANCE_ID)"