Files
proxmox/scripts/run-completable-tasks-from-anywhere.sh
defiQUG 47e3c00928 fix(ops): completable token-aggregation LAN fallback; NPM Phoenix hub env; explorer 502 note
- run-completable: if public explorer HTTPS check fails, retry check-public-report-api against IP_BLOCKSCOUT HTTP (edge WAN vs LAN drift)
- TOKEN_AGGREGATION_REPORT_API_RUNBOOK: troubleshooting when /token-aggregation/ 502s publicly but LAN is 200
- .env.master.example: default SANKOFA_NPM_PHOENIX_PORT=8080 so NPM fleet updates match hub cutover

Made-with: Cursor
2026-04-13 22:04:23 -07:00

128 lines
5.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run all tasks that do NOT require LAN, Proxmox SSH, PRIVATE_KEY, or NPM_PASSWORD.
# Use from dev machine / WSL / CI. For tasks that need LAN/creds, see run-all-operator-tasks-from-lan.sh (or run-operator-tasks-from-lan.sh).
# Usage: ./scripts/run-completable-tasks-from-anywhere.sh [--dry-run]
# --dry-run Print the steps only; do not run them (exit 0).
#
# Exit codes (Unix convention): 0 = success (all steps passed), non-zero = failure.
# Do not "fix" exit 0 — it means the script completed successfully.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
DRY_RUN=false
for a in "$@"; do [[ "$a" == "--dry-run" ]] && DRY_RUN=true && break; done
if $DRY_RUN; then
echo "=== Completable from anywhere (--dry-run: commands only) ==="
echo ""
echo "10 steps (see script body). Summary:"
echo "1. Config validation: bash scripts/validation/validate-config-files.sh [--dry-run] (includes GRU reference-primacy + peg-bands hook when cross-chain-pmm-lps is present)"
echo " (optional: python3 -m pip install check-jsonschema — step 1 then validates config/dbis-institutional JSON Schemas too)"
echo "2. On-chain check (138): SKIP_EXIT=1 bash scripts/verify/check-contracts-on-chain-138.sh || true"
echo "3. All validation: bash scripts/verify/run-all-validation.sh --skip-genesis"
echo "4. Public report API: bash scripts/verify/check-public-report-api.sh (then LAN explorer IP if public URL fails)"
echo "5. Public PMM dry-run readiness: bash scripts/verify/check-public-pmm-dry-run-readiness.sh"
echo "6. Reconcile .env: bash scripts/verify/reconcile-env-canonical.sh --print"
echo " Gas scaffold: bash scripts/verify/print-gas-runtime-env-canonical.sh"
echo "7. XDC Zero JSON + relayer env: bash scripts/validation/validate-xdc-zero-config.sh && bash scripts/validation/validate-xdc-zero-relayer-env.sh"
echo "8. XDC Zero RPC preflight: bash scripts/verify/xdc-zero-chain138-preflight.sh (failure prints WARN only)"
echo "9. Remaining live/operator blockers (informational): SKIP_EXIT=1 bash scripts/verify/check-full-deployment-status.sh --json"
echo "10. Public info hub (HTTPS, non-fatal): pnpm run verify:info-defi-oracle-public"
echo ""
echo "Run without --dry-run to execute. Exit 0 = success."
exit 0
fi
echo "=== Completable from anywhere (no LAN/creds) ==="
echo ""
# 1. Config validation
echo "[Step 1/10] Config validation..."
bash scripts/validation/validate-config-files.sh
echo ""
# 2. On-chain contract check (Chain 138) — may warn if RPC unreachable
echo "[Step 2/10] On-chain contract check (Chain 138)..."
SKIP_EXIT=1 bash scripts/verify/check-contracts-on-chain-138.sh || true
echo ""
# 3. Full validation (skip genesis to avoid RPC)
echo "[Step 3/10] Run all validation (--skip-genesis)..."
bash scripts/verify/run-all-validation.sh --skip-genesis
echo ""
# 4. Public report API (token-aggregation); LAN fallback when public HTTPS/WAN path is broken (e.g. CF → .36 vs working .40/.42).
echo "[Step 4/10] Public report API / token-aggregation health..."
if ! bash scripts/verify/check-public-report-api.sh; then
# shellcheck source=/dev/null
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
LAN_EXPLORER="http://${IP_BLOCKSCOUT:-192.168.11.140}"
echo "[WARN] Public URL check failed; retrying token-aggregation via explorer LAN ingress (${LAN_EXPLORER})..."
bash scripts/verify/check-public-report-api.sh "$LAN_EXPLORER"
fi
echo ""
# 5. Emit canonical .env lines for reconciliation
echo "[Step 5/10] Public PMM dry-run readiness..."
bash scripts/verify/check-public-pmm-dry-run-readiness.sh
echo ""
echo "[Step 6/10] Canonical .env (reconcile smom-dbis-138/.env)..."
bash scripts/verify/reconcile-env-canonical.sh --print
echo ""
echo "Gas runtime env scaffold:"
bash scripts/verify/print-gas-runtime-env-canonical.sh
echo ""
echo "[Step 7/10] XDC Zero config + relayer env examples..."
bash scripts/validation/validate-xdc-zero-config.sh
bash scripts/validation/validate-xdc-zero-relayer-env.sh
echo ""
echo "[Step 8/10] XDC Zero RPC preflight (warn if unreachable)..."
if bash scripts/verify/xdc-zero-chain138-preflight.sh; then
:
else
echo "[WARN] XDC preflight failed — check XDC_PARENTNET_URL / LAN RPC in .env when you need XDC Zero."
fi
echo ""
echo "[Step 9/10] Remaining live/operator blockers (informational)..."
if SKIP_EXIT=1 bash scripts/verify/check-full-deployment-status.sh --json >/tmp/run-anywhere-full-deployment.json 2>/dev/null; then
jq '
{
fullDeploymentComplete,
failures,
blockers,
orphanRegistryWarning: .gruV2.orphanWarning,
deployerFundingBlockers: (.deployerFunding.blockers // []),
deployerFundingWarnings: (.deployerFunding.warnings // []),
wemixMeshGap: (
[.cwEvmMesh.chains[]? | select(.chainKey == "WEMIX" and .missingCount > 0) |
{chainKey, missingCount, missingSymbols}
] | first
)
}
' /tmp/run-anywhere-full-deployment.json
else
echo "[WARN] Could not summarize full deployment blockers."
fi
echo ""
echo "[Step 10/10] Public info.defi-oracle.io (HTTPS)..."
if command -v pnpm >/dev/null 2>&1 && grep -q '"verify:info-defi-oracle-public"' package.json 2>/dev/null; then
if ! pnpm run verify:info-defi-oracle-public; then
echo "[WARN] verify:info-defi-oracle-public failed (site, network, or TLS). Completable continues; re-run: pnpm run verify:info-defi-oracle-public"
fi
else
echo "[WARN] pnpm missing or verify:info-defi-oracle-public not in package.json — skip"
fi
echo ""
echo "=== Done. Tasks requiring LAN, funding, on-chain deploys, or registry upgrades: run ./scripts/run-all-operator-tasks-from-lan.sh from a host on LAN (NPM_PASSWORD for backup; optional --skip-backup). ==="
exit 0