Dockerfile healthcheck
jcpunk opened this issue · 4 comments
Some sort of built in health check that pulls down the "home page" would be very nice for testing DB connectivity.
Hi @jcpunk!
We have a minimal healthcheck already. It does not check the DB though, on purpose, see 53e22dd 's commit message.
A full-blown healthcheck could be useful perhaps, so we are open to PRs adding such a feature. I think that the user should have a choice of which health endpoint to use though.
...but I merged #689 too fast, it's actually not working, @jcpunk.
Please see https://docs.python.org/3/library/sys.html#sys.exit - if you want to pass a non-integer to sys.exit
, then it has to be None
to exit with an exit code 0. And your expression returns a boolean. Can you please provide a working PR?
While fixing it please consider changing the --interval
value too - 5 minutes means that together with the default --retries=3
the app may not be working for 15 minutes until the health of the container will change to unhealthy - that's a pretty long time for such a low-cost healthcheck.
Just posted a PR to try to clean up.