Inadyn

We're using dynamic DNS to point to our home IP address (& a domain, with subdomains to point at that dynamic DNS domain, so that we can have as many subdomains as we like - with the distribution to the right place of these being looked after by the reverse proxy).
We need to make sure that the dynamic DNS is checked/updated, otherwise we'll lose the ability to connect every time that our home IP address is changed (assuming that you have a dynmically assigned IP address from your ISP & not a static one (luxury!))

Inadyn is a piece of software that checks in with the dynamic DNS provider every few minutes (depending on configuration) & compares the IP address that is being associated with our domain name with the one that is actually assigned to our home. If they are different then the DNS server gets updated with the IP address that actually points to our home &, hey presto, the domain name now resolves to the place that we are self hosting software (including Inadyn)!

Hopefully you're either happy running docker/docker-compose by yourself or you've used the bootstrap guide here to get Portainer up & ready to help with the next step.

First off, you'll need to launch portainer (http://<LAN IP address>:9000)
click on the big "local" button in the middle of the home screen
click on "stacks" in the left hand menu & then
click on "Add stack"

Click on the "Editor" tab (ignore everything else here, for now), then think of a name for your stack. I just called this one inadyn, but use whatever works for you.

What you see when you start to create a stack

The important part is the configuration, which I've kept in a persistent storage location (a directory called inadyn in my home directory). You can see that in the stack definition that comes just after this section. You need the configuration set up though, otherwise Inadyn won't know what to do! Here's my inadyn.conf, with the bits specific to me removed:

# In-A-Dyn v2.0 configuration file format
period          = 600
user-agent      = Mozilla/5.0

provider no-ip.com {
    username    = <Your NoIP Username>
    password    = <Your NoIP password>
    hostname    = {domain1.ddns.net, domain2.noip.me}

	user-agent  = inadyn/2.2
}
inadyn.conf

As you can see, I've got this set up to check every 600 seconds (10 minutes). It "calls" No-IP & updates 2 hostnames. If you only have one hostname then you can lose the {} & the comma from the hostname line. If you use a different provider then you'll want to take a look at the home page for the software (troglobit.com)

Now for the stack (which is rather like a docker-compose "script")

version: "2"
services:
  inadyn:
    container_name: inadyn
    image: shtripok/inadyn
    logging:
      driver: json-file
      options: {}
    restart: unless-stopped
    volumes:
      - ~/inadyn/inadyn.conf:/etc/inadyn.conf
This is what goes in the web editor area

Pretty simple really (you might want a different image if you're not using a Raspberry Pi - you can find one to suit your CPU on docker hub)

Hit the deploy stack button under the editor area & Portainer should download the image & start it, with our configuration file defining the dynamic DNS domains that need updating.

You'll see something like this on the inadyn stack screen now

As you can see, I've got the container running - & it's marked as having been launched from the inadyn stack. You'll see the same layout on the main containers screen - which will show you all of the containers that you have.

Those icons let you interact with the container. Hover over them to see what they do. The important one for us is the left hand "logs" one, which lets you see the logs!! Here are the last few lines of mine:

inadyn[1]: Update needed for alias domain1.ddns.net, new IP# 80.42.25.166
inadyn[1]: Update needed for alias domain2.noip.me, new IP# 80.42.25.166
inadyn[1]: Updating cache for domain1.ddns.net
inadyn[1]: Updating cache for domain2.noip.me
inadyn[1]: STOP command received, exiting.
inadyn[1]: In-a-dyn version 2.6 -- Dynamic DNS update client.
inadyn[1]: Guessing DDNS plugin 'default@no-ip.com' from 'no-ip.com'
inadyn[1]: Failed resolving hostname ip1.dynupdate.no-ip.com: Try again
inadyn[1]: Failed to get IP address for default@no-ip.com, giving up!
inadyn[1]: Update needed for alias domain1.ddns.net, new IP# 92.25.12.167
inadyn[1]: Update needed for alias domain2.noip.me, new IP# 92.25.12.167
inadyn[1]: Updating cache for domain1.ddns.net
inadyn[1]: Updating cache for domain2.noip.me

As you can see, there was a power cut recently, which was longer than the UPS could handle. I shut down the computers gracefully, then when they woke up (& the router got its act together) there was a new dynamic IP address for my home. So, Inadyn did its job & updated the IP addresses.

You can have more than dynamic DNS provider in the config file, if you want, you just add another section to the config file. There is more information in the inadyn docs