Add/remove monitored hosts without redeploy #14

Closed
opened 2026-07-12 20:11:04 -06:00 by jhodgkin · 2 comments
Owner

Currently hosts are declared in config/hosts.yaml and require a redeploy to pick up changes. Add a way to edit the monitored host list at runtime (admin UI or hot-reloaded config) so the dashboard stays 'configurable for future expansion' without code changes.

Currently hosts are declared in `config/hosts.yaml` and require a redeploy to pick up changes. Add a way to edit the monitored host list at runtime (admin UI or hot-reloaded config) so the dashboard stays 'configurable for future expansion' without code changes.
Author
Owner

Starting this one. Worth noting up front: Proxmox-monitored hosts (the host + every LXC) already require zero config and auto-discover on every poll — this only actually affects the statically-declared sshHosts and knownDevices lists in config/hosts.yaml. Going with hot-reload (watch the file, re-apply on change) rather than a full admin UI — simpler, and adding a new SSH-monitored host still needs a one-time manual step anyway (installing the forced-command key on the target), so a web form wouldn't make that part self-service regardless.

Starting this one. Worth noting up front: Proxmox-monitored hosts (the host + every LXC) already require zero config and auto-discover on every poll — this only actually affects the statically-declared `sshHosts` and `knownDevices` lists in `config/hosts.yaml`. Going with hot-reload (watch the file, re-apply on change) rather than a full admin UI — simpler, and adding a new SSH-monitored host still needs a one-time manual step anyway (installing the forced-command key on the target), so a web form wouldn't make that part self-service regardless.
Author
Owner

Done and deployed. Hot-reload works: edited config/hosts.yaml on CT122 with sed -i, confirmed via log line config/hosts.yaml changed, reloaded and the updated value showing up in /api/devices — no container restart.

Found a real bug while testing this for real instead of trusting the code: the first attempt silently didn't work at all. docker-compose.yml bind-mounted the single file (./config/hosts.yaml:/app/config/hosts.yaml:ro), which pins the container to that file's inode at mount time. sed -i (and most editors) write-then-rename — an atomic-write pattern that swaps in a new inode at the same path — so the container kept reading the orphaned original forever, no matter how long you waited. Confirmed via docker exec ... stat showing a stale mtime. Fixed by mounting the directory instead (./config:/app/config:ro), which resolves paths dynamically. Full writeup in docs/hot-reload.md.

Done and deployed. Hot-reload works: edited `config/hosts.yaml` on CT122 with `sed -i`, confirmed via log line `config/hosts.yaml changed, reloaded` and the updated value showing up in `/api/devices` — no container restart. Found a real bug while testing this for real instead of trusting the code: the first attempt silently didn't work at all. `docker-compose.yml` bind-mounted the single file (`./config/hosts.yaml:/app/config/hosts.yaml:ro`), which pins the container to that file's inode at mount time. `sed -i` (and most editors) write-then-rename — an atomic-write pattern that swaps in a *new* inode at the same path — so the container kept reading the orphaned original forever, no matter how long you waited. Confirmed via `docker exec ... stat` showing a stale mtime. Fixed by mounting the directory instead (`./config:/app/config:ro`), which resolves paths dynamically. Full writeup in `docs/hot-reload.md`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jhodgkin/homelab-monitor#14