#!/bin/bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # The compose file's remaining bind mounts (appsettings, logs) are RELATIVE, so running # this script from a git worktree silently rehomes every node's config to the worktree's # copy — the rig keeps running, but on stale/divergent appsettings. (The data dirs moved # to named volumes — register row 79 — so rig state itself no longer splits, but a # worktree deploy is still wrong by default.) if [[ "$SCRIPT_DIR" == *"/.claude/worktrees/"* && "${SCADABRIDGE_ALLOW_WORKTREE_DEPLOY:-}" != "1" ]]; then echo "ERROR: refusing to deploy from a git worktree ($SCRIPT_DIR)." >&2 echo "Bind-mounted appsettings would rehome to the worktree copy." >&2 echo "Deploy from the main checkout, or set SCADABRIDGE_ALLOW_WORKTREE_DEPLOY=1 to override." >&2 exit 1 fi echo "=== ScadaBridge Docker Deploy ===" # Build image (creates network if needed) "$SCRIPT_DIR/build.sh" echo "" echo "Deploying containers..." docker compose -f "$SCRIPT_DIR/docker-compose.yml" up -d --force-recreate echo "" echo "Container status:" docker compose -f "$SCRIPT_DIR/docker-compose.yml" ps echo "" echo "Access points:" echo " Central (Traefik LB): http://localhost:9000" echo " Central UI (node A): http://localhost:9001" echo " Central UI (node B): http://localhost:9002" echo " Health check: http://localhost:9001/health/ready" echo " Active node check: http://localhost:9001/health/active" echo " Traefik dashboard: http://localhost:8180" echo " Management API: http://localhost:9000/management" echo "" echo "To seed test sites (first-time setup):" echo " docker/seed-sites.sh" echo "" echo "Logs: docker compose -f $SCRIPT_DIR/docker-compose.yml logs -f"