Is there a way to disable health checks?

Hi. I need to make some tests on a library that requires access to the Fly.io environment (env variables and internal DNS), currently I would just like to manually run the tests using a SSH connection to my instance. I was wondering if there would be a way to deploy an app even if it doesn’t create a server to respond to health checks?

Thank you

If you do want services exposed, but no health checks, you can set http_checks and tcp_checks to both be empty:

[[services]]
  http_checks = []
+ tcp_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

- [[services.tcp_checks]]
-   grace_period = "1s"
-   interval = "15s"
-   restart_limit = 0
-   timeout = "2s"
1 Like

Thank you! Weirdly contrary to what I thought just a few minutes ago (removed my answer since) it seems that not declaring any service still causes health checks to be done, I don’t really understand why.
I will try exposing a service and making the checks empty like you described.

I tried it and it seems that it still wants to make some health checks, I wonder if I missed something or if there might still be some sort of default health check that cannot be removed?

Try putting [[services]] in your config (just the one line). When you deploy with [[services]] and then remove the block entirely, it keeps the previous definitions. Adding [[services]] clears it out.

Thanks! I just tried it this way and called fly deploy but unfortunately it still indicates that it wants to do health checks.

# fly.toml file generated for snowy-flower-3580 on 2022-07-04T02:19:14+02:00

app = "snowy-flower-3580"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[[services]]

And here is the console output:

==> Creating release
--> release v5 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 0 unhealthy [restarts: 2]

I read your answer too fast, I since removed the [[services]] line and now while I don’t see any health checks anymore I get this error:

==> Creating release
--> release v7 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment

v5 failed - Failed due to unhealthy allocations - no stable job version to auto revert to
--> v5 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v6

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/

I am not even specifying any executable yet in my Dockerfile so I’m unsure what the unhealthy allocations might be?

Ah! You will have to define a long running CMD. We expect there to be a process running in these VMs. You can make the command sleep infinity just to get it running.

1 Like

Thanks! That was the issue indeed! :slightly_smiling_face: