frequency icon indicating copy to clipboard operation
frequency copied to clipboard

Add Heathcheck to Docker files

Open wilwade opened this issue 2 years ago • 2 comments

Docker supports a heathcheck https://docs.docker.com/engine/reference/builder/#healthcheck

We should use it with the rpc /health to know that the server is at least up.

Docker Files:

wilwade avatar Apr 13 '23 12:04 wilwade

Can I help with that?

signed-log avatar Apr 18 '23 15:04 signed-log

@signed-log Sure! Feel free to reach out if you have questions here or in the Frequency Discord

Added a the links to the different docker files

wilwade avatar Apr 18 '23 15:04 wilwade

Regarding health checks, the Frequency node /health endpoint returns the following JSON object:

{
  "peers": number,
  "isSyncing": boolean,
  "shouldHavePeers": boolean
}

When reporting health_status, Docker can report starting, healthy, unhealthy. It would be nice if we could, for instance, keep the container in a starting state while isSyncing = true, ie:

start period provides initialization time for containers that need time to bootstrap. Probe failure during that period will not be counted towards the maximum number of retries. However, if a health check succeeds during the start period, the container is considered started and all consecutive failures will be counted towards the maximum number of retries.

However, to do that we would need to be able to predict the maximum amount of time the container could be in a starting state and specify that as the start period, which seems a difficult proposition with node syncing.

For now, I think we'll just consider isSyncing = true as healthy, unless anyone has another suggestion.

Next:

Should we perform any tests on peers + shouldHavePeers? ie, if shouldHavePeers = true, would peers = 0 indicate an unhealthy state?

JoeCap08055 avatar Apr 10 '25 14:04 JoeCap08055

For now, I think we'll just consider isSyncing = true as healthy, unless anyone has another suggestion.

👍

Should we perform any tests on peers + shouldHavePeers? ie, if shouldHavePeers = true, would peers = 0 indicate an unhealthy state?

That is correct. Instant sealing and such could still have peers, but they are shouldHavePeers:false.

wilwade avatar Apr 10 '25 15:04 wilwade