Files
proxmox/scripts/check-udm-pro-config-before-e2e.sh.bak
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

161 lines
5.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Check all UDM Prorelated configuration before running E2E validation.
# Verifies: port forwarding (public→NPMplus), DNS, NPMplus reachability.
# Usage: ./scripts/check-udm-pro-config-before-e2e.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
# Load .env for PUBLIC_IP, NPM_HOST
if [ -f .env ]; then
set +u
# shellcheck source=/dev/null
source .env 2>/dev/null || true
set -u
fi
PUBLIC_IP="${PUBLIC_IP:-76.53.10.36}"
NPM_HOST="${NPM_HOST:-192.168.11.167}"
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.11}"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_ok() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_fail() { echo -e "${RED}[✗]${NC} $1"; }
log_section() { echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n${CYAN}$1${NC}\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"; }
FAIL=0
echo ""
log_section "UDM Pro configuration check (before E2E)"
echo "Public IP (WAN): $PUBLIC_IP"
echo "NPMplus (LAN): $NPM_HOST"
echo "Proxmox host: $PROXMOX_HOST (VMID 10233)"
echo ""
# ─── 1. UDM Pro port forwarding (manual checklist) ───
log_section "1. UDM Pro port forwarding (verify in UniFi UI)"
echo "In UniFi Network → Settings → Firewall & Security → Port Forwarding, ensure:"
echo ""
echo " Rule 1: NPMplus HTTP"
echo " • Public IP: $PUBLIC_IP (or WAN interface)"
echo " • Public Port: 80"
echo " • Forward to: $NPM_HOST"
echo " • Private Port: 80"
echo " • Protocol: TCP"
echo " • Enabled: Yes"
echo ""
echo " Rule 2: NPMplus HTTPS"
echo " • Public IP: $PUBLIC_IP (or WAN interface)"
echo " • Public Port: 443"
echo " • Forward to: $NPM_HOST"
echo " • Private Port: 443"
echo " • Protocol: TCP"
echo " • Enabled: Yes"
echo ""
log_info "If either rule is missing or points to 192.168.11.166, update to $NPM_HOST (only .167 is used)."
echo ""
# ─── 2. DNS resolution (RPC hostnames → PUBLIC_IP) ───
log_section "2. DNS resolution (RPC hostnames → $PUBLIC_IP)"
RPC_HOSTS=(
"rpc-http-pub.d-bis.org"
"rpc.d-bis.org"
"rpc.public-0138.defi-oracle.io"
"rpc.defi-oracle.io"
"explorer.d-bis.org"
)
for h in "${RPC_HOSTS[@]}"; do
res=$(getent ahosts "$h" 2>/dev/null | awk '/STREAM/ {print $1; exit}' || true)
if [ -n "$res" ]; then
if [ "$res" = "$PUBLIC_IP" ]; then
log_ok "$h$res"
else
log_warn "$h$res (expected $PUBLIC_IP)"
fi
else
# try dig/host if getent not available
res=$(dig +short A "$h" 2>/dev/null | head -1 || true)
if [ -n "$res" ]; then
if [ "$res" = "$PUBLIC_IP" ]; then
log_ok "$h$res"
else
log_warn "$h$res (expected $PUBLIC_IP)"
fi
else
log_fail "$h → could not resolve"
((FAIL++)) || true
fi
fi
done
echo ""
# ─── 3. Public IP reachability (80, 443) ───
log_section "3. Public IP reachability ($PUBLIC_IP:80, $PUBLIC_IP:443)"
for port in 80 443; do
if timeout 5 bash -c "echo >/dev/tcp/$PUBLIC_IP/$port" 2>/dev/null; then
log_ok "$PUBLIC_IP:$port reachable"
else
if curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 "http://$PUBLIC_IP:$port/" 2>/dev/null | grep -q '[0-9]'; then
log_ok "$PUBLIC_IP:$port responds (HTTP)"
else
log_warn "$PUBLIC_IP:$port not reachable from this host (run E2E from LAN or internet)"
fi
fi
done
echo ""
# ─── 4. NPMplus direct (if on LAN) ───
log_section "4. NPMplus direct ($NPM_HOST:80, 443, 81)"
for port in 80 81 443; do
proto="http"
[ "$port" = "443" ] && proto="https"
code=$(curl -sk -o /dev/null -w "%{http_code}" --connect-timeout 3 "${proto}://${NPM_HOST}:${port}/" 2>/dev/null || echo "000")
if [ "$code" != "000" ] && [ -n "$code" ]; then
log_ok "$NPM_HOST:$port → HTTP $code"
else
log_warn "$NPM_HOST:$port not reachable from this host (normal if not on 192.168.11.x)"
fi
done
echo ""
# ─── 5. Proxmox / NPMplus container (optional SSH) ───
log_section "5. NPMplus container status (optional)"
if command -v ssh >/dev/null 2>&1; then
status=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" "pct status 10233 2>/dev/null" | awk '/status:/ {print $2}' || echo "unknown")
if [ "$status" = "running" ]; then
log_ok "VMID 10233 (NPMplus) is running on $PROXMOX_HOST"
else
log_warn "VMID 10233 status: $status (or SSH failed)"
fi
else
log_info "SSH not available; skip Proxmox check."
fi
echo ""
# ─── Summary ───
log_section "Summary"
echo "• Port forwarding: verify in UniFi UI (76.53.10.36:80/443 → $NPM_HOST:80/443)."
echo "• DNS: RPC hostnames should resolve to $PUBLIC_IP."
echo "• Reachability: run E2E from a host that can reach $PUBLIC_IP (LAN or internet)."
echo "• Docs: docs/04-configuration/UDM_PRO_CONFIGURATION_CHECKLIST.md, docs/04-configuration/DNS_NPMPLUS_VM_STREAMLINED_TABLE.md"
echo ""
if [ "$FAIL" -gt 0 ]; then
log_fail "Some checks failed. Fix DNS or port forwarding before running E2E."
exit 1
fi
log_ok "UDM Pro config check complete. Run E2E when ready: ./scripts/run-full-e2e-validation.sh"
exit 0