coolify: [Bug]: Healthcheck not working as expected

Description

After a longer email conversation with andras about health checks i want to track the last bugs around health-checks i have here. Thanks for all the help so far 👍🏼

Before i had this configuration in my dockerfile:

HEALTHCHECK --interval=10s --timeout=3s --start-period=30s \
 CMD curl -f http://localhost/healthz || exit 1

Now i have this configuration:

Bildschirmfoto 2024-04-26 um 11 01 05

The two problems i have are:

  • It looks like the provided route is not called. When i look into the logs, i don’t see any logs about that route. When i had the healthcheck in my dockerfile i could the the logs of the healthz route being called every 10 seconds
  • I’m unsure about the start period, because in my deployment logs the health check is performed immediately and the attempts are counted up. Is this value used?

In my health check i check the database connection. As a test i shut down the database. 5 minutes later the backend resource was still marked as “healthy” so i think the health check is not really executing

Minimal Reproduction (if possible, example repository)

Please let me know if you need a reproduction and what this should contain

Exception or Error

No response

Version

v4.0.0-beta.266

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 32 (7 by maintainers)

Most upvoted comments

Same problem on 270

I will make a few changes. Coolify will check if curl or wget is available. If neither, it will try to use the proc filesystem for hc, or just pass healthy state. Not sure yet.

I had the exact same problem as @lewisdewsbury. Started having the healthcheck not working on version beta.271 on a resource that is build with a dockerfile. Dockerfile is based on a Bun base image. Added apt-get install -y curl in the dockerfile and now the healthcheck runs fine again! thanks @lewisdewsbury for the solution

I have made some modifications in the upcoming version.

  1. The start period and check interval are fixed. There was a strange bug that caused them to be ignored.
  2. When you define a Docker image or Dockerfile buildpack, the health check will be turned off by default, as it cannot be determined automatically what to check.
  3. Parse HEALTHCHECK from dockerfile and use it.