#!/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), the broker (RabbitMQ) and OpenBao. Volumes, schema, data, queued messages and the # OpenBao storage are preserved: no `down -v`, no FLUSH, no purge, no re-seed. # Lab 7: OpenBao comes back SEALED; the operator unseal step (scripts/bao_operator.py unseal, shares # from the operator directory outside the repository) runs before the services that need secrets. # Output is suppressed by the test; run it by hand to see the steps (no secret is printed). set -eu cd "$(dirname "$0")/.." PY="${PYTHON:-python}" # 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, OpenBao raft), then start again. docker compose restart postgres valkey s3 broker openbao # 3. Operator: unseal (OpenBao is sealed after every start). "$PY" scripts/bao_operator.py unseal # 4. API replicas (log in to OpenBao again, read their secrets), the LB, then relay and worker. # HAProxy resolves the new replica addresses through Docker DNS by itself. 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, broker and openbao restarted with volumes preserved; openbao unsealed"