Files
proxmox/scripts/verify/verify-npmplus-running-and-network.sh
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

126 lines
4.8 KiB
Bash
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
# Verify NPMplus (VMID 10233) is running, has correct IP(s), and uses correct gateway.
# Expected (from config/ip-addresses.conf and docs): VMID 10233 on r630-01;
# IPs 192.168.11.166 (eth0) and/or 192.168.11.167; gateway 192.168.11.1.
#
# Usage:
# On Proxmox host: bash scripts/verify/verify-npmplus-running-and-network.sh
# From repo (via SSH): ssh root@192.168.11.11 'bash -s' < scripts/verify/verify-npmplus-running-and-network.sh
# Or use run-via-proxmox-ssh to copy and run.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ] && source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
VMID="${NPMPLUS_VMID:-10233}"
EXPECTED_GW="${NETWORK_GATEWAY:-192.168.11.1}"
EXPECTED_IPS=("192.168.11.166" "192.168.11.167") # at least one; .167 is used in UDM Pro
PROXMOX_HOST="${NPMPLUS_HOST:-${PROXMOX_HOST_R630_01:-192.168.11.11}}"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
ok() { echo -e "${GREEN}[✓]${NC} $1"; }
fail() { echo -e "${RED}[✗]${NC} $1"; }
warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
info() { echo -e "${BLUE}[INFO]${NC} $1"; }
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "NPMplus (VMID $VMID) running, IP, gateway check"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# 1) Must be run where pct exists (Proxmox host)
if ! command -v pct &>/dev/null; then
fail "pct not found. Run this script on the Proxmox host (e.g. ssh root@${PROXMOX_HOST}) or use: ssh root@${PROXMOX_HOST} 'bash -s' < scripts/verify/verify-npmplus-running-and-network.sh"
exit 1
fi
# 2) Container exists and status
if ! pct status "$VMID" &>/dev/null; then
fail "VMID $VMID not found on this host."
exit 1
fi
STATUS=$(pct status "$VMID" 2>/dev/null | awk '{print $2}')
if [[ "$STATUS" != "running" ]]; then
fail "NPMplus (VMID $VMID) is not running. Status: $STATUS"
info "Start with: pct start $VMID"
info "Configured network (from pct config) verify IP/gw match expected:"
pct config "$VMID" 2>/dev/null | grep -E '^net|^name' || true
echo "Expected: gateway $EXPECTED_GW; IP(s) ${EXPECTED_IPS[*]}"
exit 1
fi
ok "NPMplus (VMID $VMID) is running"
# 3) Network config from container config (host view)
info "Container network config (pct config):"
pct config "$VMID" 2>/dev/null | grep -E '^net|^name' || true
echo ""
# 4) IP and gateway inside container
info "IP addresses and gateway inside container:"
IP_OUT=$(pct exec "$VMID" -- ip -4 addr show 2>/dev/null || true)
GW_OUT=$(pct exec "$VMID" -- ip route show default 2>/dev/null || true)
echo "$IP_OUT"
echo "Default route: $GW_OUT"
echo ""
# Parse default gateway
ACTUAL_GW=$(echo "$GW_OUT" | awk '/default via/ {print $3}')
if [[ -n "$ACTUAL_GW" ]]; then
if [[ "$ACTUAL_GW" == "$EXPECTED_GW" ]]; then
ok "Gateway is correct: $ACTUAL_GW"
else
warn "Gateway is $ACTUAL_GW (expected $EXPECTED_GW)"
fi
else
warn "Could not determine default gateway"
fi
# Parse IPs (simple: lines with inet 192.168.11.x)
FOUND_IPS=()
while read -r line; do
if [[ "$line" =~ inet\ (192\.168\.11\.[0-9]+)/ ]]; then
FOUND_IPS+=("${BASH_REMATCH[1]}")
fi
done <<< "$IP_OUT"
if [[ ${#FOUND_IPS[@]} -eq 0 ]]; then
fail "No 192.168.11.x address found in container"
else
ok "Container has IP(s): ${FOUND_IPS[*]}"
MISSING=()
for exp in "${EXPECTED_IPS[@]}"; do
found=false
for g in "${FOUND_IPS[@]}"; do [[ "$g" == "$exp" ]] && found=true; done
[[ "$found" != true ]] && MISSING+=("$exp")
done
if [[ ${#MISSING[@]} -gt 0 ]]; then
warn "Expected at least one of ${EXPECTED_IPS[*]}; missing in container: ${MISSING[*]} (UDM Pro forwards to .167)"
fi
fi
# 5) Admin UI reachable (port 81)
info "Checking NPMplus admin UI (port 81) on container IPs..."
for ip in "${FOUND_IPS[@]}"; do
if pct exec "$VMID" -- curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 "http://127.0.0.1:81" 2>/dev/null | grep -q '200\|301\|302\|401'; then
ok "Port 81 (admin UI) responding on container"
break
fi
done
if ! pct exec "$VMID" -- curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 "http://127.0.0.1:81" 2>/dev/null | grep -qE '200|301|302|401'; then
warn "Port 81 did not respond with 2xx/3xx/401 (admin UI may still be starting)"
fi
echo ""
echo "Expected: gateway $EXPECTED_GW; at least one of ${EXPECTED_IPS[*]} (UDM Pro uses .167)."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""