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 { "false" }), [switch]$Bootstrap ) $ErrorActionPreference = "Stop" $bootstrapValue = if ($Bootstrap) { "1" } else { "0" } $remoteScript = @" set -euo pipefail git config --global --add safe.directory '$RemotePath' cd '$RemotePath' if [ ! -d .git ]; then if [ '$bootstrapValue' != '1' ]; then echo 'No git checkout found in $RemotePath.' echo 'Re-run with -Bootstrap for the first deployment bootstrap.' exit 2 fi git init git remote add origin '$RemoteRepo' fi git remote get-url origin >/dev/null 2>&1 || git remote add origin '$RemoteRepo' git fetch origin '$RemoteBranch' git reset --hard 'origin/$RemoteBranch' git branch -M '$RemoteBranch' chmod +x scripts/*.sh backend/docker_start.sh deploy/unraid/*.sh || true docker compose -f docker-compose.unraid.yml config >/dev/null docker build --build-arg GEOINTEL_INSTALL_AI='$InstallAi' -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 '$FrontendUrl' fi "@ ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -i $SshKey $RemoteHost $remoteScript