oznu / docker-cloudflare-ddns

A small amd64/ARM/ARM64 Docker image that allows you to use CloudFlare as a DDNS / DynDNS Provider.
https://hub.docker.com/r/oznu/cloudflare-ddns/
GNU General Public License v3.0
1.07k stars 213 forks source link

Can update zone or subdomains, but not both #81

Open acollien opened 2 years ago

acollien commented 2 years ago

Ran into the issue when I was trying to get the app to update the 'www' A record on cloudflare. Popped it in the subdomain field of the app, and then checked back after running it. My main website A record had not updated, but the www had. Remove the www subdomain from the app, rerun, and the main domain name A record updates. Seems to be one other the other. Is this how it's meant to function. Possible to update all A records (i.e. the domain + 1 or more subdomains) at once?

thijsjek commented 2 years ago

I just created 2 separated docker containers. One without subdomain= and one with subdomain=www,cloud,etc

QuanDev2 commented 2 years ago

@thijsjek can you use commas to separate multiple subdomains?

PackElend commented 2 years ago

still, the case that only one of the A-Types gets updated? first A got updated but not the second one. image

thijsjek commented 2 years ago

So, the container let's you put in multiple like comma seperated domains or multiple -e subdomains, but that does not work. I didnt notice because my IP didn't change until I setup like below I eventually just use 2 containers. One for mydomain.com and one for *.mydomain.com.

To adjust multiple subdomains, I think you have to create several containers.

PackElend commented 2 years ago

so you do CONTAINER: TLD

version: '2'
services:
  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest
    restart: always
    environment:
      - API_KEY=xxxxxxx
      - ZONE=mydomain.com

CONTAINER: suddomains

version: '2'
services:
  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest
    restart: always
    environment:
      - API_KEY=xxxxxxx
      - ZONE=*.mydomain.com
      - PROXIED=false
PackElend commented 2 years ago

otherwise, may https://github.com/timothymiller/cloudflare-ddns may do it better

thijsjek commented 2 years ago

so you do CONTAINER: TLD

version: '2'
services:
  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest
    restart: always
    environment:
      - API_KEY=xxxxxxx
      - ZONE=mydomain.com

CONTAINER: suddomains

version: '2'
services:
  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest
    restart: always
    environment:
      - API_KEY=xxxxxxx
      - ZONE=*.mydomain.com
      - PROXIED=false

Yes exactly. I just don't use docker compose.

`docker run -d \ --name=ddns1 \ -e API_KEY= \ -e ZONE=mydonain.com \ --restart=unless-stopped \ oznu/cloudflare-ddns

docker run -d \ --name=ddns2 \ -e API_KEY= \ -e ZONE=domain.com \ -e SUBDOMAIN=* \ --restart=unless-stopped \ oznu/cloudflare-ddns`

Also from your link: You can save yourself some trouble when hosting multiple domains pointing to the same IP address (in the case of Traefik) by defining one A & AAAA record 'ddns.example.com' pointing to the IP of the server that will be updated by this DDNS script. For each subdomain, create a CNAME record pointing to 'ddns.example.com'. Now you don't have to manually modify the script config every time you add a new subdomain to your site!