redlib icon indicating copy to clipboard operation
redlib copied to clipboard

🐛 Bug Report: Redlib behind Traefik doesn't show up right away

Open IAM-marco opened this issue 1 year ago • 1 comments

Describe the bug

When Redlib is run behind Traefik reverse proxy, it is not detected by Traefik right away, hence it is unavailable. This happens because the Dockerfile (https://github.com/redlib-org/redlib/blob/22910956dbce2a4c8abae0016ecda251b268332c/Dockerfile#L34) sets a HEALTHCHECK directive. Traefik waits for the container to return a healthy status check before detecting it.

This issue was already highlighted in https://github.com/IgnisDa/ryot/issues/543#issuecomment-1961048539

The solution is either:

  • Removing the healthcheck directive in the Dockerfile OR
  • Setting a lower interval in the docker-compose file (and informing the users about it)

I went for the second option as a workaround:

    healthcheck:
      interval: 30s

IAM-marco avatar Mar 03 '24 17:03 IAM-marco

To me, problems come when using a reverse proxy, since the image healthcheck seems to not work well with traefik because of the healthcheck nature in the Dockerfile because depending on your setup you might not run the redlib instance in localhost and also in traefik when it handles the local service and redirects to the secure DNS entry, (i.e. https://redlib.local.example.com)

https://github.com/redlib-org/redlib/blob/22910956dbce2a4c8abae0016ecda251b268332c/Dockerfile#L34

I tested the container without traefik and it worked as expected, then I came up with the idea of disabling healthcheck in my docker-compose.yaml this way:

healthcheck:
  disable: true

After doing so, it seems to work fine. I'm not an expert, might be an issue with my set up but it worked for me so I'm sharing for anyone who might run into the same problem.

I suggest leaving the healthcheck to be managed by the user at docker-compose.yaml instead of hard coding it on the Dockerfile.

vanhyr avatar Apr 29 '24 21:04 vanhyr