Skip to content

Commit 5f9e044

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 needed pull-requests that are pending upstream pull-requests. Depends on #553 to generate .env with IOTSTACK_UID and IOTSTACK_GID Mkdocs and material versions updated to fix layout bug.
1 parent 732889a commit 5f9e044

File tree

5 files changed

+113
-7
lines changed

5 files changed

+113
-7
lines changed

.templates/duckdns/service.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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: ${IOTSTACK_UID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
8+
PGID: ${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
9+
#TOKEN: define this in docker-compose.override.yml, see docs
10+
#SUBDOMAIN: define this in docker-compose.override.yml, see docs

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

+16-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,24 @@ 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 and then removed in favor of the
55+
DuckDNS container.
4356

4457
IOTstack provides a solution for DuckDNS. The best approach to running it is:
4558

docs/Containers/Duckdns.md

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

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)