Add/remove monitored hosts without redeploy #14
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently hosts are declared in
config/hosts.yamland 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.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
sshHostsandknownDeviceslists inconfig/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.Done and deployed. Hot-reload works: edited
config/hosts.yamlon CT122 withsed -i, confirmed via log lineconfig/hosts.yaml changed, reloadedand 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.ymlbind-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 viadocker exec ... statshowing a stale mtime. Fixed by mounting the directory instead (./config:/app/config:ro), which resolves paths dynamically. Full writeup indocs/hot-reload.md.