#!/bin/sh # AGENT: Restart hook for tests/resilience.py. It intentionally uses `restart`, # never `down -v`, `flushall` or a re-seed: PostgreSQL data and the Redis AOF # stay on their named volumes. Exit 0 means "the restart was requested", the # test then waits for /health/ready and reuses the existing bearer token. set -eu cd "$(dirname "$0")/.." COMPOSE_FILE_PATH="${COMPOSE_FILE:-compose.yaml}" if [ ! -f .env ]; then echo "restart.sh: .env is missing; copy .env.example to .env first" >&2 exit 2 fi compose() { docker compose --env-file .env -f "$COMPOSE_FILE_PATH" "$@" } # State stores first, then the API, so the app reconnects to a live database. # The API itself retries PostgreSQL for up to 30 seconds during startup. compose restart postgres redis compose restart api