Skip to content

Commit cfa6ddb

Browse files
Update installer script to support .dappnode.private domain resolution
1 parent 6e48df8 commit cfa6ddb

1 file changed

Lines changed: 25 additions & 28 deletions

File tree

scripts/dappnode_install.sh

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ Options:
9191
--minimal Install only BIND DAPPMANAGER NOTIFICATIONS PREMIUM (equivalent: MINIMAL=true)
9292
--lite Install reduced package set: BIND VPN WIREGUARD DAPPMANAGER NOTIFICATIONS PREMIUM (equivalent: LITE=true)
9393
--packages <list> Override package selection (comma or space separated), e.g. BIND,IPFS,VPN
94-
--resolve-from-host Configure host DNS to resolve .dappnode domains (Linux only) (equivalent: RESOLVE_FROM_HOST=true)
94+
--resolve-from-host Configure host DNS to resolve .dappnode.private domains (Linux only) (equivalent: RESOLVE_FROM_HOST=true)
9595
-h, --help Show this help
9696
9797
Environment variables (also supported):
98-
UPDATE, STATIC_IP, LOCAL_PROFILE_PATH, IPFS_ENDPOINT, PROFILE_URL, MINIMAL, LITE, PACKAGES, RESOLVE_FROM_HOST
98+
UPDATE, STATIC_IP, LOCAL_PROFILE_PATH, IPFS_ENDPOINT, PROFILE_URL, MINIMAL, LITE, PACKAGES, RESOLVE_FROM_HOST
9999
EOF
100100
}
101101

@@ -1105,7 +1105,9 @@ addUserToDockerGroup() {
11051105
##############################
11061106

11071107
# Install systemd service + timer that configures split DNS via resolvectl
1108-
# for .dappnode domains on the dncore_network (and dnprivate_network) bridge interfaces.
1108+
# for .dappnode.private domains on the dnprivate_network bridge interface.
1109+
# CAUTION: when doing same configuration for dnprivate_network, the dappmanager
1110+
# node app container internet connectivity is broken for an unknown reason.
11091111
setup_resolved_dns() {
11101112
local script_path="/usr/local/bin/dappnode-dns.sh"
11111113
local service_path="/etc/systemd/system/dappnode-dns.service"
@@ -1223,29 +1225,13 @@ main() {
12231225
12241226
preflight
12251227
1226-
local core_exists=false
1227-
local private_exists=false
1228-
1229-
network_exists "dncore_network" && core_exists=true
1230-
network_exists "dnprivate_network" && private_exists=true
1231-
1232-
# If no DAppNode networks exist, nothing to do.
1233-
# Cleanup is handled by the DAppNode uninstall script.
1234-
if [[ "$core_exists" == false && "$private_exists" == false ]]; then
1235-
log_warn "No DAppNode networks found. Nothing to configure."
1228+
if ! network_exists "dnprivate_network"; then
1229+
log_warn "dnprivate_network not found. Nothing to configure."
12361230
exit 0
12371231
fi
12381232
1239-
if $core_exists; then
1240-
if core_iface=$(get_bridge_with_retry "dncore_network"); then
1241-
apply_dns "$core_iface" "172.33.1.2" "~dappnode"
1242-
fi
1243-
fi
1244-
1245-
if $private_exists; then
1246-
if private_iface=$(get_bridge_with_retry "dnprivate_network"); then
1247-
apply_dns "$private_iface" "10.20.0.2" "~dappnode.private"
1248-
fi
1233+
if private_iface=$(get_bridge_with_retry "dnprivate_network"); then
1234+
apply_dns "$private_iface" "10.20.0.2" "~dappnode.private"
12491235
fi
12501236
12511237
log_info "===== dappnode-dns.sh finished ====="
@@ -1273,6 +1259,7 @@ SVCEOF
12731259
Description=Run DAppNode DNS periodically
12741260
12751261
[Timer]
1262+
Unit=dappnode-dns.service
12761263
OnBootSec=30
12771264
OnUnitActiveSec=60
12781265
Persistent=true
@@ -1283,9 +1270,10 @@ TMREOF
12831270

12841271
systemctl daemon-reload
12851272
systemctl enable dappnode-dns.timer
1273+
systemctl start dappnode-dns.service
12861274
systemctl start dappnode-dns.timer
12871275

1288-
log "systemd-resolved DNS setup complete (service + timer installed)"
1276+
log "systemd-resolved DNS setup complete (service + timer installed; initial run executed; interval=60s)"
12891277
}
12901278

12911279
# Install and configure dnsmasq for split DNS on systems using classic /etc/resolv.conf.
@@ -1310,8 +1298,8 @@ setup_dnsmasq_dns() {
13101298
# DAppNode DNS routing (split DNS)
13111299
########################################
13121300
1313-
# Route all *.dappnode domains to the DAppNode BIND container
1314-
server=/dappnode/172.33.1.2
1301+
# Route all *.dappnode.private domains to the DAppNode private DNS
1302+
server=/dappnode.private/10.20.0.2
13151303
13161304
########################################
13171305
# Upstream DNS (fallback)
@@ -1407,7 +1395,7 @@ verify_host_dns_resolution() {
14071395
return 0
14081396
fi
14091397

1410-
local domain="my.dappnode"
1398+
local domain="my.dappnode.private"
14111399
local max_retries=20
14121400
local sleep_seconds=3
14131401
local attempt
@@ -1417,14 +1405,23 @@ verify_host_dns_resolution() {
14171405
for ((attempt = 1; attempt <= max_retries; attempt++)); do
14181406
if getent hosts "$domain" >/dev/null 2>&1; then
14191407
log "DNS verification succeeded: ${domain} resolves correctly (attempt ${attempt}/${max_retries})"
1408+
log ""
1409+
log "##############################################"
1410+
log "# DAppNode is accessible from host! #"
1411+
log "##############################################"
1412+
log ""
1413+
log "You can now access the DAppNode UI directly from this machine at:"
1414+
log ""
1415+
log " http://${domain}"
1416+
log ""
14201417
return 0
14211418
fi
14221419
log "DNS verification attempt ${attempt}/${max_retries}: ${domain} not yet resolvable. Retrying in ${sleep_seconds}s..."
14231420
sleep "$sleep_seconds"
14241421
done
14251422

14261423
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."
1424+
warn "Host DNS resolution for .dappnode.private domains may not be working correctly."
14281425
warn "Ensure the BIND container is running and your DNS configuration is correct."
14291426
}
14301427

0 commit comments

Comments
 (0)