Add MEV external rollout tracker and deploy helper
All checks were successful
Deploy to Phoenix / deploy (push) Successful in 16s
All checks were successful
Deploy to Phoenix / deploy (push) Successful in 16s
This commit is contained in:
152
scripts/deployment/deploy-mev-backend-ct2421-latest.sh
Executable file
152
scripts/deployment/deploy-mev-backend-ct2421-latest.sh
Executable file
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PVE_HOST="${MEV_BACKEND_PVE_HOST:-192.168.11.14}"
|
||||
CT_VMID="${MEV_BACKEND_CT_VMID:-2421}"
|
||||
CT_ROOT="${MEV_BACKEND_CT_ROOT:-/opt/proxmox/MEV_Bot}"
|
||||
MEV_DIR="${MEV_BACKEND_MEV_DIR:-$CT_ROOT/mev-platform}"
|
||||
MEV_BRANCH="${MEV_BACKEND_BRANCH:-master}"
|
||||
PARENT_BRANCH="${MEV_BACKEND_PARENT_BRANCH:-master}"
|
||||
API_KEY="${MEV_API_KEY:-}"
|
||||
APPLY=0
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: deploy-mev-backend-ct2421-latest.sh [options]
|
||||
|
||||
Fast-forward the MEV backend checkout inside CT 2421, rebuild the backend
|
||||
services in-place, restart the control plane, and run local verification.
|
||||
|
||||
Defaults to dry-run. Re-run with --apply to execute.
|
||||
|
||||
Options:
|
||||
--pve-host HOST Proxmox host running the MEV backend CT (default: 192.168.11.14)
|
||||
--ct-vmid VMID MEV backend CT VMID (default: 2421)
|
||||
--ct-root PATH Parent repo path inside the CT (default: /opt/proxmox/MEV_Bot)
|
||||
--mev-dir PATH MEV submodule path inside the CT (default: /opt/proxmox/MEV_Bot/mev-platform)
|
||||
--branch NAME mev-platform branch to fast-forward (default: master)
|
||||
--parent-branch NAME MEV_Bot branch to fast-forward (default: master)
|
||||
--api-key KEY Optional API key for protected verification routes
|
||||
--apply Execute the deployment
|
||||
-h, --help Show this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--pve-host)
|
||||
PVE_HOST="$2"
|
||||
shift 2
|
||||
;;
|
||||
--ct-vmid)
|
||||
CT_VMID="$2"
|
||||
shift 2
|
||||
;;
|
||||
--ct-root)
|
||||
CT_ROOT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--mev-dir)
|
||||
MEV_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--branch)
|
||||
MEV_BRANCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--parent-branch)
|
||||
PARENT_BRANCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--api-key)
|
||||
API_KEY="$2"
|
||||
shift 2
|
||||
;;
|
||||
--apply)
|
||||
APPLY=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
usage >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
require_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1 || {
|
||||
echo "Required command missing: $1" >&2
|
||||
exit 2
|
||||
}
|
||||
}
|
||||
|
||||
require_cmd ssh
|
||||
require_cmd bash
|
||||
|
||||
REMOTE_CMD=$(cat <<EOF
|
||||
set -euo pipefail
|
||||
cd "$CT_ROOT"
|
||||
echo "== parent repo =="
|
||||
git fetch origin
|
||||
git checkout "$PARENT_BRANCH"
|
||||
git pull --ff-only origin "$PARENT_BRANCH"
|
||||
echo "== submodule pointer =="
|
||||
git submodule update --init --recursive mev-platform
|
||||
|
||||
cd "$MEV_DIR"
|
||||
echo "== mev-platform repo =="
|
||||
git fetch origin
|
||||
git checkout "$MEV_BRANCH"
|
||||
git pull --ff-only origin "$MEV_BRANCH"
|
||||
|
||||
echo "== build release binaries =="
|
||||
cargo build --release -p mev-admin-api -p mev-supervisor \\
|
||||
-p mev-pool-indexer -p mev-state-ingestion -p mev-liquidity-graph \\
|
||||
-p mev-opportunity-search -p mev-simulation -p mev-bundle-builder \\
|
||||
-p mev-execution-gateway -p mev-settlement-analytics
|
||||
|
||||
echo "== restart services =="
|
||||
systemctl restart mev-supervisor.service
|
||||
systemctl restart mev-admin-api.service
|
||||
systemctl restart mev-start-all.service || systemctl start mev-start-all.service || true
|
||||
|
||||
echo "== local health =="
|
||||
curl -fsS http://127.0.0.1:9090/api/health
|
||||
echo
|
||||
curl -fsS http://127.0.0.1:9090/api/infra
|
||||
echo
|
||||
curl -fsS http://127.0.0.1:9090/api/stats/freshness
|
||||
echo
|
||||
if [ -n "${API_KEY}" ]; then
|
||||
curl -fsS -H "X-API-Key: ${API_KEY}" http://127.0.0.1:9090/api/stats/ops
|
||||
echo
|
||||
curl -fsS -H "X-API-Key: ${API_KEY}" http://127.0.0.1:9090/api/stats/metrics-surfaces
|
||||
echo
|
||||
fi
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "MEV backend deploy helper"
|
||||
echo "PVE host: $PVE_HOST"
|
||||
echo "CT VMID: $CT_VMID"
|
||||
echo "CT root: $CT_ROOT"
|
||||
echo "MEV dir: $MEV_DIR"
|
||||
echo "Parent branch: $PARENT_BRANCH"
|
||||
echo "MEV branch: $MEV_BRANCH"
|
||||
echo "Apply: $APPLY"
|
||||
echo
|
||||
echo "Planned remote command:"
|
||||
echo "ssh root@$PVE_HOST \"pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")\""
|
||||
|
||||
if [[ "$APPLY" -ne 1 ]]; then
|
||||
echo
|
||||
echo "Dry-run only. Re-run with --apply to execute."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ssh "root@$PVE_HOST" "pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")"
|
||||
Reference in New Issue
Block a user