Hi,
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
file_server
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 = ''
[experimental]
auto_rollback = true
[build]
[http_service]
internal_port = 8043
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[services]]
protocol = 'tcp'
internal_port = 8043
processes = ['app']
[[services.ports]]
port = 80
handlers = ['http']
force_https = true
[[services.ports]]
port = 443
handlers = ['tls', 'http']
[services.concurrency]
type = 'connections'
hard_limit = 25
soft_limit = 20
[[http_service.checks]]
grace_period = "10s"
interval = "30s"
method = "GET"
timeout = "5s"
path = "/health_check"
#[[services.http_checks]]
# interval = 10000
# grace_period = "5s"
# method = "get"
# path = "/health_check"
# protocol = "http"
# timeout = 2000
# tls_skip_verify = false
# [services.http_checks.headers]
#[[vm]]
#...
[deploy]
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 ?
Thx