kamal icon indicating copy to clipboard operation
kamal copied to clipboard

Healthcheck bypass

Open Towerthousand opened this issue 1 year ago • 5 comments

I want to deploy an app that is not a webserver, with Kamal. There's only one thing preventing me from doing this: I need to respond to the healthcheck for the deployment to go through (I'm deploying with a proxy).

Is there any way to deploy without a healthcheck involved?

Towerthousand avatar Oct 08 '24 16:10 Towerthousand

#719 (reply in thread)

healthcheck: cmd: true

try this

It fails on kamal setup with error: ERROR (Kamal::ConfigurationError): proxy/healthcheck: unknown key: cmd

krasylnikov avatar Oct 09 '24 10:10 krasylnikov

@Towerthousand, @krasylnikov : I don't think you can bypass. But you can use Docker's healthcheck, or simply add a non-https route which responds 200

You should find more information in this issue : https://github.com/basecamp/kamal/issues/1041#issuecomment-2399018829 We have discussions about helathcheck.

BarnabeD avatar Oct 09 '24 14:10 BarnabeD

@Towerthousand - if the deployment is not a web app, you can set proxy: false which will then skip running the proxy.

Then Kamal will either wait for the container to reach the healthy state if it has a Docker healthcheck.

If there's no healthcheck it waits for the container to reach the running state, then waits for readiness_delay (default 7s) and confirms that the container is still running.

djmb avatar Oct 22 '24 11:10 djmb

the docs are really rich with information, https://kamal-deploy.org/docs/configuration/proxy/

acidtib avatar Oct 22 '24 17:10 acidtib

The cmd option was part of Kamal 1.x, that's been dropped with Kamal 2.

I think you can still accomplish a command-based healthcheck approach to get Docker to change the state to healthy by passing options to your role.

servers:
  web:
    proxy: false
    options:
      health-cmd: "date"

Swapping date with something that returns a zero-exit code.

https://docs.docker.com/engine/containers/run/#healthchecks

nickhammond avatar Dec 03 '24 02:12 nickhammond