How to use [[services.http_checks]] ?

I’m trying to setup health checks.
I’m serving static files using caddy. It’s just an updated version of the running a static website tutorial because it used an outdated goStatic.
Here is my Caddyfile

:8043 {
	root * /usr/share/caddy
	handle /health_check {
		respond "OK"

I declare a server listening to :8043 (like in the tutorial) serving files from /usr/share/caddy and answering OK for request on /health_check

Here is my Dockerfile

FROM caddy:2.7.6-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY ./public/ /usr/share/caddy

The HTML files are stored on my computer in ./public/ and are saved in the container’s filesystem at /usr/share/caddy (notice that I specify to serve file from this exact location in Caddyfile). The Caddyfile is stored in the correct directory according to the doc.

Now comes the fly.toml

# app = ''
# primary_region = ''

  auto_rollback = true


  internal_port = 8043
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

  protocol = 'tcp'
  internal_port = 8043
  processes = ['app']

    port = 80
    handlers = ['http']
    force_https = true

    port = 443
    handlers = ['tls', 'http']
    type = 'connections'
    hard_limit = 25
    soft_limit = 20

  grace_period = "10s"
  interval = "30s"
  method = "GET"
  timeout = "5s"
  path = "/health_check"

#  interval = 10000
#  grace_period = "5s"
#  method = "get"
#  path = "/health_check"
#  protocol = "http"
#  timeout = 2000
#  tls_skip_verify = false
#  [services.http_checks.headers]


  strategy = "rolling"

For now it works. :

Why are every example using path = "/" while by doing that we have a fly checks ls that is unreadable (it tries to display the whole HTLM in the “output” section)

If I try to use the [ [services.http_checks]] directive instead, it doesn’t work even when it’s the exact example from the documentation, it has been succesfully used in multiple places.
I also can’t use the [[services.tcp_checks]] without errors.

Can someone explain how to use [[services.tcp_checks]] and [ [services.http_checks]]. Or if i’m doing something wrong ?


One thing to try first, is to just have one service with internal port 8043. In your case, you could just keep the [http_service] and delete the other [[services]] config. Then see if [[http_service.checks]] works.