Add healthcheck - #71
Conversation
extended the ping check that creates a /tmp/healthy file if ping successfull and removes that file if ping failes 3 times. With this you can add the following to the newt docker compose to do the health check: healthcheck: test: ["CMD-SHELL", "test -f /tmp/healthy"] interval: 30s timeout: 10s retries: 3
added healthy check in main.go extended the ping check that creates a /tmp/healthy file if ping successfull and removes that file if ping failes 3 times. With this you can add the following to the newt docker compose to do the health check: healthcheck: test: ["CMD-SHELL", "test -f /tmp/healthy"] interval: 30s timeout: 10s retries: 3
|
@oschwartz10612 , is this the correct way to suggest an improvement? |
|
Hi! Yes this is great thank you! I like the approach I think. I would suggest though that we make the file location configurable with a CLI and ENV var so it is not hardcoded to write on to people's systems. I would make it opt in meaning that it should not write the file unless the cli arg is provided telling it where. I think in the current form it would also fail on Windows as there is no /tmp dir. |
Added cli and env function
fixed some errors, This file should be ok.
synced with dev
|
I added the suggested changes. |
… woutervanelten-add-healthcheck
|
Thanks! |
|
Could be great to update the documentation with this new feature. Thanks for implementing this! |
I did a pull request to pull the updated readme. add HEALT_FILE=*** to your env. And add the following to the docker compose: |
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
Expanded the code to write a /tmp/healthy file if ping is successfull.
Removes the /tmp/healthy file if ping failes 3 times.
How to test?
add the following to docker-compose to have healthcheck.