forked from mtusi2026/mtusi2026lab2
feat(app) lab2 prepared for mr
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user