Proxmox nodes: install in an LXC container instead of Docker on the node

Run on a Proxmox VE node (pct and /etc/pve present), the installers now
default to INSTALL_MODE=lxc: create or reuse (by tag netmon-hub /
netmon-probe) an unprivileged Debian LXC on vmbr0 with nesting and onboot,
push the installer into it (rebuilt from its own functions) and run it there
in native mode. LXC_* variables override ID, storage, template storage,
bridge, IP and size. Docker on a node now needs an explicit
INSTALL_MODE=docker and prints a warning; an earlier Docker install is
pointed out with removal steps.

Ping setup inside an unprivileged container stays within the mapped group
range, which the kernel requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:28:21 -08:00
parent edeb77f833
commit a17f2b502c
7 changed files with 382 additions and 38 deletions

View file

@ -26,6 +26,7 @@ Remote: `https://git.neilbantoc.dev/services/network-monitor.git` (Gitea). The r
| Mode | How it runs | Update command | Logs |
|---|---|---|---|
| lxc (Proxmox node) | A container made by the installer; inside it, the same as native Linux. | `pct exec <ctid> -- <name>-update` | `pct exec <ctid> -- journalctl -u <name> -f` |
| docker | `compose.yml` (hub, bridge, port 8000) / `compose.probe.yml` (probe, `network_mode: host`). The image is runtime only; the source is cloned into a volume. | `docker exec network-monitor update` / `docker exec network-probe update` | `docker logs -f <name>` |
| native, Linux | `/opt/<name>` is the git checkout plus `.venv/`, `data/`, `.env`, `.native`. A systemd unit `<name>.service` runs `native/run.sh` as user `netmon`. | `sudo <name>-update` | `journalctl -u <name> -f` |
| native, macOS | Same layout. The LaunchDaemon `/Library/LaunchDaemons/dev.neilbantoc.<name>.plist` runs as the installing user. | `<name>-update` (no sudo; it calls sudo for `launchctl kickstart`) | `/opt/<name>/data/service.log` |
@ -37,7 +38,9 @@ Remote: `https://git.neilbantoc.dev/services/network-monitor.git` (Gitea). The r
The mode is stored as `INSTALL_MODE` in `/opt/<name>/.env`.
The intended topology:
- **Proxmox VE nodes:** an unprivileged Debian 12 LXC per node (native mode) running a probe, on `vmbr0`. The hub runs in an LXC too. Do **not** install Docker on a PVE node itself: Docker changes the host firewall, and with the Proxmox firewall on that can break guest networking.
- **Proxmox VE nodes:** `lxc` mode, the default when `pct` and `/etc/pve` exist. Running the installer on the node as root creates (or reuses, found by tag `netmon-hub` / `netmon-probe`) an unprivileged Debian LXC on `vmbr0`. It then `pct push`es itself into the container (re-assembled from its own functions with `declare -f`) and runs there in native mode. `LXC_*` variables override ID, storage, bridge, IP and size. Day to day: `pct exec <ctid> -- network-probe-update`, `pct enter <ctid>`.
- Do **not** install Docker on a PVE node itself: Docker changes the host firewall, and with the Proxmox firewall on that can break guest networking.
- The first real deploy (gmktec-g9, 2026-11-05) predates `lxc` mode and installed the hub with Docker on the node. The README section "Removing a Docker install from a Proxmox node" covers cleanup.
- **Mac mini:** native probe.
Both update commands do the same thing:
@ -120,7 +123,7 @@ What has been tested:
- re-run keeps `.env`
Never run on real hardware yet. Note what you find under "Deployment notes" below:
- an actual Proxmox LXC (unprivileged, nesting)
- an actual Proxmox node: `lxc` mode against real `pct`/`pveam`/`pvesm` (tested with stubs that record the calls), and native mode inside a real unprivileged LXC, including the ping range limited to the container's mapped groups
- macOS: launchd, Homebrew Python, `route`/`arp` parsing on a live system, the application firewall
- a real AdGuard Home (only tested against a stand-in built from its API docs)
@ -128,4 +131,4 @@ Never run on real hardware yet. Note what you find under "Deployment notes" belo
Add environment-specific findings here (machine, date, what happened, fix).
- (none yet)
- **gmktec-g9 (Proxmox VE node), 2026-11-05:** the installer run on the node picked Docker mode, because `lxc` mode didn't exist yet, and installed Docker on the node. Fixed: Proxmox nodes now default to `lxc` mode. To clean up, see the README section "Removing a Docker install from a Proxmox node".