Add new site without downtime
Since IPs and therefore ports are precious, one could want to build a static site hosting setup usable by multiple people. Does dathttpd allow to test and reload (SIGHUP) its configuration, in case sites want to be added or removed during runtime?
That should be feasible, it'd just need a PR to be added.
Not sure if this is the same question.
I've been adding new sites to .dathttpd.yml file and then running sudo systemctl stop dathttpd and sudo systemctl start dathttpd. This work fine, but I wonder if is there a better way to add sites without having to stop dathttpd?
@matamalaortiz yeah that's the same question. We just need to listen to a signal (maybe SIGHUP) and reload configuration off it.
Or watch .dathttpd.yml and reload automatically as it changes.
@millette that's a neat idea but it might surprise some folks
SIGHUP signal worked fine but then the PID changes every time and I haven't found a way to keep track of that changes ( I don't have much experience with servers). Watching .dathttpd.yml turned to be better for me, but I have to use restart (or reload-or-restart) instead of reloading. Because reload returns Failed to reload dathttpd.service: Job type reload is not applicable for unit dathttpd.service. Thanks!
@matamalaortiz can you share a bit more how you set up the watcher?
yeah @callil. Don't know if this is a proper way to do this but it's working for me. I created a node script to watch changes in the .dathttpd.yml file. (I used chokidar to watch and micromatch to read .dotfiles), then if there's any change in the file it triggers the reload. Run the script with pm2.