From d4b28dd41b1bad5592f8b957e5e4ed5cfb29784f Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 2 Jul 2026 14:14:42 +0000 Subject: [PATCH] NPM: use stable internal IP 10.10.10.3 for all API calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NPM API was reached via NPM_LAN_IP, which breaks when that value is a placeholder or unset (and the :-10.10.10.103 fallback was wrong — the internal IP is .3, not .103). NPM listens on all interfaces, so the host can always reach it at 10.10.10.3:81 over vmbr1. NPM_LAN_IP now only drives user-facing messages and the NPM LXC's LAN net0. Co-Authored-By: Claude Sonnet 4.6 --- install-stack.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install-stack.sh b/install-stack.sh index d02895a..350743f 100755 --- a/install-stack.sh +++ b/install-stack.sh @@ -930,7 +930,7 @@ ${build_out}" local npm_token npm_token=$(npm_get_token) - local npm_ip="${NPM_LAN_IP:-10.10.10.103}" + local npm_ip="10.10.10.3" # stable internal NPM IP (vmbr1) — API only needs internal reach if [[ -n "$npm_token" ]]; then # Find the proxy host for our domain local host_id @@ -1036,7 +1036,7 @@ ${build_out}" # Add /hk-planner/ location to NPM proxy host msg_info "Adding /hk-planner/ to NPM proxy" local npm_token; npm_token=$(npm_get_token) - local npm_ip="${NPM_LAN_IP:-10.10.10.103}" + local npm_ip="10.10.10.3" # stable internal NPM IP (vmbr1) — API only needs internal reach if [[ -n "$npm_token" ]]; then local host_id host_id=$(curl -sf "http://${npm_ip}:81/api/nginx/proxy-hosts" \ @@ -1081,7 +1081,7 @@ print(json.dumps(locs)) # Returns a Bearer token for the NPM API, or empty string on failure. npm_get_token() { - local npm_ip="${NPM_LAN_IP:-10.10.10.103}" + local npm_ip="10.10.10.3" # stable internal NPM IP (vmbr1) — API only needs internal reach local email="${NPM_ADMIN_EMAIL:-manage@hotel.com}" local pass="${NPM_ADMIN_PASS:-}" [[ -z "$pass" ]] && { echo ""; return; } @@ -1095,8 +1095,9 @@ configure_npm_proxy_hosts() { msg_step "Configuring NPM proxy hosts" msg_info "Waiting for NPM API to be ready" + local npm_ip="10.10.10.3" # stable internal NPM IP (vmbr1) local i=0 - while ! curl -sf --max-time 3 "http://${NPM_LAN_IP}:81/api/" &>/dev/null; do + while ! curl -sf --max-time 3 "http://${npm_ip}:81/api/" &>/dev/null; do sleep 3; i=$((i+1)) [[ $i -ge 30 ]] && { msg_warn "NPM API not responding — configure proxy hosts manually"; return; } done @@ -1115,7 +1116,7 @@ configure_npm_proxy_hosts() { # NPM already sets X-Real-IP / X-Forwarded-For by default, so no advanced_config. create_proxy_host() { local forward_host=$1 forward_port=$2 locations_json=${3:-'[]'} - curl -sf -X POST "http://${NPM_LAN_IP}:81/api/nginx/proxy-hosts" \ + curl -sf -X POST "http://${npm_ip}:81/api/nginx/proxy-hosts" \ -H "Authorization: Bearer ${token}" \ -H "Content-Type: application/json" \ -d "{