LXC installs: announce <hostname>.local with Avahi, hub on port 80

In an LXC (lxc mode on a Proxmox node, or native mode inside an LXC), the
installer now:
- installs avahi-daemon (with the rlimit-nproc fix for unprivileged
  containers), so the container answers at <hostname>.local, and lists the
  web UI as a _http._tcp service
- serves the hub on port 80 (CAP_NET_BIND_SERVICE for the netmon user) unless
  HOST_PORT is given, so http://netmon-hub.local works without a port
- runs the inner install with LANG/LC_ALL=C.UTF-8 (no locale warnings from
  the node's LANG) and prints one summary, with the .local address

When the UI is opened by a .local name, the Add probe command uses the hub's
own IP for HUB_URL, since Linux probes usually can't resolve .local.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 19:19:47 -08:00
parent a96ae4e825
commit cd2deda996
9 changed files with 136 additions and 17 deletions

View file

@ -1,6 +1,7 @@
"""Probe management (UI) and the probe report endpoint (probes, token auth)."""
import ipaddress
import os
import secrets
import time
@ -68,13 +69,26 @@ def probe_out(row, *, with_token: bool = False) -> dict:
return out
def _lan_url(request: Request) -> str:
"""The hub's own address, for probe install commands when the UI was opened by a .local
name: Linux probes (in LXCs or Docker) usually can't resolve .local. Only meaningful for
native installs; in Docker this would be the container's bridge address."""
if (os.environ.get("INSTALL_MODE") or "docker") != "native":
return ""
host, port = (request.scope.get("server") or (None, None))
if not host or host.startswith("127.") or host == "::1":
return ""
host = f"[{host}]" if ":" in host else host
return f"http://{host}" + ("" if port in (80, None) else f":{port}")
@router.get("/probes")
def list_probes() -> dict:
def list_probes(request: Request) -> dict:
with db() as con:
rows = con.execute("SELECT * FROM probes ORDER BY name COLLATE NOCASE").fetchall()
s = settings.get()
return {"probes": [probe_out(r) for r in rows], "interval": s.probe_interval,
"install_url": s.probe_install_url, "hub_url": s.hub_public_url}
"install_url": s.probe_install_url, "hub_url": s.hub_public_url, "hub_lan_url": _lan_url(request)}
@router.post("/probes", status_code=201)