qdm12 / ddns-updater

Container to update DNS records periodically with WebUI for many DNS providers
https://hub.docker.com/r/qmcgaw/ddns-updater/
MIT License
1.73k stars 164 forks source link

Feature request: Add Support for DigitalOcean DNS #98

Closed alaskanpuffin closed 3 years ago

alaskanpuffin commented 4 years ago
  1. What's the feature? Add support for DigitalOcean's free DNS service.

  2. Why do you need this feature? While there are other options such as Cloudflare, it can be helpful to manage all your services in a single location.

  3. Extra information? Documentation on their API can be found here: https://developers.digitalocean.com/documentation/v2/#domain-records

qdm12 commented 4 years ago

Hello! Thanks for the suggestion, I'm working on it now.

I however have a question if you know, how do you get the RECORD_ID for your domain? Is this easily accessible easily? I'm following the documentation of developers.digitalocean.com/documentation/v2/#update-a-domain-record. They keep on mentioning that RECORD_ID number (a bunch of digits) but I can't really find how to retrieve it.

Thanks!

alaskanpuffin commented 4 years ago

It looks like you need to have to list the records for a domain first to get the specific id for the subdomain. In the response it gives an id for each record under a specific domain. Take a look under this section: https://developers.digitalocean.com/documentation/v2/#list-all-domain-records

Then you can then filter by a specific record name and/or type of record by using name and type attributes at the end of the request. For example: /v2/domains/$DOMAIN_NAME/records?name=sub.example.com&type=A

All this information is listed under the "List All Domain Records" section.

Thank you for working on it!

qdm12 commented 4 years ago

Hello! I have an alpha version that you can try using qmcgaw/ddns-updater:digitalocean.

Documentation is here.

A few further questions, can you use the host "@" and "*" (wildcard host) for your domain? Let me know if you have any question or suggestion for the documentation or error messages etc.

Thanks for your patience!

qdm12 commented 3 years ago

Hey @alaskanpuffin sorry for the delay, have you had the chance to try it out? I would like to merge it in the main code base if it works for digital ocean. Thanks!

M96268004 commented 3 years ago

Hi @qdm12 I just using the qmcgaw/ddns-updater:digitalocean to testing, and it works. But it seems to me that the script will not create a new record if the hostname does not exist, only update to an existing record.

initial run unhealthy: [domain: mydomain.tld | host: ddns-updater | provider: digitalocean | ip: ipv4]: failure (no domain records found) 2020-12-12 12:54:06 CST;

and when I create an A record from digitalocean control panel and stop the container and restart it. Updating record [domain: mydomain.tld | host: ddns-updater | provider: digitalocean | ip: ipv4] to use xxx.xxx.xxx.xxx

I thought it will create if the hostname is not there or recreated if hostname been deleted.

Thanks for all the hard work, nice script, save my day. B/R

qdm12 commented 3 years ago

Thanks for testing it! Glad it helped you too!

I created #129 for creating the record if it does not exist as that behavior could be applied to all providers I think. I also merged the digital ocean things in the master branch / :latest docker image which you should be able to pull soon once the build is complete.