Files
ScadaBridge/docker/deploy.sh
T

44 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# The compose file's bind mounts are RELATIVE (./site-a-node-a/data etc.), so running
# this script from a git worktree silently rehomes every node's data directory to the
# worktree's copy — the rig keeps running, but its SQLite stores split from the main
# checkout's and all state written there is lost on the next deploy from main.
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-mount data dirs would rehome to the worktree copy and split rig state." >&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"