tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

open up healthcheck to other IPs

Open gregzuro opened this issue 4 years ago • 5 comments

Seem like /healthcheck is limited by IP and that setting isn't exposed to any config method.

Can this be made configurable (https://github.com/meeb/tubesync/blob/c1cb19259e18a03550be04624c5ea6ab1e789f97/tubesync/tubesync/settings.py#L131)?

gregzuro avatar Oct 04 '21 20:10 gregzuro

The healthcheck is used internally by the Docker HEALTHCHECK and is automatically monitorited so you get the (healthy) container state in Docker. As it's monitored in-container there wasn't any reason to give any other IPs access to it. There probably isn't much use in additionally monitoring this externally as well, you can check the Docker state if you need to check the container health. What use case would you need to have additional monitoring for?

meeb avatar Oct 05 '21 02:10 meeb

So that my monitoring system can know that the service is healthy.

(It has no way to query the docker health from a remote location. )

gregzuro avatar Oct 05 '21 22:10 gregzuro

I can allow other IPs to access the healthcheck, however it really is designed just for in-container health monitoring. The best way to monitor container health would be from Docker or whatever container runtime you're using. There are REST APIs you can query as well as you could probably use something like Portainer with its API to get container health (not that I've looked). The container will be automatically restarted if the healthcheck fails which is the point of its implementation.

In terms of remote service uptime monitoring the only difference between remotely monitoring the /healthcheck URI and the index page / URI is that the /healthcheck URI creates only one SQL query so in the interim while I consider the issue just monitoring / for a 200/OK response will also accomplish what you want.

meeb avatar Oct 06 '21 02:10 meeb

Monitoring / is what I'm doing ATM, but I find that tubesync often 'stalls' for whatever reason - where / works fine, but it's not doing what it should. But that's another issue.

I'm running tubesync with docker compose within an LXC container that could be running on any of a dozen different physical hosts.

I'm not aware of an easy way to get the health from docker in this scenario.

If you have any insight into this, I'd appreciate hearing.

gregzuro avatar Oct 07 '21 21:10 gregzuro

The background workers pausing is a known issue that's next to be fixed. Healthcheck monitoring currently doesn't report the worker not working, unfortunately.

meeb avatar Oct 08 '21 03:10 meeb

Just leaning up some old issues. You can override this easily in the container by setting TUBESYNC_HEALTHCHECK_ALLOWED_IPS, e.g. TUBESYNC_HEALTHCHECK_ALLOWED_IPS=127.0.0.1,1.2.3.4. Always make sure you have 127.0.0.1 in the comma separated list or the container healthcheck will fail.

meeb avatar Mar 24 '23 02:03 meeb