diff --git a/.templates/duckdns/service.yml b/.templates/duckdns/service.yml new file mode 100644 index 000000000..9296b6b8b --- /dev/null +++ b/.templates/duckdns/service.yml @@ -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 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 945afac78..030d4a643 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,24 @@ 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 and then removed 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 000000000..4f5a8cdcf --- /dev/null +++ b/docs/Containers/Duckdns.md @@ -0,0 +1,82 @@ +# 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. + +## 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 or run a dedicated DNS server. + +That said, it's possible to update Duckdns to your 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 +from their homepage. Then add a `PRIVATE_SUBDOMAIN` variable indicating this +subdomain: + +``` yaml title="added variable to docker-compose.override.yml" +version: '3.6' +services: + duckdns: + environment: + TOKEN: ... + SUBDOMAINS: ... + PRIVATE_SUBDOMAIN: private_subdomain +``` diff --git a/mkdocs.yml b/mkdocs.yml index 9a4ba4498..48ab4c85b 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 11c6c2c7a..fbc461011 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