Skip to content

Commit

Permalink
duckdns: add service
Browse files Browse the repository at this point in the history
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.

Depends on SensorsIot#553 to generate .env with IOTSTACK_UID and IOTSTACK_GID

Mkdocs and material versions updated to fix layout bug.
  • Loading branch information
ukkopahis committed May 4, 2022
1 parent 732889a commit c86a935
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .templates/duckdns/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
duckdns:
container_name: duckdns
build: https://github.com/ukkopahis/docker-duckdns.git
network_mode: host
restart: unless-stopped
environment:
PUID: ${IOTSTACK_UID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
PGID: ${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
#TOKEN: define this in docker-compose.override.yml, see docs
#SUBDOMAIN: define this in docker-compose.override.yml, see docs
11 changes: 10 additions & 1 deletion docs/Basic_setup/Accessing-your-Device-from-the-internet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ A behind-the-router technique usually relies on sending updates according to a s

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

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

### DuckDNS client script (DEPRECATED) { #duckdns-client }

!!! warning "This method is now deprecated"

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

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

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

This container automates the process to update your duckdns.org IP.

## References

* Register an account, add your subdomain and get your token from
[http://www.duckdns.org/](http://www.duckdns.org/)
* based on the linuxserver
[docker-duckdns](https://github.com/linuxserver/docker-duckdns) container

## Configuration

Create the file `~/IOTstack/docker-compose.override.yml` and place your Duckdns
token and chosen domain name 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 duckdns
...SNIP...
Retrieving subdomain and token from the environment variables
log will be output to docker log
Your IP was updated at Wed May 4 03:31:14 UTC 2022
...SNIP...
```

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

That said, it's possible to update Duckdns with to your LAN IP. This may be
convenient if you have devices that don't support mDNS (.local) and don't want
to run Pi-hole. This is especially useful if you can't assign a static IP to
your RPi. Add a `PRIVATE_SUBDOMAIN` variable indicating your subdomain for
this:

``` yaml title="added variable to docker-compose.override.yml"
version: '3.6'
services:
duckdns:
environment:
TOKEN: ...
SUBDOMAINS: ...
PRIVATE_SUBDOMAIN: private_subdomain
```
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

0 comments on commit c86a935

Please sign in to comment.