Stream Tower deploy script through bash
This commit is contained in:
+12
-18
@@ -15,24 +15,23 @@ $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__'
|
||||
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__.'
|
||||
if [ "$DEPLOY_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__'
|
||||
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__'
|
||||
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
|
||||
@@ -55,15 +54,10 @@ if [ -x scripts/live_migration_smoke.sh ]; then
|
||||
fi
|
||||
|
||||
if [ -x scripts/verify_browser_runtime.sh ]; then
|
||||
bash scripts/verify_browser_runtime.sh '__FRONTEND_URL__'
|
||||
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)
|
||||
$remoteCommand = "REMOTE_PATH='$RemotePath' REMOTE_BRANCH='$RemoteBranch' REMOTE_REPO='$RemoteRepo' FRONTEND_URL='$FrontendUrl' DEPLOY_BOOTSTRAP='$bootstrapValue' DEPLOY_GEOINTEL_INSTALL_AI='$InstallAi' bash -s"
|
||||
|
||||
ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -i $SshKey $RemoteHost $remoteScript
|
||||
$remoteScript | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -i $SshKey $RemoteHost $remoteCommand
|
||||
|
||||
Reference in New Issue
Block a user