Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add healthcheck command. #972

Closed
Ryland0 opened this issue May 30, 2021 · 7 comments
Closed

Add healthcheck command. #972

Ryland0 opened this issue May 30, 2021 · 7 comments

Comments

@Ryland0
Copy link

Ryland0 commented May 30, 2021

Is your feature request related to a problem? Please describe.
No problems.

Describe the solution you'd like
Add a healthcheck command to the image.

Describe alternatives you've considered
Not asking this question.

Additional context
Just curious if this has been discussed/considered.

@github-actions
Copy link

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

@piksel
Copy link
Member

piksel commented Jun 2, 2021

@stale
Copy link

stale bot commented Aug 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale label Aug 21, 2021
@simskij
Copy link
Member

simskij commented Aug 28, 2021

@piksel and I have been discussing this previously, and came to the conclusion that we don't really know what a healthcheck would even do in the watchtower case.

As watchtower runs on a scratch image, it means that watchtower crashing/not working will make the container exit and restart. Any suggestions?

@stale stale bot removed the Status: Stale label Aug 28, 2021
@simskij simskij closed this as completed Feb 20, 2022
@simskij
Copy link
Member

simskij commented Feb 20, 2022

No takers, so closing this.

@aehlke
Copy link

aehlke commented Mar 13, 2022

record exit codes from last runs (tmp files?), report latest as health check to catch scenarios such as lifecycle hooks failing

@PiDroid-B
Copy link

PiDroid-B commented Mar 24, 2022

maybe something like that :

healthcheck.sh

#!/bin/sh

PERIOD_12H=43200

MAX_DELAY=$(( PERIOD_12H + 60 ))

# delay since last loop (seconds)
DELAY=$(($(date +%s) - $(date +%s -r /tmp/last_loop)))

[ "${DELAY}" -gt "${MAX_DELAY}" ] && exit 1

exit 0

And for the dockerfile :
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD sh healthcheck.sh

it's just an example to improve and adjust with env var. The watchtower job has just to make a touch on the file to update it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants