robofit / arcor2

Solution for end-user programming of (collaborative) robots using Augmented Reality. From AR to Python and back!
GNU Lesser General Public License v3.0
15 stars 16 forks source link

docker compose healthcheck #730

Closed ZdenekM closed 2 years ago

ZdenekM commented 2 years ago

Right now, we rely on depends_on which starts a service right after the specified dependencies are started - meaning that the containers are started, but the service itself might not be ready. This somehow works most of the time, because clients usually have some timeouts and usually service is able to get ready in time. But it is fragile. There is an option to restart the service on any failure (e.g. with a limited number of attempts), but that is a rather workaround than a solution. Within compose, it is possible to wait until the service is really ready to serve requests, see the example: https://github.com/peter-evans/docker-compose-healthcheck, or this blog: https://medium.com/geekculture/how-to-successfully-implement-a-healthcheck-in-docker-compose-efced60bc08e. That should be quite easy and bulletproof. We just need to add curl or wget to our images (for REST-based APIs).