Add explorer-live deploy target and operator handoff
Some checks failed
Deploy to Phoenix / validate (push) Failing after 13s
Deploy to Phoenix / deploy (push) Has been skipped
Deploy to Phoenix / deploy-atomic-swap-dapp (push) Has been skipped
Deploy to Phoenix / cloudflare (push) Has been skipped

This commit is contained in:
Codex
2026-04-23 09:53:49 -07:00
parent 77d40201a3
commit 453ccc8d12
7 changed files with 416 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
# Deploy explorer-monorepo live site from the Gitea-staged Phoenix workspace.
#
# phoenix-deploy-api stages non-Proxmox repos in PHOENIX_DEPLOY_WORKSPACE. The
# explorer deploy scripts expect the repo to live as PHOENIX_REPO_ROOT/explorer-monorepo
# because the API deploy bundles Proxmox reference docs. This wrapper syncs the staged
# tree into that layout, then runs the canonical live deploy scripts.
set -euo pipefail
die() {
echo "ERROR: $*" >&2
exit 1
}
PHOENIX_REPO_ROOT="${PHOENIX_REPO_ROOT:-}"
PHOENIX_DEPLOY_WORKSPACE="${PHOENIX_DEPLOY_WORKSPACE:-}"
EXPLORER_REPO_DIR="${EXPLORER_REPO_DIR:-${PHOENIX_REPO_ROOT}/explorer-monorepo}"
[[ -n "$PHOENIX_REPO_ROOT" ]] || die "PHOENIX_REPO_ROOT is required"
[[ -d "$PHOENIX_REPO_ROOT" ]] || die "PHOENIX_REPO_ROOT does not exist: $PHOENIX_REPO_ROOT"
[[ -n "$PHOENIX_DEPLOY_WORKSPACE" ]] || die "PHOENIX_DEPLOY_WORKSPACE is required"
[[ -d "$PHOENIX_DEPLOY_WORKSPACE" ]] || die "staged workspace missing: $PHOENIX_DEPLOY_WORKSPACE"
[[ "$EXPLORER_REPO_DIR" != "/" ]] || die "refusing to sync into /"
echo "Syncing explorer workspace:"
echo " from: $PHOENIX_DEPLOY_WORKSPACE"
echo " to: $EXPLORER_REPO_DIR"
mkdir -p "$EXPLORER_REPO_DIR"
rsync -a --delete \
--exclude '.git/' \
--exclude 'node_modules/' \
--exclude 'frontend/node_modules/' \
--exclude 'frontend/.next/' \
--exclude 'backend/bin/' \
--exclude 'test-results/' \
"$PHOENIX_DEPLOY_WORKSPACE"/ "$EXPLORER_REPO_DIR"/
cd "$EXPLORER_REPO_DIR"
FRONTEND_SCRIPT="$EXPLORER_REPO_DIR/scripts/deploy-next-frontend-to-vmid5000.sh"
if [[ -f "$FRONTEND_SCRIPT" ]] && ! grep -q 'FORCE_REMOTE_PCT' "$FRONTEND_SCRIPT"; then
python3 - "$FRONTEND_SCRIPT" <<'PY'
import pathlib
import sys
path = pathlib.Path(sys.argv[1])
text = path.read_text()
text = text.replace(
'FRONTEND_PORT="${FRONTEND_PORT:-3000}"\n',
'FRONTEND_PORT="${FRONTEND_PORT:-3000}"\nFORCE_REMOTE_PCT="${FORCE_REMOTE_PCT:-0}"\n',
1,
)
text = text.replace(
'if [[ -f /proc/1/cgroup ]] && grep -q "lxc" /proc/1/cgroup 2>/dev/null; then',
'if [[ "$FORCE_REMOTE_PCT" != "1" ]] && [[ -f /proc/1/cgroup ]] && grep -q "lxc" /proc/1/cgroup 2>/dev/null; then',
)
path.write_text(text)
PY
fi
export PROXMOX_HOST=192.168.11.12
export PROXMOX_HOST_R630_02=192.168.11.12
export EXEC_MODE=pct
export FORCE_REMOTE_PCT=1
if [[ ! -x "$EXPLORER_REPO_DIR/frontend/node_modules/.bin/next" ]]; then
echo "Installing frontend dependencies with npm ci"
(
cd "$EXPLORER_REPO_DIR/frontend"
npm ci
)
fi
echo "Deploying static explorer config assets"
bash scripts/deploy-explorer-config-to-vmid5000.sh
echo "Deploying explorer config/API backend"
bash scripts/deploy-explorer-ai-to-vmid5000.sh
echo "Deploying Next frontend"
bash scripts/deploy-next-frontend-to-vmid5000.sh
echo "Explorer live deployment complete."