#!/bin/sh set -eu # Restart every process that owns state, without removing volumes or re-seeding. cd "$(dirname "$0")/.." if [ ! -f .env ]; then echo "missing .env; copy .env.example and fill local values" >&2 exit 2 fi docker compose --env-file .env restart postgres seaweedfs haproxy api1 api2 # shellcheck disable=SC1091 . ./.env port="${LAB4_PORT:-8080}" # /health/ready covers PostgreSQL and S3, so a 200 means the whole synchronous # path is usable again. Wait for it before reporting success to the caller. i=0 while [ "$i" -lt 90 ]; do if curl -fsS "http://127.0.0.1:${port}/health/ready" >/dev/null 2>&1; then exit 0 fi i=$((i + 1)) sleep 1 done echo "stack did not become ready within 90 seconds" >&2 exit 1