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

[FEAT] Docker container health check #381

Closed
YeapGuy opened this issue Oct 12, 2022 · 5 comments
Closed

[FEAT] Docker container health check #381

YeapGuy opened this issue Oct 12, 2022 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@YeapGuy
Copy link

YeapGuy commented Oct 12, 2022

Is your feature request related to a problem? Please describe.
Nope, no problems. Just a pretty useful simple thing that can help when troubleshooting or monitoring container status. Docker has container health checking system: official docs. And since the docs are pretty technical, here's a random article I found about it, in case anyone reading is not familiar: Medium article.

In a nutshell, it allows for native Docker monitoring of container status - for example, if the Scrutiny web service errors out, but it keeps running, the container will still show as "up, running". If HEALTHCHECK is implemented, it will show as "unhealthy", which allows users to notice really quick something is wrong when looking at docker ps or Portainer/alternative GUI.

Describe the solution you'd like
Implement HEALTHCHECK in the Dockerfile. It's pretty darn simple, I can implement it and PR if you want, but I'm not familiar with Scrutiny architecture - I'm just a user for now ;) - so it might be better that someone who worked on Scrutiny before adds it, so it accounts for all possible cases of failure (including InfluxDB failing, API failing etc.).

@AnalogJ
Copy link
Owner

AnalogJ commented Oct 13, 2022

This is a great idea, and for some reason I thought it was already implemented but I took a look at the /health endpoint and its full of TODO's 😭

If you'd be willing to open a PR, I'd be happy to merge it.

https://github.com/AnalogJ/scrutiny/blob/master/webapp/backend/pkg/web/server.go#L37-L45

@AnalogJ AnalogJ added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 13, 2022
@YeapGuy
Copy link
Author

YeapGuy commented Oct 13, 2022

Unfortunately, I'm not familiar with Go, so I can't improve the health endpoint. I'll make a PR for the health check itself later today. 😀

AnalogJ added a commit that referenced this issue Nov 30, 2022
@AnalogJ
Copy link
Owner

AnalogJ commented Nov 30, 2022

the healthcheck endpoint has now been updated to validate sqlite and influxdb status. I havent added the HEALTHCHECK instructions to the Dockerfiles yet though.

@AnalogJ AnalogJ added the enhancement New feature or request label Nov 30, 2022
@joe-eklund
Copy link

So I have added a healthcheck section to my docker compose file for Scrutiny Web in the form of

    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
      interval: 5s
      timeout: 10s
      retries: 20
      start_period: 10s

and similarly for InfluxDB. Is there something that makes sense that I could add as a healthcheck for the collector container?

@AnalogJ
Copy link
Owner

AnalogJ commented Apr 8, 2023

thats great @joe-eklund I'll try to integrate your change into the Dockerfiles.

Regarding a healthcheck for the collector, we'd probably just want to validate that the cron daemon is running. If you'd be willing to look into that, it'd be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

3 participants