Today we are announcing support for healthchecks with Codeship Pro!
Healthchecks solve one of the most nagging problems Pro customers may have experienced when getting a new project working: making sure a step doesn’t run until a particular container is alive and ready.
Healthchecks follow our recent release of depends_on and isolated networks and were enabled due to our recent large refactor of our Codeship Pro code. If you haven’t followed along with those announcements, it may be interesting to review them.
Let’s walk through a few in-depth details about what it looks like to work with healthchecks in Codeship Pro.
Implemented via Dockerfile
We’ve implemented healthchecks in the Docker standard way, via the Dockerfile. A healthcheck is built directly into your image by adding a simple line to your Dockerfile:
HEALTHCHECK CMD ["docker-healthcheck"]
Docker maintains a public Docker Hub account for providing common base images, such as Redis and Postgres, with built-in healthchecks that are ready to use and require no configuration. We recommend using Docker’s base images where applicable for the most standard and reliable configuration.
Not supported inside Services file
While Docker Compose does support healthchecks at a configuration-file level, we have opted not to support these inside of our Services file for now. Docker has more recently standardized the image as the common way to implement a healthcheck, and we believe implementation will be more portable and less proprietary by taking this approach.
Polling information provides status updates
When an image builds with a healthcheck, we will poll the running container every second for an updated status. You will see a notice in your logs both when we are polling as well as when a service becomes available.
If a service fails to become available after 60 minutes, we will proceed to run the pending step which will most likely fail. If you’d like to set a shorter retry limit, you can view the Docker documentation for information on how to do so.
Need More Info?
To learn more about healthchecks, you can review the documentation or look at our sample apps to see them in action. You can also review Docker’s own documentation, as well.
Just get in touch if you have any questions about using healthchecks or Codeship Pro in general!
[Tweet “”Announcing Healthchecks for Codeship Pro” via @codeship”]