-
Notifications
You must be signed in to change notification settings - Fork 15
Improve dependency between services #180
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
Comments
There are some caveats if we move to docker swarm:
I prefer that containers themselves check whether all services that they need are started, either in the start script (using e.g. curl, wget or nc), or during execution of the service (e.g. stopping the service if connection to the DB is lost, or try to reestablish whenever possible.) This makes the solution less dependent on the deployment method. |
So in my case this is really annoying because if I don't use the install script to run the stack (I don't want all the unnecessary config/checks, etc since everything is already done once), Some of the services that depend on kafka fail at the start as kafka takes a lot of time to recover its state from snapshots. I have to then restart most of them after kafka brokers are recovered and healthy. It would be great if we had the option of specifying when the service was healthy only then run the other services. It is good to also use it for the services that we don't implement ourselves. Also migrating to swarm will not be affected as it just ignore the What do you think ? |
Hi! I'm new here and I don't know much about the applications yet, but I suggest the application should check it's critical dependencies like database or cache in a health check route and if they're not ready yet return an HTTP 500 error and Compose, Swarm or Kubetnetes or will check this route periodically and restart the application until health check route returns 200 code. This goes the same for other services like databases and it's already present in Hadoop's docker-compose.yml. |
We can do better dependency management in the compose file (eg - using the health check of other service) for different services using something like below -
instead of just
This will allow services to start after the other service is running and not just created. Also removes the need for applications to sleep for DBs to start up (as is the case in some services in the current setup).
Ref: https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on
The text was updated successfully, but these errors were encountered: