-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Adding healthcheck to docker image #3416
Conversation
hi, thanks for the PR. I think we should probably use just Other than that it looks good to me from a code perspective. Does this have any implications, what does the healtcheck do when it fails? how is the information useful in the first place? |
Hi @vabene1111, thanks for the reply. The only reason I used
I don't know the flows as well as you would, so I preferred to use option 1. But happy to take your guidance on this. Regarding usage, there is nothing by default that happens when the healthcheck fails. Personally, I use it so other docker services that rely on this container won't start if it's failing. For example, in the docker-compose described in the docs, the nginx container has a dependency on the web_recipes like so:
This only requires the web_recipes container to be specified, but if is failing, the nginx container still comes online. Instead you could specify like this:
And this would require the web_recipes container to come up and pass a healthcheck before the nginx container to come online. There are also services like docker-autoheal that can be used to automatically restart containers if healthchecks fail, but they require a healthcheck to be defined (where Tandoor would require it to be defined explicitly by the user). There is the additional resource required to execute the healthcheck, but I think for an application of this size 30s is reasonable? I can always make that longer if you think it's a concern, or if you prefer, we can leave this PR out and keep the healthcheck optional. |
Hi, thanks for your explanation. I think adding a healthcheck is probably a good practice so lets go ahead with it. Lets go with option 1, it is indeed the only anonymous endpoint right now, maybe I could add a special health check one in the future. |
… of a GET request
Awesome, I've updated with --spider. :) |
Good idea, however, for me the container is unhealthy with the following in the logs:
|
Good idea, however, for me the container is unhealthy with the following in the logs:
Sorry for the noise, seems it was a wrongly configured ALLOWED_HOSTS. |
Updated the docker image with a HEALTHCHECK directive to avoid the need for users to specify one themselves in a docker-compose.yml (for example).
Used some typical values for the check, happy to tweak if necessary.