forked from mtusi2026/mtusi2026lab4
Исходники, Dockerfile, compose.yaml, скрипты и собственные тесты скопированы из mtusi2026lab3 (ветка solution/bvt2302-bodanyuk, b6847e2) как есть; изменения lab4 — отдельными коммитами. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
916 B
Bash
Executable File
18 lines
916 B
Bash
Executable File
#!/bin/sh
|
|
# Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`.
|
|
# Restarts EVERY process of the stand: LB, all API replicas, PostgreSQL and Valkey.
|
|
# Volumes, schema and data are preserved: no `down -v`, no FLUSH, no re-seed.
|
|
# Output is suppressed by the test; run it by hand to see the steps.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# 1. Entry point and API first: no request is served while the stores restart underneath.
|
|
docker compose stop lb api
|
|
# 2. Stores: clean shutdown (PostgreSQL checkpoint, Valkey AOF fsync), then start again.
|
|
docker compose restart postgres valkey
|
|
# 3. API replicas (wait for healthy stores via depends_on), then the LB. HAProxy resolves
|
|
# the new replica addresses through Docker DNS by itself - no stale backend list.
|
|
docker compose start api
|
|
docker compose start lb
|
|
echo "restart.sh: lb, api (all replicas), postgres and valkey restarted with volumes preserved"
|