Skip to content
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

Can I add healthcheck to the services dependencies? #582

Closed
unkcpz opened this issue Jun 4, 2024 · 4 comments
Closed

Can I add healthcheck to the services dependencies? #582

unkcpz opened this issue Jun 4, 2024 · 4 comments

Comments

@unkcpz
Copy link

unkcpz commented Jun 4, 2024

In our docker image, we start the main service (oneshot) based on the rabbitmq (longrun) (https://github.com/aiidateam/aiida-core/blob/fa28ebfc1a6dbd25a86de2ab2d38ea36794362db/.docker/aiida-core-with-services/s6-assets/s6-rc.d/aiida-prepare/dependencies.d/rabbitmq)

We start the RMQ service (type longrun) with:

#!/command/execlineb -P

with-contenv

foreground { s6-echo "start RMQ server" }
rabbitmq-server

But we realised the RabbitMQ service start to fast that it is not ready for our service to detect it. We workaround it by adding a sleep in the startup script.

Is s6-overlay support to add a healthcheck to the dependencies services only do the following services launching after healthcheck is passing as docker compose?

We also have a docker-compose file to start the rabbitmq as another independent container, so we can do healthcheck and then start the main container. It 'll be great to have similar thing with s6-overlay I assume?

@skarnet
Copy link
Contributor

skarnet commented Jun 4, 2024

Your problem is readiness notification. Here is how s6 handles it. Please read this page before anything else.

If RabbitMQ can support direct readiness notification via a command-line option, then that's what you should use.

If it cannot, then you should put a call to your healthchecker in a script named check in a data subdirectory of your service directory (remember to make it executable!) and add a call to s6-notifyoncheck right before rabbitmq-server in your run script. If the service takes a particularly long time to start, you may want to adjust various options to s6-notifyoncheck so that it doesn't report failure before the service has had the chance to become ready.

@unkcpz
Copy link
Author

unkcpz commented Jun 6, 2024

Thanks! Sounds it is the tool I need. I'll give it a try. So I'll close the issue for the moment, will reopen if more questions coming up.

@unkcpz
Copy link
Author

unkcpz commented Jun 14, 2024

Hi @skarnet, I did apply a pool healthchecker and tested works on Linux with both docker and podman but now with docker on windows with WSL. The problem in WSL docker looks like the pool healthcheck is running but block the following service to start. Do you have any clue on what could be wrong?

@unkcpz unkcpz reopened this Jun 14, 2024
@skarnet
Copy link
Contributor

skarnet commented Jun 14, 2024

I answered directly on the linked issue. If it's specific to a given environment, especially a weird one such as WSL, then I don't think the problem is related to s6-overlay; it's likely something in the environment that makes the readiness reporting fail. We'll see.

@skarnet skarnet closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants