Hello,
My app is using a different port rather than the main application process for checking the current state:
I’m trying to setup fly.tomlaccordingly. For doing that, I first tried to
services.http_checkswith
port`:
[[services.http_checks]]
grace_period = "5s"
interval = "3s"
path = "/health"
method = "get"
port = 3001
timeout = "2s"
restart_limit = 2
And also tried services.script_checks
:
[[services.script_checks]]
grace_period = "5s"
interval = "3s"
command = "curl http://localhost:3001/health"
timeout = "2s"
restart_limit = 2
These two ways are actually not present in the documentation and I saw them from other forum topics, so probably they aren’t implemented? What am I doing wrong?
jerome
April 25, 2021, 1:03pm
2
Adding a port services.http_checks
should work!
Is your server binding to 127.0.0.1:3001
? It needs to bind to 0.0.0.0:3001
. Health checks come from outside the instance and therefore your server needs to listen on eth0
. The easiest way to do this is to bind to all addresses by using 0.0.0.0
.
totally my fault: I forgot to listen SIGTERM
kill signal.
Now it’s working as expected, however, after the new instance is deployed I can see logs related to continuous incoming requests on my logs.
That’s a little weird because my app is just being used by me.
Could be possible although I don’t have a services.tcp_checks
configured, it’s enabled with the default configuration? can I disable it?
Also, a thing it’s strange to me grace_period
is specified using natural language (5s
) while the rest of timing values (like timeout
) is using numerical (e.g., 3000
).
I added a silly log on the main process and looks like the healthcheck is not taking into consideration the port
setting since the main process is actually logging it
021-04-25T21:53:37.711Z f447908d cdg [info] { reqUrl: '/health' }
2021-04-25T21:53:37.714Z f447908d cdg [info] microlink-api:requests 0 [] → 1 [xqYP9dNU7oeT-pHMqGdO5] +10s
2021-04-25T21:53:37.718Z f447908d cdg [info] microlink-api:requests 1 [xqYP9dNU7oeT-pHMqGdO5] → 0 [] +4ms
2021-04-25T21:53:37.724Z f447908d cdg [info] microlink-api status=200 id=xqYP9dNU7oeT-pHMqGdO5 ip=::ffff:176.58.95.98 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=3.355ms +10s
2021-04-25T21:53:37.913Z 22b04695 lhr [info] { reqUrl: '/health' }
2021-04-25T21:53:37.916Z 22b04695 lhr [info] microlink-api:requests 0 [] → 1 [9ljSdhYuP4Rv2JLP1ukrP] +10s
2021-04-25T21:53:37.920Z 22b04695 lhr [info] microlink-api:requests 1 [9ljSdhYuP4Rv2JLP1ukrP] → 0 [] +5ms
2021-04-25T21:53:37.924Z 22b04695 lhr [info] microlink-api status=200 id=9ljSdhYuP4Rv2JLP1ukrP ip=::ffff:185.40.232.114 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=3.380ms +10s
2021-04-25T21:53:47.720Z f447908d cdg [info] { reqUrl: '/health' }
2021-04-25T21:53:47.723Z f447908d cdg [info] microlink-api:requests 0 [] → 1 [dFFZ1JYVMdVHylrcptn9E] +10s
2021-04-25T21:53:47.726Z f447908d cdg [info] microlink-api:requests 1 [dFFZ1JYVMdVHylrcptn9E] → 0 [] +4ms
2021-04-25T21:53:47.733Z f447908d cdg [info] microlink-api status=200 id=dFFZ1JYVMdVHylrcptn9E ip=::ffff:176.58.95.98 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=1.235ms +10s
2021-04-25T21:53:47.920Z 22b04695 lhr [info] { reqUrl: '/health' }
2021-04-25T21:53:47.922Z 22b04695 lhr [info] microlink-api:requests 0 [] → 1 [MQvOiO4_fll5JCt3k893N] +10s
2021-04-25T21:53:47.925Z 22b04695 lhr [info] microlink-api:requests 1 [MQvOiO4_fll5JCt3k893N] → 0 [] +3ms
2021-04-25T21:53:47.929Z 22b04695 lhr [info] microlink-api status=200 id=MQvOiO4_fll5JCt3k893N ip=::ffff:185.40.232.114 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=0.840ms +10s
2021-04-25T21:53:57.727Z f447908d cdg [info] { reqUrl: '/health' }
2021-04-25T21:53:57.731Z f447908d cdg [info] microlink-api:requests 0 [] → 1 [vKA-YjlnYKZKqxTS-y_Pe] +10s
2021-04-25T21:53:57.735Z f447908d cdg [info] microlink-api:requests 1 [vKA-YjlnYKZKqxTS-y_Pe] → 0 [] +4ms
2021-04-25T21:53:57.741Z f447908d cdg [info] microlink-api status=200 id=vKA-YjlnYKZKqxTS-y_Pe ip=::ffff:176.58.95.98 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=1.710ms +10s
2021-04-25T21:53:57.926Z 22b04695 lhr [info] { reqUrl: '/health' }
2021-04-25T21:53:57.928Z 22b04695 lhr [info] microlink-api:requests 0 [] → 1 [UQQ0JIyc1V5ftzUVOALyL] +10s
2021-04-25T21:53:57.930Z 22b04695 lhr [info] microlink-api:requests 1 [UQQ0JIyc1V5ftzUVOALyL] → 0 [] +1ms
2021-04-25T21:53:57.935Z 22b04695 lhr [info] microlink-api status=200 id=UQQ0JIyc1V5ftzUVOALyL ip=::ffff:185.40.232.114 query="ttl=86400000&prerender=auto&meta=true&data=false&video=false&audio=false&screenshot=false&pdf=false&insights=false&iframe=false&ping=true&timeout=28000&retry=2" size="195 B" duration=0.830ms +10s
so I suspect http check with custom port is not implemented yet?