Add Tower deploy wrapper
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user