Files
geointel/scripts/deploy_tower.sh
T
Codex 6010d876bf
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Install DockerMan template and PNG icon
2026-06-17 05:06:02 +02:00

57 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REMOTE_HOST="${REMOTE_HOST:-root@192.168.10.150}"
REMOTE_PATH="${REMOTE_PATH:-/mnt/user/appdata/geointel}"
REMOTE_BRANCH="${REMOTE_BRANCH:-main}"
REMOTE_REPO="${REMOTE_REPO:-gitea-widefrog:NuklearRabbit/geointel.git}"
SSH_KEY="${SSH_KEY:-$HOME/.ssh/widefrog_unraid_deploy}"
FRONTEND_URL="${FRONTEND_URL:-http://192.168.10.150:1202}"
BOOTSTRAP="${DEPLOY_BOOTSTRAP:-0}"
ssh_opts=(-o BatchMode=yes -o StrictHostKeyChecking=accept-new)
if [[ -f "$SSH_KEY" ]]; then
ssh_opts+=(-i "$SSH_KEY")
fi
ssh "${ssh_opts[@]}" "$REMOTE_HOST" \
"REMOTE_PATH='$REMOTE_PATH' REMOTE_BRANCH='$REMOTE_BRANCH' REMOTE_REPO='$REMOTE_REPO' FRONTEND_URL='$FRONTEND_URL' DEPLOY_BOOTSTRAP='$BOOTSTRAP' bash -s" <<'REMOTE_SCRIPT'
set -euo pipefail
cd "$REMOTE_PATH"
if [[ ! -d .git ]]; then
if [[ "$DEPLOY_BOOTSTRAP" != "1" ]]; then
echo "No git checkout found in $REMOTE_PATH."
echo "Re-run with DEPLOY_BOOTSTRAP=1 for the first deployment bootstrap."
exit 2
fi
git init
git remote add origin "$REMOTE_REPO"
fi
git fetch origin "$REMOTE_BRANCH"
git checkout -B "$REMOTE_BRANCH" "origin/$REMOTE_BRANCH"
chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true
if [[ -d /boot/config/plugins/dockerMan ]]; then
mkdir -p /boot/config/plugins/dockerMan/templates-user /boot/config/plugins/dockerMan/images
cp deploy/unraid/geointel-unraid-template.xml /boot/config/plugins/dockerMan/templates-user/my-geointel.xml
cp deploy/unraid/geointel-icon.png /boot/config/plugins/dockerMan/images/geointel-icon.png
fi
docker compose down --remove-orphans || true
docker compose -f docker-compose.unraid.yml config >/dev/null
docker compose -f docker-compose.unraid.yml build geointel
docker compose -f docker-compose.unraid.yml up -d
docker compose -f docker-compose.unraid.yml ps
if [[ -x scripts/live_migration_smoke.sh ]]; then
COMPOSE_FILE=docker-compose.unraid.yml bash scripts/live_migration_smoke.sh
fi
if [[ -x scripts/verify_browser_runtime.sh ]]; then
bash scripts/verify_browser_runtime.sh "$FRONTEND_URL"
fi
REMOTE_SCRIPT