[Support] kru-x - Godaddy ddns


Recommended Posts

Used this docker for years now on my server, handy tool to update my dynamic DNS directly on my Godaddy account.

"Docker image to provide a DDNS service for godaddy domains. Uses the GoDaddy REST API to update the given domain's DNS IP address to the public IP address of the host it is executing on. Performs a check every 10 minutes, but you can alter this if you like by modifying /etc/cron.d/godaddy-ddns inside the container."

 

If you have problems with adding multiple Domains, you might have to add them as A names, refer to this post by JamiePhonic

 

Edited by Kru-x
  • Thanks 1
Link to comment
Just now, Kru-x said:

Not sure if normal but this is where I get redirected when clicking the support thread for the godaddy ddns docker.

 

I was wondering if you were doing anything special since I've modified some script I found on the web and run it with cron and it gets the job done.


#!/bin/bash
keys=(key1 key2)
secrets=(secret1 secret2)
domains=(domain1 domain2)
Type=A
Name=@
TTL=600
CachedIP=/tmp/current_ip
CheckURL=http://api.ipify.org

echo -n "$(date +%Y%m%d%H%M%S) Checking current 'Public IP' from '${CheckURL}': "
PublicIP=$(curl -kLs ${CheckURL})
if [ $? -eq 0 ] && [[ "${PublicIP}" =~ [0-9]{1,3}\.[0-9]{1,3} ]]; then
  echo "${PublicIP}."
else
  sleep 120
  PublicIP=$(curl -kLs ${CheckURL})
  if [ $? -eq 0 ] && [[ "${PublicIP}" =~ [0-9]{1,3}\.[0-9]{1,3} ]]; then
    echo "[retry] ${PublicIP}."
  else
    echo "[retry] Fail! ${PublicIP}"
    exit 1
  fi
fi

