Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duckdns: add service #559

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .templates/duckdns/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
duckdns:
container_name: duckdns
build: https://github.com/ukkopahis/docker-duckdns.git
network_mode: host
restart: unless-stopped
environment:
PUID: 1000
PGID: 1000
# Required variables, define here on in docker-compose.override.yml
#TOKEN: token from duckdns.org
#SUBDOMAINS: your domain added to duckdns.org (without .duckdns.org)
# Optional
#PRIVATE_SUBDOMAINS: your domain added to duckdns.org (without .duckdns.org)
18 changes: 15 additions & 3 deletions docs/Basic_setup/Accessing-your-Device-from-the-internet.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,23 @@ If you have the choice, your router is to be preferred. That's because your rout

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.

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.
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.

> 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.
### DuckDNS container

### DuckDNS client
The recommended and easiest solution is to install the Duckdns docker-container
from the menu. It includes the cron service and logs are handled by Docker.

For configuration see [Containers/Duck DNS]( ../Containers/Duckdns.md).

!!! note
This is a recently added container, please don't hesitate to report any
possible faults to Discord or as Github issues.

### DuckDNS client script { #duckdns-client }

!!! info
This method will soon be deprecated in favor of the DuckDNS container.

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

Expand Down
84 changes: 84 additions & 0 deletions docs/Containers/Duckdns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Duck DNS

Duckdns is a free public DNS service that provides you with a domain name you
can update to match your dynamic IP-address.

This container automates the process to keep the duckdns.org domain updated
when your IP-address changes.

## Configuration

First, register an account, add your subdomain and get your token from
[http://www.duckdns.org/](http://www.duckdns.org/)

Either edit `~/IOTstack/docker-compose.yml` or create a file
`~/IOTstack/docker-compose.override.yml`. Place your Duckdns token and
subdomain name (without .duckdns.org) there:

``` yaml title="docker-compose.override.yml"
version: '3.6'
services:
duckdns:
environment:
TOKEN: your-duckdns-token
SUBDOMAINS: subdomain
```

Observe that at least the initial update is successful:

``` console
$ cd ~/IOTstack
$ docker-compose up -d duckdns
$ docker-compose logs -f duckdns
...SNIP...
duckdns | Sat May 21 11:01:00 UTC 2022: Your IP was updated
...SNIP...
(ctrl-c to stop following the log)
```

If there is a problem, check that the resulting effective configuration of
'duckdns:' looks OK:
``` console
$ cd ~/IOTstack && docker-compose config
```

### Domain name for the private IP

!!! note inline end "Example public/private IP:s and domains"

``` mermaid
flowchart
I([Internet])
G("Router\npublic IP: 52.85.51.71\nsubdomain.duckdns.org")
R(Raspberry pi\nprivate IP: 192.168.0.100\nprivate_subdomain.duckdns.org)
I --- |ISP| G --- |LAN| R
```

As a public DNS server, Duckdns is not meant to be used for private IPs. It's
recommended that for resolving internal LAN IPs you use the [Pi
Hole](Pi-hole.md) container or run a dedicated DNS server.

That said, it's possible to update a Duckdns subdomain to your private LAN IP.
This may be convenient if you have devices that don't support mDNS (.local) or
don't want to run Pi-hole. This is especially useful if you can't assign a
static IP to your RPi. No changes to your DNS resolver settings are needed.

First, as for the public subdomain, add the domain name to your Duckdns account
by logging in from their homepage. Then add a `PRIVATE_SUBDOMAINS` variable
indicating this subdomain:

``` yaml
version: '3.6'
services:
duckdns:
environment:
TOKEN: ...
SUBDOMAINS: ...
PRIVATE_SUBDOMAINS: private_subdomain
```

## References

* uses ukkopahis' [fork](https://github.com/ukkopahis/docker-duckdns) based on
the linuxserver
[docker-duckdns](https://github.com/linuxserver/docker-duckdns) container
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extra_javascript:
- javascript/fix-codeblock-console-copy-button.js

markdown_extensions:
- attr_list
- pymdownx.highlight:
pygments_lang_class: true
- admonition
Expand Down
8 changes: 4 additions & 4 deletions requirements-mkdocs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Jinja2==3.0.3
Markdown==3.3.6
MarkupSafe==2.1.0
mergedeep==1.3.4
mkdocs==1.2.3
mkdocs==1.3.0
mkdocs-awesome-pages-plugin==2.7.0
mkdocs-material==8.2.3
mkdocs-material==8.2.13
mkdocs-material-extensions==1.0.3
mkdocs-redirects==1.0.3
packaging==21.3
Pygments==2.11.2
pymdown-extensions==9.2
Pygments==2.12.0
pymdown-extensions==9.4
pyparsing==3.0.7
python-dateutil==2.8.2
PyYAML==6.0
Expand Down