#!/bin/sh # Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`. # Restarts EVERY process of the stand: LB, all API replicas, PostgreSQL, Valkey and S3 (SeaweedFS). # 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, SeaweedFS volume/filer # flush), then start again. The S3 bytes live on the named volume s3data. docker compose restart postgres valkey s3 # 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, valkey and s3 restarted with volumes preserved"