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.08k stars 219 forks source link

Add Support for Multiple Sub Domains #60

Closed cfitzw closed 3 years ago

cfitzw commented 3 years ago

I understand the documentation and previously opened issues mention to use CNAME records, which works for most scenarios, however, there are restrictions with using them:

"MX and NS records cannot point to a CNAME record; they have to point to an A record (for IPv4) or an AAAA record (for IPv6)."

Adding the ability to A) recursively update all A records in a zone or B) specify more than one sub-domain (comma delimited) would help with this restriction versus the need to run multiple containers to stay in compliance.

cn-ml commented 3 years ago

I second this, I want to update my wildcard A entry as well as the root domain entry

dawidmachon commented 3 years ago

Dear @oznu SUBDOMAIN=subdomain,secondsubdomain,third,etc

that would be wonderful

or possibility to add full configs like in array to customize each

ALutz273 commented 3 years ago

+1

misterjtc commented 3 years ago

I am so confused by this. Does this docker actually only support either the root of the domain or a single subdomain? If this is true this is kind of useless isn't it? Does that mean I would have to run a container for each subdomain?

chipped commented 3 years ago

I'd also like to know if it supports multiple subdomains and how we configure it.

carlosdesedas commented 3 years ago

hi.. I'd love to get this script, as mentioned above, to update the different A records I have under my domain, not only the main one....
Besides my root domain I also have other A records... PLEX.mydomain.com, CCTV.mydomain.com, FTP.mydomain.com... these are not getting updated...

thanks for your help @oznu !

proap commented 3 years ago

+1 for multi-domain support

Semtex1982 commented 3 years ago

+1 for multi-domain support

DJFraz commented 3 years ago

+1 I actually came here looking to see if this functionality was possible.

shawnhank commented 3 years ago

Agreed. Would love to see this added to an already elegant method of updating Cloudflare with my ISPs' Dynamic IP address assignments.

shawnhank commented 3 years ago

One more comment or thought... wouldn't it be easy to run another instance of this container and specify the sub-domain? While I get the idea may not be efficient, running additional containers to update the subdomains would work, based on my testing. Of course, your mileage may vary depending on the availability of compute resources.

misterjtc commented 3 years ago

I feel like that is just forcing it to do something its not built to do and wasting resources. I am not really sure what this is built to do actually. I guess if you're hosting one site against a domain it's fine.

I guess my point is there is no reason to do something like this. There are a myriad of other solutions. For example I am using ddclient instead because I can add all the subdomains I want.

riDuxd commented 3 years ago

I haven't tried it yet, but I have multiple docker containers for each website that I self host. I could probably just add the cloudflare service directly to those sites' docker-compose.yml file. It may or may not work.

PS: I'm still new to Docker.

EDIT: Yep it works.

proap commented 3 years ago

for those needing multi-domain support, you can try this one: https://github.com/joshuaavalon/docker-cloudflare

It works just great for me

shawnhank commented 3 years ago

@riDuxd

Could you share/post your docker-compose.yml file so I can use it as a reference?

I'm still new to Docker Compose and YAML

riDuxd commented 3 years ago

@gogoswh I'm also relatively new to Docker (month'ish) using it, but here's a regular WP docker-compose file I have created.


version: "3.9"

services:

  db:
    image: mariadb:latest
    volumes:
      - db_data:/var/lib/mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: mysqlpasswordhere
      MYSQL_DATABASE: wordpress
      # User Password for phpMyAdmin as well
      MYSQL_USER: mysqlusernamehere
      # Password for phpMyAdmin as well
      MYSQL_PASSWORD: mysqluserpasswordhere

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
      # Used for changing the default WP upload limits
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    ports:
      # Use your own ports here; to be used with NGINX Proxy Manager (External : Internal)
      - "9000:80"
    restart: unless-stopped
    environment:
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: mysqlusernamehere
      WORDPRESS_DB_PASSWORD: mysqluserpasswordhere

  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin:latest
    restart: unless-stopped
    ports:
      # Use your own ports here; to be used with NGINX Proxy Manager (External : Internal)
      - '9001:80'
    environment:
      - PMA_HOST=db
      - MYSQL_ROOT_PASSWORD=mysqlpasswordhere

  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest
    restart: unless-stopped
    environment:
      - API_KEY= # use your API here
      - ZONE= # use your domain here
      - SUBDOMAIN= # add subdomain here otherwise delete the line entirely
      - PROXIED=true # Use false first before you setup NPM. Use true later if you want it to be proxied by cloudlfare. 
      - CRON="@daily" # I use daily. Use https://crontab.guru/ for reference.

volumes:
  db_data:
  wordpress_data:
shawnhank commented 3 years ago

Mahalo!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.