51 lines
1.4 KiB
PowerShell
51 lines
1.4 KiB
PowerShell
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
|