Add Heathcheck to Docker files
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:
- [ ] Standalone Local Node: https://github.com/LibertyDSNP/frequency/blob/main/docker/standalone-node.dockerfile
- [ ] Used for the Frequency Mainnet and Rococo nodes: https://github.com/LibertyDSNP/frequency/blob/main/docker/parachain-node.dockerfile
- [ ] Simple Relay chain for testing: https://github.com/LibertyDSNP/frequency/blob/main/docker/collator-node-local.dockerfile
Can I help with that?
@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
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 periodprovides 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?
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.