Closed tonydm closed 3 years ago
usually an error like that occurs when either the config isn't found, or there is some issue processing the config and it ends up using defaults.
@tonydm given that the unmarshall
call was not having it's error checked, my assumption is that you have invalid JSON on your config. if you can either run against my latest PR (#18) or just run your config though a JSON validator, you should be able to confirm the problem.
@johnjaylward Thanks... ok... The issue info I posted shows that the config file exists and is in the path I passed to digitalocean-dynamic-dns-ip. While the json file is tiny, I checked the config using a linter and it's valid. Do you see a problem with the json config values? Aside from the obfuscated API Key, and domains. I'm not sure how to run against your PR. I see you committed it about 30min ago.
it looks like you are doing a git clone
and the a fresh go build
assuming you can modify the startup script, you can change the git clone to point to my fork and then add an addition step after the clone to switch to the addMoreLogs
branch.
git clone https://github.com/johnjaylward/digitalocean-dynamic-dns-ip.git
cd digitalocean-dynamic-dns-ip
git checkout -b addMoreLogs
go get github.com/mitchellh/go-homedir
go build
...
I appreciate the coach... thank you. I built digitalocean-dynamic-dns-ip using the testing branch you committed. If I built it and running correctly, I'm missing the logging. I see the same output to the console as before and I can't find a file with the logging data. Here's a detail of the what I did.
Thanks again
Discovered IP, MY API KEY, mydomain.com & mysubdomain are obfuscated
root@8fe489e34640:/#
root@8fe489e34640:/# git clone https://github.com/johnjaylward/digitalocean-dynamic-dns-ip.git
Cloning into 'digitalocean-dynamic-dns-ip'...
remote: Enumerating objects: 99, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 99 (delta 3), reused 8 (delta 2), pack-reused 83
Receiving objects: 100% (99/99), 33.02 KiB | 497.00 KiB/s, done.
Resolving deltas: 100% (43/43), done.
root@8fe489e34640:/#
root@8fe489e34640:/#
root@8fe489e34640:/# cd digitalocean-dynamic-dns-ip
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# git checkout -b addMoreLogs
Switched to a new branch 'addMoreLogs'
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# go get github.com/mitchellh/go-homedir
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# go build
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# cp digitalocean-dynamic-dns-ip /usr/bin/
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# chmod +x /usr/bin/digitalocean-dynamic-dns-ip
root@8fe489e34640:/digitalocean-dynamic-dns-ip#
root@8fe489e34640:/digitalocean-dynamic-dns-ip# cd ../
root@8fe489e34640:/#
root@8fe489e34640:/#
root@8fe489e34640:/# cat /data/digitalocean-dynamic-ip.json
{
"apikey": "MY API KEY",
"doPageSize": 20,
"useIPv4": true,
"useIPv6": false,
"allowIPv4InIPv6": false,
"ipv4CheckUrl": "http://ipecho.net/plain",
"domains": [
{
"domain": "mydomain.com",
"records": [
{
"name": "mysubdomain",
"type": "A"
}
]
}
]
}
root@8fe489e34640:/#
root@8fe489e34640:/# /usr/bin/digitalocean-dynamic-dns-ip /data/digitalocean-dynamic-ip.json
2021/10/20 13:57:34 Discovered IPv4 address `67.61.xx.xx`
2021/10/20 13:57:34 Get "https://ipv6bot.whatismyipaddress.com": dial tcp [2606:6e00:c000:1000::501]:443: connect: cannot assign requested address
root@8fe489e34640:/#
root@8fe489e34640:/# ll
total 112K
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ../
-rwxr-xr-x 1 root root 0 Oct 20 13:40 .dockerenv*
drwxr-xr-x 1 abc abc 4.0K Oct 18 23:30 app/
drwxr-xr-x 1 root root 4.0K Oct 18 23:30 bin/
drwxr-xr-x 1 abc abc 4.0K Oct 20 13:40 config/
drwxrwxr-x 2 abc 1001 4.0K Oct 20 11:03 data/
drwxr-xr-x 1 abc abc 4.0K Oct 18 23:30 defaults/
drwxr-xr-x 5 root root 340 Oct 20 13:40 dev/
drwxr-xr-x 4 root root 4.0K Oct 20 13:43 digitalocean-dynamic-dns-ip/
-rwxrwxr-x 1 root root 3.5K Oct 18 23:29 docker-mods*
drwxrwxr-x 1 root root 4.0K Oct 20 13:40 etc/
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 home/
-rwxr-xr-x 1 root root 389 Feb 15 2021 init*
drwxr-xr-x 1 root root 4.0K Oct 18 23:30 lib/
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 libexec/
drwxr-xr-x 5 root root 4.0K Oct 18 23:30 media/
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 mnt/
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 opt/
dr-xr-xr-x 371 root root 0 Oct 20 13:40 proc/
drwx------ 1 root root 4.0K Oct 20 13:26 root/
drwxr-xr-x 1 root root 4.0K Oct 20 13:40 run/
drwxr-xr-x 1 root root 4.0K Oct 18 23:30 sbin/
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 srv/
dr-xr-xr-x 13 root root 0 Oct 17 13:41 sys/
drwxrwxrwt 1 root root 4.0K Oct 20 13:43 tmp/
drwxrwxr-x 1 root root 4.0K Oct 20 13:21 usr/
drwxr-xr-x 1 root root 4.0K Oct 20 13:21 var/
root@8fe489e34640:/#
root@8fe489e34640:/#
root@8fe489e34640:/# ll /digitalocean-dynamic-dns-ip/
total 6.6M
drwxr-xr-x 4 root root 4.0K Oct 20 13:43 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ../
drwxr-xr-x 2 root root 4.0K Oct 20 13:42 .circleci/
drwxr-xr-x 8 root root 4.0K Oct 20 13:42 .git/
-rw-r--r-- 1 root root 123 Oct 20 13:42 .gitignore
-rw-r--r-- 1 root root 1.1K Oct 20 13:42 LICENSE.md
-rw-r--r-- 1 root root 4.1K Oct 20 13:42 README.md
-rwxr-xr-x 1 root root 1.3K Oct 20 13:42 ci-build-script.sh*
-rwxr-xr-x 1 root root 6.5M Oct 20 13:43 digitalocean-dynamic-dns-ip*
-rw-r--r-- 1 root root 10K Oct 20 13:42 digitalocean-dynamic-ip.go
-rw-r--r-- 1 root root 669 Oct 20 13:42 digitalocean-dynamic-ip.sample.json
-rw-r--r-- 1 root root 112 Oct 20 13:42 go.mod
-rw-r--r-- 1 root root 181 Oct 20 13:42 go.sum
root@8fe489e34640:/# ll /tmp/
total 8.0K
drwxrwxrwt 1 root root 4.0K Oct 20 13:43 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ../
root@8fe489e34640:/# ll /home/
total 8.0K
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ../
root@8fe489e34640:/# ll /var/log
total 12K
drwxr-xr-x 2 root root 4.0K Oct 18 23:30 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:21 ../
root@8fe489e34640:/# ll /root/
total 24K
drwx------ 1 root root 4.0K Oct 20 13:26 ./
drwxr-xr-x 1 root root 4.0K Oct 20 13:42 ../
drwxr-xr-x 1 root root 4.0K Oct 20 13:26 .cache/
drwxr-xr-x 3 root root 4.0K Oct 20 13:26 go/
I resolved the issue although no idea how. I copied a config from another working site and pasted it in this servers data/digitalocean-dynamic-ip.json config file. Same API Key and domain, diff sub domains. Changed the sub domains. Everything else the same. Viola, working. Copy my original config back to the /data/digitalocean-dynamic-ip.json and it too works. Complete mystery to me. Both files pass a linter check. Both appear(d) identical. Your quick response and effort are very appreciated. I'm going to close this issue since the issue is gone. If I missed something in using the testing branch, I'd be interested to know what that is.
Thanks again
Config from another working site
{
"apikey": "MY API KEY",
"doPageSize": 20,
"useIPv4": true,
"useIPv6": false,
"allowIPv4InIPv6": false,
"ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
"domains": [
{
"domain": "mydomain.com",
"records": [
{
"name": "mysubdomain",
"type": "A"
}
]
}
]
}
Original config
{
"apikey": "MY API KEY",
"doPageSize": 20,
"useIPv4": true,
"useIPv6": false,
"allowIPv4InIPv6": false,
"ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
"domains": [
{
"domain": "mydomain.com",
"records": [
{
"name": "mysubdomain",
"type": "A"
}
]
}
]
}
I am trying to understand why I cannot remedy this error msg.
Thank you in advance!
TD
Get https://ipv6bot.whatismyipaddress.com: dial tcp [2606:6e00:c000:1000::501]:443: connect: cannot assign requested address
My config file does not contain https://ipv6bot.whatismyipaddress.com as the lookup URL for IPV4
Config
I am running this in a docker container built with a Linuxserver.io base image.