-
Notifications
You must be signed in to change notification settings - Fork 18
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
Proposal : Overhaul readiness checks #212
Proposal : Overhaul readiness checks #212
Conversation
Finally had a chance to review this - looks good @n1ru4l 👍 |
Let's get this and #213 into a new major |
we are also already using these changes successfully in our ci pipelines on our private fork :) |
haha, happy to hear it's been pre-beta tested 😄 |
@n1ru4l do you have permissions to merge PRs once approved? |
@erikengervall nope 😅 |
alright, gimmie a minute to dig around in settings haha |
@n1ru4l so i've set a requirement for 1 review on protected branches, which is only only i saw u accepted my invite to become a collaborator, i hope this enables the shiny merge button 🤞 |
awesome :) |
This is a breaking change the overhauls the existing readiness check system. All readiness check related stuff is now exported via
"dockest/readiness-check"
.By default a readiness check does no longer have a retry. Retry must be explicitly declared by wrapping a readiness check with the
withRetry
function exported from"dockest/readiness-check"
.Having a global retry does make sense for brute-force attempts (e.g. try run command 10 times before failing), but not for readiness checks that observe the docker event stream or potentially in the future logs.
The old readiness checks for redis, postgres, and web are now also exported from that namespace. Those already have the retry "trait" applied. So it is a bit easier to upgrade, if anyone is already relying on that readinesschecks.
The
zeroExitCodeReadinessCheck
assumes that a container is ready when it exits with the exit code"0"
. This is useful if you have a container that is responsible for running database migrations.The
containerIsHealthyReadinessCheck
assumes that a container is ready once the docker health check pubishes a "heathy" value via the docker event stream. This is IMHO a better and universal way of verifying that a container is ready (in comparison to the old redis, postgres, and web retry-readiness checks), as many containers already come with a health-check definition in their Dockerfile. Most setups should therefore be best off by using that readiness check.The
withNoStop
utility can be used to automatically fail any user-land readiness check in case the container exists preliminary. It is also used by thecontainerIsHealthyReadinessCheck
,createWebReadinessCheck
,createRedisReadinessCheck
andcreatePostgresReadinessCheck
for faster feedback (instead of waiting for a retry to time out).