jhlange / dreamapi

Dreamhost scripts for dynamic DNS and bulk API changes
MIT License
24 stars 8 forks source link

Multiple subdomain A record update #2

Open tsipoura opened 9 years ago

tsipoura commented 9 years ago

Hi Joshua,

I use your dreamdns script for ddns but i want to add multiple domain for reverse proxy in my home lab. I can update A records with multiple dreamdns scripts for each domain but is there a better way to do this, thanks.

jhlange commented 9 years ago

So is the ask to have multiple 'A' records, such that,

hostname.mydomain.com  A     111.111.111.111
                       A     222.222.222.222

This isn't really a scenario that I've created the script for.- I'm having trouble understanding how the script would know which record it is controlling (I guess you could use the comment field though).

In the scenario where 222.222.222.222 needs to be changed to 244.244.244.244, the script at execution time might only know about 244.244.244.244 (for a number of reasons, system reboot, etc), so it would not know to delete 222.222.222.222 before inserting the new record.

If you add this feature, you can submit a pull request.i would suggest that each instance of the script would have an additional, optional --targetRecord (or similarly named option) to scan through the associated A records for the matching comment field.

tsipoura commented 9 years ago

I guess I could not fully explain the problem.

subdomain1.mydomain.com A my_homelab_ip subdomain2.mydomain.com A my_homelab_ip subdomain3.mydomain.com A my_homelab_ip ..

In my homelab i have a nginx reverse proxy setup which listens 80 port;

subdomain1.mydomain.com --> 192.168.0.70:8080 subdomain2.mydomain.com --> 192.168.0.71:8090 subdomain3.mydomain.com --> 192.168.0.72:8081 ...

i thing i must try to update your script which accepts array of domain parameter and update each domain with same (homelab) ip.

Thanks.

jhlange commented 9 years ago

The best way to achieve your case is to execute 3 instances of the script, one to manage each domain.

If you want to have the domains behind your NAT, you should specify the --nic parameter so that the external service does not pick up your internet addressable ip.