restart.sh (полный цикл стенда, без volumes/secrets), stop-one.sh (одна реплика по TARGET_INSTANCE_ID, данные и секреты сохраняются), check_local.py и check_idempotency.py — воспроизводимые локальные проверки.
27 lines
833 B
Bash
Executable File
27 lines
833 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
mkdir -p evidence
|
|
snapshot() {
|
|
for service in db s3 api1 api2 lb; do
|
|
id=$(docker compose ps -aq "$service")
|
|
docker inspect --format '{{.Name}} {{.State.StartedAt}} {{.State.Status}}' "$id"
|
|
done
|
|
}
|
|
snapshot > evidence/restart-before.txt
|
|
docker compose stop -t 7 lb api1 api2
|
|
docker compose restart -t 10 db s3
|
|
i=0
|
|
until docker compose exec -T db pg_isready -U messenger -d messenger >/dev/null 2>&1; do
|
|
i=$((i + 1)); [ "$i" -lt 30 ] || exit 1
|
|
sleep 1
|
|
done
|
|
i=0
|
|
until docker compose exec -T s3 sh -c 'curl -fsS http://127.0.0.1:9000/minio/health/live >/dev/null' 2>/dev/null; do
|
|
i=$((i+1)); [ "$i" -lt 30 ] || exit 1
|
|
sleep 1
|
|
done
|
|
# Existing schema is retained; the restart hook does not migrate/reseed.
|
|
docker compose start api1 api2 lb
|
|
snapshot > evidence/restart-after.txt
|