Open utterances-bot opened 11 months ago
HTTP control (or admin) servers in the wild:
stats admin
interface(Edited: A previous commenter had suggested using filesystem notifications for reloading but has since deleted their comments): Caddy also supports reloading on filesystem notification. In production, I've actually found that to be undesirable, because it can try to perform reloads overzealously (reloads are not free!) or with partially ready edited files. An intentional curl http://admin/reload/endpoint
is always better, and I can always wire up a separate watchexec to issue that on change.
Caddy of course has a full admin API which is quite a bit more than just a reload trigger.
One last note on benefits of the control server approach is that Windows doesn't really have signals, so servers that expect e.g. USR1 for reload... can't be reloaded on Windows. Whoops.
Edit: this comment was originally in the context of another person who mistook my previous comment as personal criticism, responded in kind, and subsequently deleted their posting; that consequence was not my intent. OP I apologise for bringing conflict to your commenting section.
Look I dislike doing this, but: you'll notice I'm the original author of the notify
crate. I'm well aware of its cross platform nature and limitations thereof.
I offered additional context and experience from having managed, written, and maintained such systems in production; it wasn't meant as a putdown of your particular idea. Specifically, the "whoops", which is within the paragraph on signals in windows, was nothing to do with you, and about assuming signal availability on windows (and indeed was self-deprecating as a mistake I've made in the past!)
Of course there's tradeoffs to everything. However, on balance, my experience is that file notification reloading is more fragile and less reliable in production (it's very fine otherwise), that signals aren't always available, and that http control servers are well established in other industry products like those I listed earlier. YMMV.
@passcod thank you. I stand corrected. Removed my previous comments as they do not bring any value to the original discussion.
How does the control server communicate to the normal service after the control server has reloaded configuration files?
Also, can we directly expose an API in the normal server to reload configuration files?
Signals vs. Servers
A better UX for managing processes
https://blog.adamchalmers.com/signals-vs-servers/