dathttpd icon indicating copy to clipboard operation
dathttpd copied to clipboard

Add new site without downtime

Open almereyda opened this issue 8 years ago • 8 comments

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?

almereyda avatar Jan 13 '18 06:01 almereyda

That should be feasible, it'd just need a PR to be added.

pfrazee avatar Jan 13 '18 15:01 pfrazee

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 avatar Mar 17 '18 21:03 matamalaortiz

@matamalaortiz yeah that's the same question. We just need to listen to a signal (maybe SIGHUP) and reload configuration off it.

pfrazee avatar Mar 18 '18 18:03 pfrazee

Or watch .dathttpd.yml and reload automatically as it changes.

millette avatar Mar 18 '18 20:03 millette

@millette that's a neat idea but it might surprise some folks

pfrazee avatar Mar 19 '18 14:03 pfrazee

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 avatar Mar 20 '18 17:03 matamalaortiz

@matamalaortiz can you share a bit more how you set up the watcher?

callil avatar Apr 04 '18 00:04 callil

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.

matamalaortiz avatar Apr 04 '18 13:04 matamalaortiz