Skip to content

Commit fc1b021

Browse files
Add DNS resolution verification for .dappnode domains in installer script
1 parent 1693b97 commit fc1b021

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

scripts/dappnode_install.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,34 @@ configure_host_dns_resolution() {
14001400
fi
14011401
}
14021402

1403+
# Verify that .dappnode domains can be resolved from the host after DNS setup.
1404+
# Retries a few times to allow DNS propagation, then logs a warning on failure.
1405+
verify_host_dns_resolution() {
1406+
if [[ "${RESOLVE_FROM_HOST}" != "true" ]]; then
1407+
return 0
1408+
fi
1409+
1410+
local domain="my.dappnode"
1411+
local max_retries=5
1412+
local sleep_seconds=3
1413+
local attempt
1414+
1415+
log "Verifying host DNS resolution for ${domain}..."
1416+
1417+
for ((attempt = 1; attempt <= max_retries; attempt++)); do
1418+
if getent hosts "$domain" >/dev/null 2>&1; then
1419+
log "DNS verification succeeded: ${domain} resolves correctly (attempt ${attempt}/${max_retries})"
1420+
return 0
1421+
fi
1422+
log "DNS verification attempt ${attempt}/${max_retries}: ${domain} not yet resolvable. Retrying in ${sleep_seconds}s..."
1423+
sleep "$sleep_seconds"
1424+
done
1425+
1426+
warn "DNS verification failed: ${domain} could not be resolved after ${max_retries} attempts."
1427+
warn "Host DNS resolution for .dappnode domains may not be working correctly."
1428+
warn "Ensure the BIND container is running and your DNS configuration is correct."
1429+
}
1430+
14031431
##############################################
14041432
#### SCRIPT START ####
14051433
##############################################
@@ -1469,6 +1497,7 @@ main() {
14691497
log "DAppNode installed"
14701498
dappnode_core_start
14711499
configure_host_dns_resolution
1500+
verify_host_dns_resolution
14721501
print_vpn_access_credentials
14731502
fi
14741503

0 commit comments

Comments
 (0)