#!/bin/sh set -eu cd "$(dirname "$0")/.." wait_healthy() { for svc in "$@"; do for _ in $(seq 1 60); do status=$(docker compose ps --format '{{.Health}}' "$svc" 2>/dev/null || true) [ "$status" = "healthy" ] && break sleep 1 done done } # Sequenced: API/worker eagerly connect to Postgres/Redis/S3 at startup and # exit if unreachable; Nginx resolves upstream hostnames only at its own # startup. Each stage must be actually healthy before the next one starts. docker compose restart postgres redis seaweedfs wait_healthy postgres redis seaweedfs docker compose restart api1 api2 wait_healthy api1 api2 docker compose restart worker docker compose restart lb exit 0