# Inadyn Installation on AlpineLinux

This is made with the following example for DYNDNS Provider desec.io

**domain**: mydomain.dedyn.io
**token**: XXXXXXXXXX

Change this in the config file (and maybe duplicate it for mutiple entries)


## Example for desec.io
```javascript
custom mydomain.dedyn.io {
        username        = mydomain.dedyn.io
        password        = 'XXXXXXXXXX'
        checkip-server  = checkipv4.dedyn.io
        checkip-path    = /
        checkip-ssl     = true
        ddns-server     = update.dedyn.io
        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
        ssl             = true
        hostname        = mydomain.dedyn.io
}
```

## Example for duckdns
```javascript
provider duckdns.org {
    username         = mytoken
    hostname         = mydomain.duckdns.org
}
```

# Installcommands on Alpine Linux

```bash
# Use Alpine Edge Repositories
cat <<EOF >/etc/apk/repositories
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
EOF

# Update Alpine Linux
apk update
apk upgrade -a

# Install default Tools (used by ansible f.e.)
apk add nano python3 openssh-server tzdata

# Configure Timezone (Change)
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
#ln -s /usr/share/zoneinfo/Europe/Vienna /etc/localtime

# Make ssh Server autoboot
rc-update add sshd
service sshd start

# Install Inadyn as DynDNS Updater
apk add inadyn
cat <<EOF >/etc/inadyn/inadyn.conf
# How often the IP is checked. The value denotes seconds
period = 300

### Custom provider example
custom dedyn1 {
        username        = mydomain.dedyn.io
        password        = 'XXXXXXXXXX'
        checkip-server  = default
        checkip-path    = /
        checkip-ssl     = true
        ddns-server     = update.dedyn.io
        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
        ssl             = true
        hostname        = mydomain.dedyn.io
}

#custom dedyn2 {
#        username        = 
#        password        = ''
#        checkip-server  = default
#        checkip-path    = /
#        checkip-ssl     = true
#        ddns-server     = update.dedyn.io
#        ddns-path       = "/update?username=%u&password=%p&myipv4=%i"
#        ssl             = true
#        hostname        = 
#}
EOF

# Adjust initd script to have syslog output for debugging
cat <<EOF >/etc/init.d/inadyn
#!/sbin/openrc-run
name=\$RC_SVCNAME
description="DynDNS client"
cfgfile="/etc/\$RC_SVCNAME/\$RC_SVCNAME.conf"
command="/usr/sbin/\$RC_SVCNAME"
command_args="-s --syslog -f \$cfgfile"
command_user="\$RC_SVCNAME"
supervisor="supervise-daemon"
command_args_foreground="--foreground"

depend() {
        need net
        use logger dns
        after bootmisc
}

start_pre() {
        checkpath --directory --owner \$command_user:\$command_user --mode 0755 \\
                /run/\$RC_SVCNAME /var/cache/\$RC_SVCNAME
        \$command --check-config -f \$cfgfile
}
EOF

rc-update add inadyn
service inadyn start

# Reboot to have everything nice and fresh
reboot
```