Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Fix dev backend binding for local agent reports
rcourtman484d9aab877b
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 86d635f8ff..6444883cad 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -1059,6 +1059,11 @@ verification wrappers, and integration helper defaults must therefore advertisethe same managed login and treat custom dev credentials as explicit`HOT_DEV_AUTH_*` or `PULSE_E2E_*` overrides instead of inheriting leftover authstate from a prior session.+That same runtime override boundary also owns agent reachability coherence:+when a managed dev runtime advertises a local-interface `PULSE_PUBLIC_URL` or+agent connect URL for installed agents, a stale loopback `BIND_ADDRESS` in+runtime `.env` must be reconciled before the backend starts or restarts so+remote agents can report host telemetry instead of buffering indefinitely.That same takeover path must remain safe on the default macOS Bash runtime andmust not tear down the operator's current shell lineage while reclaiming aforeground `hot-dev.sh` session. When the canonical ports are already owned bydiff --git a/scripts/hot-dev.sh b/scripts/hot-dev.shindex db941b2465..0059f325b2 100755--- a/scripts/hot-dev.sh+++ b/scripts/hot-dev.sh@@ -418,6 +418,7 @@ fisync_runtime_auth_env_overridesload_runtime_env_overrides+hot_dev_reconcile_agent_bind_addressif [[ "${PULSE_DATA_DIR}" == "${ROOT_DIR}/tmp/dev-config" ]] && [[ ${PULSE_MOCK_MODE:-false} != "true" ]]; thenecho "Syncing production configuration..."@@ -761,6 +762,7 @@ log_info "Starting backend file watcher..."# effect without a full hot-dev restart.sync_runtime_auth_env_overridesload_runtime_env_overrides+ hot_dev_reconcile_agent_bind_address# Kill ALL pulse processes (not just one) to prevent duplicatespkill -f "^\./pulse$" 2>/dev/null || truediff --git a/scripts/lib/hot-dev-runtime.sh b/scripts/lib/hot-dev-runtime.shindex e241c2a8fd..b76c878f85 100644--- a/scripts/lib/hot-dev-runtime.sh+++ b/scripts/lib/hot-dev-runtime.sh@@ -19,3 +19,112 @@ hot_dev_pulse_process_count() {printf '%s\n' "${count}"}++hot_dev_normalize_host() {+ local host="${1:-}"++ host="${host#[}"+ host="${host%]}"+ printf '%s\n' "${host}" | tr '[:upper:]' '[:lower:]'+}++hot_dev_url_host() {+ local url="${1:-}"+ local host_port host++ [[ -n "${url}" ]] || return 0++ host_port="${url}"+ if [[ "${host_port}" == *"://"* ]]; then+ host_port="${host_port#*://}"+ fi+ host_port="${host_port%%/*}"+ host_port="${host_port%%\?*}"+ host_port="${host_port%%#*}"++ if [[ "${host_port}" == \[*\]* ]]; then+ host="${host_port#\[}"+ host="${host%%\]*}"+ else+ host="${host_port%%:*}"+ fi++ hot_dev_normalize_host "${host}"+}++hot_dev_host_is_loopback() {+ local host+ host="$(hot_dev_normalize_host "${1:-}")"++ [[ -n "${host}" ]] || return 1++ case "${host}" in+ localhost|127.*|::1|0:0:0:0:0:0:0:1)+ return 0+ ;;+ esac++ return 1+}++hot_dev_bind_address_is_loopback() {+ hot_dev_host_is_loopback "${1:-}"+}++hot_dev_host_matches_local_interface() {+ local host="${1:-}"+ local candidate+ local system_hostname=""+ local short_hostname=""++ host="$(hot_dev_normalize_host "${host}")"+ [[ -n "${host}" ]] || return 1++ if [[ -n "${LAN_IP:-}" ]] && [[ "${host}" == "$(hot_dev_normalize_host "${LAN_IP}")" ]]; then+ return 0+ fi++ for candidate in ${ALL_IPS:-}; do+ if [[ "${host}" == "$(hot_dev_normalize_host "${candidate}")" ]]; then+ return 0+ fi+ done++ system_hostname="$(hostname 2>/dev/null || true)"+ system_hostname="$(hot_dev_normalize_host "${system_hostname}")"+ short_hostname="${system_hostname%%.*}"++ if [[ -n "${system_hostname}" && "${host}" == "${system_hostname}" ]]; then+ return 0+ fi+ if [[ -n "${short_hostname}" && "${host}" == "${short_hostname}" ]]; then+ return 0+ fi++ return 1+}++hot_dev_reconcile_agent_bind_address() {+ local bind_address="${BIND_ADDRESS:-}"+ local labels="PULSE_AGENT_CONNECT_URL PULSE_AGENT_URL PULSE_PUBLIC_URL"+ local label url host++ [[ -n "${bind_address}" ]] || return 0+ hot_dev_bind_address_is_loopback "${bind_address}" || return 0++ for label in ${labels}; do+ url="${!label-}"+ host="$(hot_dev_url_host "${url}")"+ [[ -n "${host}" ]] || continue+ hot_dev_host_is_loopback "${host}" && continue+ hot_dev_host_matches_local_interface "${host}" || continue++ BIND_ADDRESS="0.0.0.0"+ export BIND_ADDRESS++ if declare -F log_warn >/dev/null 2>&1; then+ log_warn "${label}=${url} points at this machine, but BIND_ADDRESS=${bind_address} only accepts local connections. Exposing the dev backend on 0.0.0.0 so installed agents can report metrics."+ fi+ return 0+ done+}diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.shindex a318a18579..1eabd04e4e 100755--- a/scripts/tests/test-hot-dev-bg.sh+++ b/scripts/tests/test-hot-dev-bg.sh@@ -678,6 +678,42 @@ test_hot_dev_script_ignores_test_only_backend_churn() {assert_contains "hot-dev watcher suppresses source churn during managed verification" "${output}" 'verify_lock_active'}+test_hot_dev_reconciles_agent_reachable_bind_address() {+ local output++ output="$(+ HOT_DEV_RUNTIME_PATH="${ROOT_DIR}/scripts/lib/hot-dev-runtime.sh" \+ bash -lc '+ source "${HOT_DEV_RUNTIME_PATH}"++ LAN_IP=192.168.50.10+ ALL_IPS="192.168.50.10 10.10.10.5"++ BIND_ADDRESS=127.0.0.1+ PULSE_PUBLIC_URL=http://192.168.50.10:7655+ unset PULSE_AGENT_CONNECT_URL PULSE_AGENT_URL+ hot_dev_reconcile_agent_bind_address+ printf "lan_bind=%s\n" "${BIND_ADDRESS}"++ BIND_ADDRESS=127.0.0.1+ PULSE_PUBLIC_URL=https://pulse.example.com+ unset PULSE_AGENT_CONNECT_URL PULSE_AGENT_URL+ hot_dev_reconcile_agent_bind_address+ printf "external_bind=%s\n" "${BIND_ADDRESS}"++ BIND_ADDRESS=0.0.0.0+ PULSE_AGENT_CONNECT_URL=http://192.168.50.10:7655+ unset PULSE_PUBLIC_URL PULSE_AGENT_URL+ hot_dev_reconcile_agent_bind_address+ printf "already_exposed_bind=%s\n" "${BIND_ADDRESS}"+ '+ )"++ assert_contains "hot-dev exposes backend for LAN public URL" "${output}" "lan_bind=0.0.0.0"+ assert_contains "hot-dev leaves external public URLs on loopback" "${output}" "external_bind=127.0.0.1"+ assert_contains "hot-dev preserves already exposed backend bind" "${output}" "already_exposed_bind=0.0.0.0"+}+test_hot_dev_health_monitor_probes_api_health() {local outputoutput="$(cat "${HOT_DEV}")"@@ -1226,6 +1262,7 @@ main() {test_makefile_routes_managed_runtime_through_npmtest_hot_dev_script_advertises_foreground_escape_hatchtest_hot_dev_script_ignores_test_only_backend_churn+ test_hot_dev_reconciles_agent_reachable_bind_addresstest_hot_dev_health_monitor_probes_api_healthtest_hot_dev_bg_script_advertises_managed_entrypointtest_hot_dev_bg_usage_prefers_managed_wrappers