I’m trying to set up health checks for non-public services. My understanding is that this is the intended purpose of custom checks. Taken straight from the docs:
If your app doesn’t have public-facing services, or you want independent health checks that don’t affect request routing, use this top-level
checks
section instead of [[services.checks]].
Yet I can’t seem to get this to work?
I’ve included a toml
below, which illustrates my attempt. I have two processes, foo
(public http service) and bar
(private internal service). The foo
check works as expected, but the bar
check does not.
[processes]
foo = "./foo" # this is public and serves on 8000
bar = "./bar" # this is private and serves on 9000
# set up `foo` as an http service to make it public, and give it an http check
# this works
[http_service]
internal_port = 8000
processes = ["foo"]
[[http_service.checks]]
grace_period = "20s"
interval = "5s"
timeout = "5s"
method = "GET"
path = "/health"
# set up an http check for bar?
# this does not work
[checks]
[checks.bar_health]
type = "http"
grace_period = "20s"
interval = "5s"
timeout = "5s"
method = "GET"
path = "/health"
port = 9000
It appears that the custom check above still tries to check the foo
machine (causing deployment failure), but I want it only to check the bar
machine.
Do I have a fundamental misunderstanding of custom checks? What’s the correct way of setting this up?