Skip to content

Commit 1ce33f1

Browse files
committed
duckdns: add service
This container includes cron and should be easier to use than the current duck.sh script. After a test period this should completely replace the current ./duck/duck.sh script. Currently uses my fork of linuxserver/docker-duckdns to include some features that are pending upstream pull-requests. Mkdocs and material versions updated to fix layout bug.
1 parent 732889a commit 1ce33f1

File tree

5 files changed

+117
-7
lines changed

5 files changed

+117
-7
lines changed

.templates/duckdns/service.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
duckdns:
2+
container_name: duckdns
3+
build: https://github.com/ukkopahis/docker-duckdns.git
4+
network_mode: host
5+
restart: unless-stopped
6+
environment:
7+
PUID: 1000
8+
PGID: 1000
9+
# Required variables, define here on in docker-compose.override.yml
10+
#TOKEN: token from duckdns.org
11+
#SUBDOMAINS: your domain added to duckdns.org (without .duckdns.org)
12+
# Optional
13+
#PRIVATE_SUBDOMAINS: your domain added to duckdns.org (without .duckdns.org)

docs/Basic_setup/Accessing-your-Device-from-the-internet.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@ If you have the choice, your router is to be preferred. That's because your rout
3535

3636
Nevertheless, your router may not support the Dynamic DNS service provider you wish to use, or may come with constraints that you find unsatisfactory so any behind-the-router technique is always a viable option, providing you understand its limitations.
3737

38-
A behind-the-router technique usually relies on sending updates according to a schedule. An example is a `cron` job that runs every five minutes. That means any router WAN IP address changes won't be propagated until the next scheduled update. In the event of network interruptions or service provider outages, it may take some time before everything is back in sync. Moreover, given that WAN IP address changes are infrequent events, most scheduled updates will be sending information unnecessarily, contributing unnecessarily to server load.
38+
A behind-the-router technique usually relies on sending updates according to a schedule. An example is a `cron` job that runs every five minutes. That means any router WAN IP address changes won't be propagated until the next scheduled update. In the event of network interruptions or service provider outages, it may take close to ten minutes before everything is back in sync. Moreover, given that WAN IP address changes are infrequent events, most scheduled updates will be sending information unnecessarily.
3939

40-
> This seems to be a problem for DuckDNS which takes a beating because almost every person using it is sending an update bang-on five minutes.
40+
### DuckDNS container
4141

42-
### DuckDNS client
42+
The recommended and easiest solution is to install the Duckdns docker-container
43+
from the menu. It includes the cron service and logs are handled by Docker.
44+
45+
For configuration see [Containers/Duck DNS]( ../Containers/Duckdns.md).
46+
47+
!!! note
48+
This is a recently added container, please don't hesitate to report any
49+
possible faults to Discord or as Github issues.
50+
51+
### DuckDNS client script { #duckdns-client }
52+
53+
!!! info
54+
This method will soon be deprecated in favor of the DuckDNS container.
4355

4456
IOTstack provides a solution for DuckDNS. The best approach to running it is:
4557

docs/Containers/Duckdns.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Duck DNS
2+
3+
Duckdns is a free public DNS service that provides you with a domain name you
4+
can update to match your dynamic IP-address.
5+
6+
This container automates the process to keep the duckdns.org domain updated
7+
when your IP-address changes.
8+
9+
## Configuration
10+
11+
First, register an account, add your subdomain and get your token from
12+
[http://www.duckdns.org/](http://www.duckdns.org/)
13+
14+
Either edit `~/IOTstack/docker-compose.yml` or create a file
15+
`~/IOTstack/docker-compose.override.yml`. Place your Duckdns token and
16+
subdomain name (without .duckdns.org) there:
17+
18+
``` yaml title="docker-compose.override.yml"
19+
version: '3.6'
20+
services:
21+
duckdns:
22+
environment:
23+
TOKEN: your-duckdns-token
24+
SUBDOMAINS: subdomain
25+
```
26+
27+
Observe that at least the initial update is successful:
28+
29+
``` console
30+
$ cd ~/IOTstack
31+
$ docker-compose up -d duckdns
32+
$ docker-compose logs -f duckdns
33+
...SNIP...
34+
duckdns | Sat May 21 11:01:00 UTC 2022: Your IP was updated
35+
...SNIP...
36+
(ctrl-c to stop following the log)
37+
```
38+
39+
If there is a problem, check that the resulting effective configuration of
40+
'duckdns:' looks OK:
41+
``` console
42+
$ cd ~/IOTstack && docker-compose config
43+
```
44+
45+
### Domain name for the private IP
46+
47+
!!! note inline end "Example public/private IP:s and domains"
48+
49+
``` mermaid
50+
flowchart
51+
I([Internet])
52+
G("Router\npublic IP: 52.85.51.71\nsubdomain.duckdns.org")
53+
R(Raspberry pi\nprivate IP: 192.168.0.100\nprivate_subdomain.duckdns.org)
54+
I --- |ISP| G --- |LAN| R
55+
```
56+
57+
As a public DNS server, Duckdns is not meant to be used for private IPs. It's
58+
recommended that for resolving internal LAN IPs you use the [Pi
59+
Hole](Pi-hole.md) container or run a dedicated DNS server.
60+
61+
That said, it's possible to update a Duckdns subdomain to your private LAN IP.
62+
This may be convenient if you have devices that don't support mDNS (.local) or
63+
don't want to run Pi-hole. This is especially useful if you can't assign a
64+
static IP to your RPi. No changes to your DNS resolver settings are needed.
65+
66+
First, as for the public subdomain, add the domain name to your Duckdns account
67+
by logging in from their homepage. Then add a `PRIVATE_SUBDOMAINS` variable
68+
indicating this subdomain:
69+
70+
``` yaml
71+
version: '3.6'
72+
services:
73+
duckdns:
74+
environment:
75+
TOKEN: ...
76+
SUBDOMAINS: ...
77+
PRIVATE_SUBDOMAINS: private_subdomain
78+
```
79+
80+
## References
81+
82+
* uses ukkopahis' [fork](https://github.com/ukkopahis/docker-duckdns) based on
83+
the linuxserver
84+
[docker-duckdns](https://github.com/linuxserver/docker-duckdns) container

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ extra_javascript:
6161
- javascript/fix-codeblock-console-copy-button.js
6262

6363
markdown_extensions:
64+
- attr_list
6465
- pymdownx.highlight:
6566
pygments_lang_class: true
6667
- admonition

requirements-mkdocs.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Jinja2==3.0.3
66
Markdown==3.3.6
77
MarkupSafe==2.1.0
88
mergedeep==1.3.4
9-
mkdocs==1.2.3
9+
mkdocs==1.3.0
1010
mkdocs-awesome-pages-plugin==2.7.0
11-
mkdocs-material==8.2.3
11+
mkdocs-material==8.2.13
1212
mkdocs-material-extensions==1.0.3
1313
mkdocs-redirects==1.0.3
1414
packaging==21.3
15-
Pygments==2.11.2
16-
pymdown-extensions==9.2
15+
Pygments==2.12.0
16+
pymdown-extensions==9.4
1717
pyparsing==3.0.7
1818
python-dateutil==2.8.2
1919
PyYAML==6.0

0 commit comments

Comments
 (0)