param( [string]$RemoteHost = "root@192.168.10.150", [string]$RemotePath = "/mnt/user/appdata/geointel", [string]$RemoteBranch = "main", [string]$RemoteRepo = "gitea-widefrog:NuklearRabbit/geointel.git", [string]$SshKey = "$HOME/.ssh/widefrog_unraid_deploy", [string]$FrontendUrl = "http://192.168.10.150:1202", [string]$InstallAi = $(if ($env:GEOINTEL_INSTALL_AI) { $env:GEOINTEL_INSTALL_AI } else { "" }), [switch]$Bootstrap ) $ErrorActionPreference = "Stop" $bootstrapValue = if ($Bootstrap) { "1" } else { "0" } $remoteScript = @' set -euo pipefail DEPLOY_GEOINTEL_INSTALL_AI='__INSTALL_AI__' git config --global --add safe.directory '__REMOTE_PATH__' cd '__REMOTE_PATH__' if [ ! -d .git ]; then if [ '__BOOTSTRAP__' != '1' ]; then echo 'No git checkout found in __REMOTE_PATH__.' echo 'Re-run with -Bootstrap for the first deployment bootstrap.' exit 2 fi git init git remote add origin '__REMOTE_REPO__' fi git remote get-url origin >/dev/null 2>&1 || git remote add origin '__REMOTE_REPO__' git fetch origin '__REMOTE_BRANCH__' git reset --hard 'origin/__REMOTE_BRANCH__' git branch -M '__REMOTE_BRANCH__' chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true if [ -f .env ]; then set -a . ./.env set +a fi if [ -n "${DEPLOY_GEOINTEL_INSTALL_AI:-}" ]; then GEOINTEL_INSTALL_AI="$DEPLOY_GEOINTEL_INSTALL_AI" fi GEOINTEL_INSTALL_AI="${GEOINTEL_INSTALL_AI:-false}" docker compose -f docker-compose.unraid.yml config >/dev/null docker build --build-arg GEOINTEL_INSTALL_AI="$GEOINTEL_INSTALL_AI" -f deploy/unraid/Dockerfile.all-in-one -t geointel-all-in-one:latest . bash deploy/unraid/run-dockerman-container.sh if [ -x scripts/live_migration_smoke.sh ]; then LIVE_SMOKE_CONTAINER=geointel bash scripts/live_migration_smoke.sh fi if [ -x scripts/verify_browser_runtime.sh ]; then bash scripts/verify_browser_runtime.sh '__FRONTEND_URL__' fi '@ $remoteScript = $remoteScript.Replace("__INSTALL_AI__", $InstallAi) $remoteScript = $remoteScript.Replace("__REMOTE_PATH__", $RemotePath) $remoteScript = $remoteScript.Replace("__BOOTSTRAP__", $bootstrapValue) $remoteScript = $remoteScript.Replace("__REMOTE_REPO__", $RemoteRepo) $remoteScript = $remoteScript.Replace("__REMOTE_BRANCH__", $RemoteBranch) $remoteScript = $remoteScript.Replace("__FRONTEND_URL__", $FrontendUrl) ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -i $SshKey $RemoteHost $remoteScript