Link <name>-update into /usr/bin so pct exec finds it without the full path

pct exec runs without a login shell and its PATH may lack /usr/local/bin.
setup.sh adds the link on Linux; update.sh adds it to older installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 21:05:20 -08:00
parent be727949c1
commit c9738358de
8 changed files with 19 additions and 11 deletions

View file

@ -31,7 +31,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> -- /usr/local/bin/<name>-update` (full path: `pct exec` runs with a minimal PATH without `/usr/local/bin`) | `pct exec <ctid> -- journalctl -u <name> -f` |
| lxc (Proxmox node) | A container made by the installer; inside it, the same as native Linux. | `pct exec <ctid> -- <name>-update` (the command is in `/usr/local/bin`, linked into `/usr/bin` on Linux because `pct exec`'s PATH may lack `/usr/local/bin`; `update.sh` adds the link to older installs) | `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, owned by the installing user. The LaunchDaemon `/Library/LaunchDaemons/dev.neilbantoc.<name>.plist` runs the app as **root**: macOS 15 Local Network privacy blocks LAN connections from a daemon running as a user (`[Errno 65] No route to host` while curl works), and root daemons are exempt (tested on 15.3.1). | `<name>-update` (no sudo; it calls sudo for `launchctl kickstart`) | `/opt/<name>/data/service.log` |
@ -43,7 +43,7 @@ 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:** `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> -- /usr/local/bin/network-probe-update`, or `pct enter <ctid>` and run it there.
- **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`, or `pct enter <ctid>` and run it there.
- **Names and port:** in an LXC (lxc mode, or native mode where `systemd-detect-virt -c` says lxc), `native/setup.sh` installs avahi-daemon, which announces `<hostname>.local`. It comments out `rlimit-nproc` in `avahi-daemon.conf`, because the stock value stops avahi-daemon from starting in unprivileged containers. The hub defaults to `HOST_PORT=80` there, granted by `AmbientCapabilities=CAP_NET_BIND_SERVICE`, unless `HOST_PORT` is passed.
- **Inner run:** lxc mode runs the inner installer with `LANG/LC_ALL=C.UTF-8` (the node's locale may not exist in the container) and `NETMON_NESTED=1`, which shortens the inner summary.
- **Probe commands:** Linux probes usually can't resolve `.local`. When the UI is opened by a `.local` name, the Add probe command uses `hub_lan_url` (the hub's own IP, native installs only) as `HUB_URL`.