if [ "$(cat ${CachedIP} 2>/dev/null)" != "${PublicIP}" ]; then
  for ((i = 0; i < ${#domains[@]}; ++i)); do
    echo -n "$(date +%Y%m%d%H%M%S) Checking '${domains[$i]}' IP records from 'GoDaddy': "
    Check=$(curl -kLsH"Authorization: sso-key ${keys[$i]}:${secrets[$i]}" -H"Content-type: application/json" https://api.godaddy.com/v1/domains/${domains[$i]}/records/${Type}/${Name} 2>/dev/null|jq -r '.[0].data')>/dev/null
    if [ $? -eq 0 ] && [ "${Check}" = "${PublicIP}" ]; then
      echo -e "unchanged.\n$(date +%Y%m%d%H%M%S) Current 'Public IP' matches 'GoDaddy' records. No update required."
    else
      echo -e "changed.\n$(date +%Y%m%d%H%M%S) Updating '${domains[$i]}' from '${Check}' to '${PublicIP}'."
      Update=$(curl -kLsXPUT -H"Authorization: sso-key ${keys[$i]}:${secrets[$i]}" -H "Content-type: application/json" https://api.godaddy.com/v1/domains/${domains[$i]}/records/${Type}/${Name} -d "[{\"data\":\"${PublicIP}\",\"ttl\":${TTL}}]" 2>/dev/null)
      if [ $? -eq 0 ] && [ "${Update}" = "" ]; then
        echo "$(date +%Y%m%d%H%M%S) Success."
      else
        echo "$(date +%Y%m%d%H%M%S) Fail. ${Update}"
        exit 1
      fi
    fi
  done
  echo ${PublicIP}>${CachedIP}
else
  echo -en "$(date +%Y%m%d%H%M%S) Current 'Public IP' matches 'Cached IP' recorded. No update required.\n"
fi
exit $?

I'm trying to understand in what use case scenario would a docker be a better solution than a simple 40ish lines script (could probably be optimized to < 30 lines).

I got this post from user "dnLL", just wanted to answer and maybe clarify to others!

 

Hi, "dnLL"

First of all I didn't create this container merely added it to unraid for others like me to use. I guess there is no specific reason that it would be better (or worse to my knowledge) to use a docker or this container made in python, your solution might even be better

 

For me it is the easiness to throw in a container, fill out the detail's and away you go, I can toss it away if needed. I am more in too web development I am not that confident to make my own script's , don't like the copy and paste to get it working and if I don't fully understand it i rather trust in others that do, to make the task. Similar to all other docker containers I use, but most others are more advanced then this one thought.

Hope it answer your question,

R

Kru-x

 

Link to comment
On 1/4/2020 at 1:45 PM, Kru-x said:

I got this post from user "dnLL", just wanted to answer and maybe clarify to others!

 

Hi, "dnLL"

First of all I didn't create this container merely added it to unraid for others like me to use. I guess there is no specific reason that it would be better (or worse to my knowledge) to use a docker or this container made in python, your solution might even be better

 

For me it is the easiness to throw in a container, fill out the detail's and away you go, I can toss it away if needed. I am more in too web development I am not that confident to make my own script's , don't like the copy and paste to get it working and if I don't fully understand it i rather trust in others that do, to make the task. Similar to all other docker containers I use, but most others are more advanced then this one thought.

Hope it answer your question,

R

Kru-x

 

Thanks for the quick reply and fixing the support thread for your docker.

 

Since I don't see any reason to use a docker only to run a ~40ish lines script, I won't use it, but for people less at ease with programming, I can see the ease of use of just clicking buttons in the UI being helpful for them.

Link to comment
  • 4 months later...

Hi I'm trying to use this; without luck so far. 

Quote

 

2020-05-27 09:59:00,993 : ERROR : root - Got exception updating godaddy records
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 106, in _validate_response_success
response.raise_for_status()
File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/@/records/A/@

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/godaddy-publicip-updater.py", line 126, in loop_forever
worked = update_godaddy_records(new_ip)
File "/godaddy-publicip-updater.py", line 72, in update_godaddy_records
records = g_client.get_records(domain, name=a_name, record_type='A')
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 190, in get_records
data = self._get_json_from_response(url)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 66, in _get_json_from_response
return self._request_submit(requests.get, url=url, json=json, **kwargs).json()
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 92, in _request_submit
self._validate_response_success(resp)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 108, in _validate_response_success
raise BadResponse(response.json())
godaddypy.client.BadResponse: Response Data: {'code': 'INVALID_BODY', 'fields': [{'code': 'MISMATCH_FORMAT', 'message': "does not conform to the 'domain' format, based on pattern: /^[^.]{1,63}(\\.[^.]{1,63})+$/", 'path': 'path.domain'}], 'message': "Request body doesn't fulfill schema, see details in `fields`"}

 

Link to comment

This docker is exactly what I'm looking for.

 

I can get this working with my domain mydomain.com. But I can't get this working for subdomains like www.mydomain.com, server.mydomain.com etc.

 

Only way I can get this working is by setting the "Domain Name" as mydomain.com when setting the docker up. I can't get it working for subdomains, by specifying "@", "*", "server" etc.

 

How do you set this up?

Edited by Nelinski
Link to comment
2 hours ago, Nelinski said:

This docker is exactly what I'm looking for.

 

I can get this working with my domain mydomain.com. But I can't get this working for subdomains like www.mydomain.com, server.mydomain.com etc.

 

Only way I can get this working is by setting the "Domain Name" as mydomain.com when setting the docker up. I can't get it working for subdomains, by specifying "@", "*", "server" etc.

 

How do you set this up?

Hi Nelinski,

 

This docker is only changing the ip address for your GoDaddys domain when your ip address changes and you only have one (per domain).

 

You will have to add your subdomains in GoDaddy,

 

Ex. I have my main domain "mysite.com" and my subdomains like "cloud.mysite.com", "music.mysite.com" etc. those subdomain's is added in Godaddy. GoDaddy is directing ANY request to *.mysite.com to my server's IP address where Nginx Proxy Manager takes care of the directing the request to appropriate container.

 

Hope I understood right and that it helps, let me know,

 

Kru-x

  • Thanks 1
Link to comment
17 minutes ago, Nelinski said:

Hi Kru-x,

 

Thanks for the reply. Not sure if this is the exact way you meant, but this works and solves my problem.

 

image.png.bd6944b8159bc3cff6001c86042c86c1.png

That is exactly what I meant 🙂, now both "server" and "www" as subdomains get directed to your server.

 

AND, not that I have anything to do with it but what's the deal with the "server" as the subdomain, not thinking about getting "unraid" on that one I hope. :~( 

 

Kru-x

Link to comment
  • 1 month later...
  • 1 month later...

Just for anyone else that is struggling with this (I did find the instructions somewhat unclear):
 

Setup your GoDaddy DNS like this (ncloud is the example here):
image.thumb.png.a5cc8337dafda5e28ff57ea31cd177ab.png

 

And then in the field "Domain Name" enter your primary domain, "yourdomain.com", not "@" or "ncloud" (in my case) as the instruction on the docker setup pages says.

Edited by Dazing
Solved issue, added how i did it
Link to comment
17 minutes ago, Dazing said:

Just for anyone else that is struggling with this (I did find the instructions somewhat unclear):
 

Setup your GoDaddy DNS like this (ncloud is the example here):
image.thumb.png.a5cc8337dafda5e28ff57ea31cd177ab.png

 

And then in the field "Domain Name" enter your primary domain, "yourdomain.com", not "@" or "ncloud" (in my case) as the instruction on the docker setup pages says.

Sa du fick det att funka?

Kru-x

Link to comment
18 minutes ago, Dazing said:

Yes! Its working now. 

But I do have a concern, by doing it this way, doesn't that prohibit hosting a website with GoDaddy (or any other provider)? Since everything is pointing to @, which in turn points to my Unraid box.

Don't worry,

 

Godaddy is a domain name provider and you are paying for it! The service as a website hosting is just a side kick. It won't matter to them if you host it or another provider douse it, same for them and it is a reason they provider an api to change it..

 

Kru-x

Link to comment
  • 3 weeks later...

Update: 

 

So I've managed to fix this initial issue by entering my domain name in the Domain name section, which had slightly misleading instructions. However, what I'm actually trying to do is add a second A record to my domain that points to my local server. My main '@' A Record points to a hosted website elsewhere. How can I setup this container to just update the second A name?



Hi All, Long time unraid user but currently having some issues with this docker image.  I'm getting the following logs. Can anyone advise on what I need to do to resolve this? Annoyingly I had this image working until very recently when I tried to add another hostname to it but there was no edit button so I had to delete and reinstall the image which has since broken it.

2020-10-16 12:37:02,560 : ERROR : root - Got exception updating godaddy records

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 106, in _validate_response_success
response.raise_for_status()
File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/home/records/A/@


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/godaddy-publicip-updater.py", line 126, in loop_forever
worked = update_godaddy_records(new_ip)
File "/godaddy-publicip-updater.py", line 72, in update_godaddy_records
records = g_client.get_records(domain, name=a_name, record_type='A')
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 190, in get_records
data = self._get_json_from_response(url)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 66, in _get_json_from_response
return self._request_submit(requests.get, url=url, json=json, **kwargs).json()
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 92, in _request_submit
self._validate_response_success(resp)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 108, in _validate_response_success
raise BadResponse(response.json())
godaddypy.client.BadResponse: Response Data: {'code': 'INVALID_BODY', 'fields': [{'code': 'MISMATCH_FORMAT', 'message': "does not conform to the 'domain' format, based on pattern: /^[^.]{1,63}(\\.[^.]{1,63})+$/", 'path': 'path.domain'}], 'message': "Request body doesn't fulfill schema, see details in `fields`"}

 

Edited by broadcastthebadger
Update
Link to comment
6 hours ago, broadcastthebadger said:

Update: 

 

So I've managed to fix this initial issue by entering my domain name in the Domain name section, which had slightly misleading instructions. However, what I'm actually trying to do is add a second A record to my domain that points to my local server. My main '@' A Record points to a hosted website elsewhere. How can I setup this container to just update the second A name?



Hi All, Long time unraid user but currently having some issues with this docker image.  I'm getting the following logs. Can anyone advise on what I need to do to resolve this? Annoyingly I had this image working until very recently when I tried to add another hostname to it but there was no edit button so I had to delete and reinstall the image which has since broken it.


2020-10-16 12:37:02,560 : ERROR : root - Got exception updating godaddy records

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 106, in _validate_response_success
response.raise_for_status()
File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/home/records/A/@


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/godaddy-publicip-updater.py", line 126, in loop_forever
worked = update_godaddy_records(new_ip)
File "/godaddy-publicip-updater.py", line 72, in update_godaddy_records
records = g_client.get_records(domain, name=a_name, record_type='A')
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 190, in get_records
data = self._get_json_from_response(url)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 66, in _get_json_from_response
return self._request_submit(requests.get, url=url, json=json, **kwargs).json()
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 92, in _request_submit
self._validate_response_success(resp)
File "/usr/local/lib/python3.8/site-packages/godaddypy/client.py", line 108, in _validate_response_success
raise BadResponse(response.json())
godaddypy.client.BadResponse: Response Data: {'code': 'INVALID_BODY', 'fields': [{'code': 'MISMATCH_FORMAT', 'message': "does not conform to the 'domain' format, based on pattern: /^[^.]{1,63}(\\.[^.]{1,63})+$/", 'path': 'path.domain'}], 'message': "Request body doesn't fulfill schema, see details in `fields`"}

 

Hi broadcastthebadger,

 

If you have used this docker for a while it is probably that you have the old one, the old one broke and I changed it to another one, should be in said in this forum I think.

 

Anyhow check if you have jwater7/godaddy-publicip-updater in the repository column, if not delete the image and my template and use the new one in the apps library.

 

Hope it helps,

Kru-x

Link to comment
  • 2 weeks later...
3 hours ago, destrugter said:

Does this support wildcard subdomains?

 

Edit:
Sorry I just read over the previous posts and figured out how to do it. Thanks!

Good that you figure it out, but for others that wonders:

 

The docker periodically updates your A record at godaddy (DDNS for godaddy domains). You can create a a comma-separated list of the 'A' record names you'd like to update. For example: "home" or "@,anothername",

 

Kru-x

Link to comment
  • 3 weeks later...

Hi there!

First off, Thanks for this container. i've been trying to figure out an easy way to do this for a while!

 

Second, i've noticed a flaw in the template.

It seems like the template has the description for the `GODADDY_A_NAMES` variable assigned to the `GODADDY_DOMAINS` (`Domain Name`) variable, so entering just a comma seperated list of A records to update causes the script to fail with the same error that @broadcastthebadger (among others) got.

 

I fixed this by adding the `GODADDY_A_NAMES` variable to the template and then filling in the info in the right places!

Link to comment
11 hours ago, JamiePhonic said:

Hi there!

First off, Thanks for this container. i've been trying to figure out an easy way to do this for a while!

 

Second, i've noticed a flaw in the template.

It seems like the template has the description for the `GODADDY_A_NAMES` variable assigned to the `GODADDY_DOMAINS` (`Domain Name`) variable, so entering just a comma seperated list of A records to update causes the script to fail with the same error that @broadcastthebadger (among others) got.

 

I fixed this by adding the `GODADDY_A_NAMES` variable to the template and then filling in the info in the right places!

Yea you are right, the description was wrong and I change it in the template.

 

Didn't add the A name as it should not matter, the domain name is the A name in Godaddy and I don't know why you would need to use the A name instead of the GODADDY_DOMAINS as it do the same thing, changes the A name. But I am not a wizz and it might be something I don't know (guess it is a reason there is the option ), it works for me and I have several different Domain names on my server, all added as a comma separated list, so a little bit lost on that one.


Glad you figured your setup out and thanks for pointing my mistake out,

 

Kru-x

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.