#!/bin/sh # Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`. # Restarts EVERY process of the stand: LB, all API replicas, relay, worker(s), PostgreSQL, Valkey, # S3 (SeaweedFS) and the broker (RabbitMQ). Volumes, schema, data and queued messages are # preserved: no `down -v`, no FLUSH, no purge, 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, API and the pipeline processes first: nothing is served or processed while the # stores restart underneath. docker compose stop lb api relay worker # 2. Stores: clean shutdown (PostgreSQL checkpoint, Valkey AOF fsync, SeaweedFS volume/filer # flush, RabbitMQ quorum log), then start again. Bytes live on s3data, messages on rabbitmqdata. docker compose restart postgres valkey s3 broker # 3. API replicas (wait for healthy stores via depends_on), the LB, then relay and worker. HAProxy # resolves the new replica addresses through Docker DNS by itself - no stale backend list. docker compose start api docker compose start lb docker compose start relay worker echo "restart.sh: lb, api (all replicas), relay, worker, postgres, valkey, s3 and broker restarted with volumes preserved"