#!/bin/sh set -eu cd "$(dirname "$0")/.." wait_healthy() { i=0 while [ "$i" -lt 40 ]; do ok=1 for svc in "$@"; do health=$(docker compose --env-file .env ps --format '{{.Service}} {{.Health}}' "$svc" | awk 'NR==1 {print $2}') if [ "$health" != "healthy" ]; then ok=0 fi done if [ "$ok" -eq 1 ]; then return 0 fi i=$((i + 1)) sleep 1 done echo "timed out waiting for healthy: $*" >&2 return 1 } docker compose --env-file .env restart -t 5 postgres s3 rabbitmq wait_healthy postgres s3 rabbitmq docker compose --env-file .env restart -t 5 api-1 api-2 worker wait_healthy api-1 api-2 worker docker compose --env-file .env restart -t 2 nginx