PhasecoreX/docker-red-discordbot

Included network tools for health monitoring

r-vd-woude opened this issue · 2 comments

Hello, thanks for the awesome container, use it almost daily!

I was wondering if you could include a package like "curl" or "netcat" in the image?
That way we can write a healthcheck to start the container up again when it loses connectivity.
I'm using the container with the network_mode being another container, so if that container restarts, Red will loose connectivity, and not restart.
With something like "curl", we could included a simple healthcheck like "curl -sf https://example.com || exit 1" and restart the container.

I know it is probably a niche cace.

Can you use something like what I did for the dashboard image instead of curl/wget/netcat?

https://github.com/PhasecoreX/docker-red-dashboard/blob/f1fbf74177c792e9fa0d5bb660f91561fd83920d/Dockerfile#L14

You could use /dev/tcp/8.8.8.8/53 if you needed it to test connectivity to the internet, or the container name of the container that you are networked to, assuming it has a service running inside on a port, if you want to test connectivity to it.

I don't really want to add more stuff to the image unless Redbot itself is actually using it.

@PhasecoreX
Thank you, that worked!
For future reference (if other people need this), this is what I added in my compose file:

    healthcheck:
      test: ["CMD", "bash", "-c", "echo > /dev/tcp/1.1.1.1/53"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 120s