centrifugal / centrifugo

Scalable real-time messaging server in a language-agnostic way. Self-hosted alternative to Pubnub, Pusher, Ably. Set up once and forever.
https://centrifugal.dev
Apache License 2.0
8.38k stars 594 forks source link

[feature] Option to watch config for changes + reload as needed #502

Open cweagans opened 2 years ago

cweagans commented 2 years ago

Is your feature request related to a problem? Please describe.

When I'm building stuff locally with Centrifugo, it would be helpful to be able to make config changes in the json file and have centrifugo automatically reload/restart so that those config options take effect immediately.

Describe the solution you'd like.

What would the feature look like? How would it work? How would it change the API?

It would be great if it was as simple as centrifugo -c /path/to/config --watch or something like that.

FZambia commented 2 years ago

Hello, you can simply use nodemon:

npm install -g nodemon
nodemon --watch config.json --exec ./centrifugo --signal SIGTERM
cweagans commented 2 years ago

I know I can use external utils to do that. I'm running in a container and don't really want to load it up with a bunch of extra stuff.

FZambia commented 2 years ago

This will require proper shutdown of all components in Centrifugo. Some components already can stop gracefully, some can not since it was not really required. While having graceful stop for everything is nice to have – it's not really a quick improvement and I can't give any ETAs for this. So for now the only recommendation – use external tools.