AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

Dockerfile does not have health check

Open agneevX opened this issue 3 years ago • 8 comments

Continuation of #1426

There's no health check for Docker images.

This is how Pi-hole does it:

HEALTHCHECK CMD dig +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1

agneevX avatar Jun 28 '21 07:06 agneevX

Using curl for web UI:

HEALTHCHECK CMD curl -fs http://localhost:3000 -o /dev/null || exit 1

agneevX avatar Jun 28 '21 07:06 agneevX

Unfortunately, it's not that straightforward. AGH's initial HTTP API port is 3000, but the user can change it. In fact, the port that we currently propose by default is 80. And people can change it in the config file. We could include some sort of a script that would read the config file and use that value, but definitely not in this release cycle.

ainar-g avatar Jun 28 '21 12:06 ainar-g

I have used following healthcheck in my compose file. Port 53 is most important for me (as I am not using DoH).

healthcheck:
  test: "/bin/netstat -pant | /bin/grep 53"
  interval: 45s
  timeout: 30s
  retries: 3

sachinwadhwa avatar Jun 28 '21 13:06 sachinwadhwa

DNS server is not working until the initial setup is finished

ameshkov avatar Jul 05 '21 11:07 ameshkov

Seems like a separate script is needed to accomplish this.

agneevX avatar Jul 12 '21 15:07 agneevX

I made something to do exactly that. Checks for the Setup to be done and if so, which port is configured for bind_port.

https://github.com/lolgast1987/adguard-unbound/blob/master/files/healthcheck.sh

lolgast1987 avatar Aug 03 '21 18:08 lolgast1987

Can we at least accept to use maybe 53 port with nslookup or dig to do a basic health check? I'd like to send a pull request for it if it's acceptable. We could have some further improvement later, when the more complete and complex idea came up?

PeterDaveHello avatar Sep 07 '22 16:09 PeterDaveHello

My current healthcheck config using docker-compose:

https://github.com/PeterDaveHello/dnslow.me/blob/master/docker-compose.yml#L9-L14

healthcheck:
  test: nslookup www.google.com || exit 1
  timeout: 5s
  interval: 60s
  start_period: 10s
  retries: 1

PeterDaveHello avatar Sep 07 '22 16:09 PeterDaveHello