27 lines
1.7 KiB
Bash
27 lines
1.7 KiB
Bash
#!/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), relay, worker and the LB in ONE
|
|
# command: compose starts them in dependency order (lb after api is healthy) and waits for the
|
|
# health conditions once, relay/worker in parallel with api (three separate `start` calls cost
|
|
# 3 x ~23 s on Windows and exceeded the test's 90 s budget). HAProxy re-resolves the replicas.
|
|
docker compose start api relay worker lb
|
|
echo "restart.sh: lb, api (all replicas), relay, worker, postgres, valkey, s3, broker and openbao restarted with volumes preserved; openbao unsealed"
|