#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")/.." # Parse flags BUILD="" SERVICE="" for arg in "$@"; do case "$arg" in --build) BUILD="--build" ;; *) SERVICE="$arg" ;; esac done if [ -n "$SERVICE" ]; then echo "Restarting $SERVICE${BUILD:+ (with rebuild)}..." docker compose up -d $BUILD "$SERVICE" else echo "Restarting all services${BUILD:+ (with rebuild)}..." docker compose down docker compose up -d $BUILD fi echo "" echo "Waiting for health checks..." sleep 3 BACKEND=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8888/docs 2>/dev/null || echo "000") FRONTEND=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5173 2>/dev/null || echo "000") echo "" docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}" echo "" if [ "$BACKEND" = "200" ] && [ "$FRONTEND" = "200" ]; then echo "All services up." else echo "WARNING: Some services may not be ready yet." [ "$BACKEND" != "200" ] && echo " Backend returned $BACKEND" [ "$FRONTEND" != "200" ] && echo " Frontend returned $FRONTEND" fi