#!/bin/sh set -eu project_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) cd "$project_root" # Keys and environment must already exist; never rotate keys during restart. compose() { if [ -n "${COMPOSE_OVERRIDE_FILE:-}" ]; then docker compose --env-file "${COMPOSE_ENV_FILE:-.env}" -f docker-compose.yml -f "$COMPOSE_OVERRIDE_FILE" "$@" else docker compose --env-file "${COMPOSE_ENV_FILE:-.env}" -f docker-compose.yml "$@" fi } # Validate and build before stopping the API. Recreate containers to apply # current Compose settings, preserve named volumes, and wait for healthchecks. compose config --quiet compose build api compose stop api compose up -d --force-recreate --wait --wait-timeout 120 postgres redis compose up -d --no-build --pull never --force-recreate --wait --wait-timeout 60 api