From cb070055af869ea67fddefd0ae5fe077891709af Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 16 Jun 2026 23:39:22 +0200 Subject: [PATCH] Add Tower deploy wrapper --- scripts/README.md | 10 ++++++++ scripts/deploy_tower.ps1 | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 scripts/deploy_tower.ps1 diff --git a/scripts/README.md b/scripts/README.md index d5e11e26..d0e83717 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -29,6 +29,12 @@ Push the local branch to Gitea, then rebuild the Unraid/Tower Docker runtime: bash scripts/deploy_tower.sh ``` +From the Codex Windows workspace, use the PowerShell wrapper: + +```powershell +.\scripts\deploy_tower.ps1 +``` + For the first deployment into an existing non-Git appdata folder, bootstrap the checkout explicitly: @@ -36,6 +42,10 @@ checkout explicitly: DEPLOY_BOOTSTRAP=1 bash scripts/deploy_tower.sh ``` +```powershell +.\scripts\deploy_tower.ps1 -Bootstrap +``` + Useful overrides: ```bash diff --git a/scripts/deploy_tower.ps1 b/scripts/deploy_tower.ps1 new file mode 100644 index 00000000..56bb27c4 --- /dev/null +++ b/scripts/deploy_tower.ps1 @@ -0,0 +1,50 @@ +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", + [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 || true + +docker compose config >/dev/null +docker compose build backend frontend +docker compose up -d +docker compose ps + +if [ -x scripts/live_migration_smoke.sh ]; then + 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