feat: add cloud control-plane deployment entrypoints

This commit is contained in:
Codex
2026-03-23 13:24:08 +08:00
parent 47c29c723a
commit 3ff757e22d
6 changed files with 277 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -euo pipefail
branch="${1:-main}"
remote_dir="${BOSS_REMOTE_DIR:-/home/ubuntu/boss}"
remote_repo="${BOSS_REMOTE_REPO:-https://git.hyzq.site/krisolo/boss.git}"
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export AG_SERVER_SKILL="${AG_SERVER_SKILL:-$CODEX_HOME/skills/ai-glasses-server-debug}"
export AG_SERVER="${AG_SERVER:-$AG_SERVER_SKILL/scripts/server_ssh.sh}"
if [[ ! -x "$AG_SERVER" ]]; then
echo "AI Glasses server wrapper not found: $AG_SERVER" >&2
exit 1
fi
remote_script=$(cat <<EOF
set -euo pipefail
REMOTE_DIR=$(printf '%q' "$remote_dir")
REMOTE_REPO=$(printf '%q' "$remote_repo")
BRANCH=$(printf '%q' "$branch")
mkdir -p "\$REMOTE_DIR"
if [[ ! -d "\$REMOTE_DIR/.git" ]]; then
rm -rf "\$REMOTE_DIR"
git clone "\$REMOTE_REPO" "\$REMOTE_DIR"
fi
cd "\$REMOTE_DIR"
git fetch origin "\$BRANCH"
git checkout "\$BRANCH"
git reset --hard "origin/\$BRANCH"
sudo docker compose -f compose.cloud.yaml -p boss up -d --build --remove-orphans
echo "__BOSS_DEPLOY_OK__"
sudo docker compose -f compose.cloud.yaml -p boss ps
sleep 3
curl -fsS http://127.0.0.1:43210/api/health
EOF
)
payload="$(printf '%s' "$remote_script" | base64 | tr -d '\n')"
"$AG_SERVER" exec "set -euo pipefail; printf '%s' '$payload' | base64 -d | bash"