diff --git a/.templates/duckdns/service.yml b/.templates/duckdns/service.yml new file mode 100644 index 00000000..d8775bc4 --- /dev/null +++ b/.templates/duckdns/service.yml @@ -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) diff --git a/docs/Basic_setup/Accessing-your-Device-from-the-internet.md b/docs/Basic_setup/Accessing-your-Device-from-the-internet.md index 945afac7..99bfa1cb 100644 --- a/docs/Basic_setup/Accessing-your-Device-from-the-internet.md +++ b/docs/Basic_setup/Accessing-your-Device-from-the-internet.md @@ -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: diff --git a/docs/Containers/Duckdns.md b/docs/Containers/Duckdns.md new file mode 100644 index 00000000..a3859a55 --- /dev/null +++ b/docs/Containers/Duckdns.md @@ -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 diff --git a/mkdocs.yml b/mkdocs.yml index 9a4ba449..48ab4c85 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,6 +61,7 @@ extra_javascript: - javascript/fix-codeblock-console-copy-button.js markdown_extensions: + - attr_list - pymdownx.highlight: pygments_lang_class: true - admonition diff --git a/requirements-mkdocs.txt b/requirements-mkdocs.txt index 11c6c2c7..fbc46101 100644 --- a/requirements-mkdocs.txt +++ b/requirements-mkdocs.txt @@ -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