hassio-addons / addon-adguard-home

AdGuard Home - Home Assistant Community Add-ons
https://addons.community
MIT License
378 stars 47 forks source link

Docker HEALTHCHECK doesn't test DNS resolution #378

Closed grischard closed 1 year ago

grischard commented 1 year ago

Problem/Motivation

The watchdog configuration in the Dockerfile doesn't actually test for DNS resolution

Expected behavior

Functionality of the add-on is tested - this means both the web interface and dns resolution

Actual behavior

The HEALTHCHECK line in the Dockerfile only tests if the basic web interface is running:

HEALTHCHECK CMD curl --fail http://127.0.0.1:45158 || exit 1

Steps to reproduce

Break your adguard in a way that breaks dns resolution and could be fixed by a restart, for example corrupt databases like in #367. Watch how the watchdog doesn't restart adguard.

Proposed changes

A watchdog shell script that tests both the web interface and dns resolution would be useful. The fault would have to appear in the logs, to make it obvious to users with broken dns configs that they need to disable the watchdog to fix their setup - otherwise the watchdog will keep killing the web interface for them.

frenck commented 1 year ago

The watchdog configuration in the Dockerfile doesn't actually test for DNS resolution

That is correct. The Supervisor watchdog (leveraging the Docker health checks) checks if the add-on is running (not its internal working).

Let's say you use an upstream DNS server that goes offline. Healthcheck fails, and HA keeps restarting it? How would you change the settings?

I think you are confused with the regular Docker way. This is not a bare Docker ecosystem.

../Frenck

grischard commented 1 year ago

Let's say you use an upstream DNS server that goes offline. Healthcheck fails, and HA keeps restarting it? How would you change the settings?

I'd disable the watchdog.

frenck commented 1 year ago

Cool 👍 Doesn't change a thing.