Giter Site home page Giter Site logo

traefik-cloudflare-updater's Introduction

traefik-cloudflare-updater

Instead of using a wildcard DNS record, create records dynamically using this.

Only works with traefikv2 configuration, look at the above repo for v1 support.

When you run the container, it'll update all the DNS records it can find, afterward it will sit and wait for any new traefik enabled containers to start and then updtae them. If this container restarts, it'll re-update everything.

Idea taken from the following GitHub repo: https://github.com/tiredofit/docker-traefik-cloudflare-companion

Why write this, and not use the above repo?

I didn't like the following things (just my preference):

  • No updating of existing records
  • No exclusions
  • Python 2
  • Stuff not needed for the operation of this service within the container
  • Bash and python mix

What I did like:

  • The general idea, wildcard domains are not nice
  • The fact it's at least in python
  • The elegant usage of docker events to update new containers

Usage

Example docker-compose.yml service:

dnsupdater:
image: dchidell/traefik-cloudflare-updater
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- [email protected]
- CF_TOKEN=1234567890
- TARGET_DOMAIN=example.com
- DOMAIN1=mydomain1.com
- DOMAIN1_ZONE_ID=1234567890
- DOMAIN2=mydomain2.com
- DOMAIN2_ZONE_ID=1234567890
- EXCLUDED_DOMAINS=static.mydomain1.com,test.mydomain2.com

Mandatory ENV vars:

CF_GLOBAL_KEY - CloudFlare API Key (This must be the GLOBAL key)

and

CF_EMAIL - CloudFlare API Email

Both CF_GLOBAL_KEY and CF_EMAIL are required if using the GLOBAL key.

or

CF_TOKEN (recommended) - CloudFlare API Token (This must be a user token, NOT the global key)

See https://github.com/cloudflare/python-cloudflare#providing-cloudflare-username-and-api-key for detailed information on CF authentication.

TARGET_DOMAIN - a CNAME will be created pointing to this target

DOMAIN# - Multiple of these per domain, e.g. DOMAIN1=example.com, DOMAIN2=example.net ... DOMAINn=example.org

DOMAIN#_ZONE_ID - CloudFlare zone ID for domain index.

Optional ENV vars:

DOMAIN#_PROXIED - Whether to use CloudFlare proxy. Should be 'TRUE' or 'FALSE' (not 1 or 0) (defaults to TRUE)

EXCLUDED_DOMAINS - Comma separated domains to be excluded from updating (i.e. if you want to statically define something) e.g. EXCLUDED_DOMAINS=sub.domain.com,sub2.domain.com

DOMAIN#_CF_TOKEN - Override domain.com CloudFlare token (

DOMAIN#_CF_EMAIL - Override domain.com CloudFlare email

DOMAIN#_CF_GLOBAL_KEY - Override domain.com CloudFlare global key

traefik-cloudflare-updater's People

Contributors

dchidell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.