Files
ScadaBridge/docker-env2/deploy.sh
T
Joseph Doherty e8a743de9f chore(docker): env2 runs its own image tag, leader-auto-down overlay, drill targets env2 (#116)
- docker/build.sh: SCADABRIDGE_IMAGE picks the tag (default scadabridge:latest).
- docker-env2/docker-compose.yml: node image is ${SCADABRIDGE_IMAGE:-scadabridge:latest},
  so env2 can run its own build without retagging the primary rig's image.
- docker-env2/docker-compose.leader-auto-down.yml: opt-in overlay for both env2 pairs,
  mirroring docker/docker-compose.leader-auto-down.yml. Shipped default stays auto-down.
- docker/failover-drill.sh: DRILL_ENV=primary|env2 (container prefix, Traefik :9100,
  pair site-x).

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 23:28:34 -05:00

45 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Same guard as docker/deploy.sh: relative bind mounts mean a worktree deploy silently
# rehomes every node's data directory to the worktree's copy, splitting rig state.
if [[ "$SCRIPT_DIR" == *"/.claude/worktrees/"* && "${SCADABRIDGE_ALLOW_WORKTREE_DEPLOY:-}" != "1" ]]; then
echo "ERROR: refusing to deploy from a git worktree ($SCRIPT_DIR)." >&2
echo "Deploy from the main checkout, or set SCADABRIDGE_ALLOW_WORKTREE_DEPLOY=1 to override." >&2
exit 1
fi
echo "=== ScadaBridge Env2 Docker Deploy ==="
# Reuse the primary build (same scadabridge:latest image, same network creation).
# SCADABRIDGE_IMAGE=<repo:tag> builds and runs env2 on its own tag instead (build.sh and
# the compose file both read it), leaving scadabridge:latest untouched.
"$SCRIPT_DIR/../docker/build.sh"
# Ensure env2 databases exist on the shared scadabridge-mssql
"$SCRIPT_DIR/init-db.sh"
echo ""
echo "Deploying env2 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:9100"
echo " Central UI (node A): http://localhost:9101"
echo " Central UI (node B): http://localhost:9102"
echo " Health check: http://localhost:9101/health/ready"
echo " Active node check: http://localhost:9101/health/active"
echo " Traefik dashboard: http://localhost:8181"
echo ""
echo "To seed test site (first-time setup):"
echo " docker-env2/seed-sites.sh"
echo ""
echo "Logs: docker compose -f $SCRIPT_DIR/docker-compose.yml logs -f"