-
Notifications
You must be signed in to change notification settings - Fork 207
Add HTTP health-check server #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
559a9e0 to
7d69664
Compare
|
@rosa could you please have a look? This is a simple and safe change, but I believe it will be useful for many people, including myself. Happy to discuss if needed |
|
Feel free to disagree with me on this, but what about adding some kind of check to ensure that this can't be run while also using the Puma plugin? |
|
Thanks for the hint, @Th3-M4jor 👍 I agree with you and will add an extra check. |
d371408 to
177afd4
Compare
|
Added ✅ |
177afd4 to
a9766af
Compare
|
I've revised the idea in favour of launching via supervisor and setting it up via a config file, just like workers |
00575cf to
13d3414
Compare
|
Hey @faraquet, thanks for working on this! However, I'm not sure the separate web server process guarantees anything about the health of the workers and dispatchers and the other processes beyond the supervisor being alive, which you can check via the pid 🤔 Another question I have is why the possibility of running multiple health server processes per supervisor. |
13d3414 to
e93a4ad
Compare
e93a4ad to
b4a364a
Compare
|
Thanks a lot for the feedback, @rosa!
I was thinking about doing something similar with the workers and reusing their configuration, but I completely agree - there's no reason to run multiple processes, so I changed it to use just one.
In our container setup, it's quite inconvenient to check via pid, and having an HTTP response would make things much easier. What do you think about making the server a bit more advanced and actually checking the supervisor's state? I've made the POC version already. If you think it looks promising, I can continue developing it and add more tests. |
The tiny HTTP health-check server that now runs as a supervised process.
/and/health:200 OKwith bodyOKwhen the supervisor and all supervised processes (workers, dispatchers, scheduler, and the health server itself) have fresh heartbeats.503 Service Unavailablewith bodyUnhealthyif any supervised process (or the supervisor) has a stale heartbeat.404 Not Foundconfig/queue.ymlunderhealth_server:. Bothhostandportare required.Enable and configure via process configuration:
Note:
plugin :solid_queueinpuma.rb), the configured health server is skipped to avoid running multiple HTTP servers in the same process tree. A warning is logged. If you need the health server, run Solid Queue outside Puma (for example, viabin/jobs) or disable the plugin on that instance.