Giter Site home page Giter Site logo

thomasdevoogdt / cloudflare-ddns Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 4.0 17 KB

Simple multi-record Cloudflare DDNS update script for domain and subdomains.

License: MIT License

Python 93.31% Dockerfile 6.69%
ddns-updater cloudflare-api python docker-image

cloudflare-ddns's Introduction

cloudflare-ddns

Simple multi-record Cloudflare DDNS update script for domain and subdomains. I just created a quick and dirty sketch to update my personal DDNS records. It should be enough for most users, feel free to use. The reason why I didn't use one of the hundreds of existing docker DDNS services is that I couldn't find any that supports multi-record DDNS updates.

usage

  • --config: config path
  • --repeat: (optional) repeat every x seconds
  • --log-level: (optional) debug/info/error
  • --force: (optional) force ip upload
$ python3.6 main.py --config config.json [--repeat 30] [--force]

Arguments can also be applied with environment variables, prefixed with "DDNS_":

  • export DDNS_CONFIG=config.json
  • export DDNS_REPEAT=30
  • export DDNS_LOG_LEVEL=debug

config.json

  • email: cloudflare account
  • key: global api key
{
    "auth": {
        "email": "[email protected]",
        "key": "c2547eb745079dac9320b638f5e225cf483cc5cfdda41"
    },
    "zone": {
        "name": "example.com",
        "records": [
            "example.com",
            "www.example.com",
            "foo.example.com",
            "bar.example.com"
        ]
    }
}

config.json v2.0

Records can now also be defined with a dictionary. The record should always contain the "name" key. See the record object definitions for optional attributes at https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record.

{
    "auth": {
        "email": "[email protected]",
        "key": "c2547eb745079dac9320b638f5e225cf483cc5cfdda41"
    },
    "zone": {
        "name": "example.com",
        "records": [
            "example.com",
            {"name": "www.example.com", "proxied": true},
            "foo.example.com",
            {"name": "bar.example.com", "proxied": false}
        ]
    }
}

config.json v3.0

More than one zone can now be defined under the "zones" key. The old "zone" key is still valid and is seen as one zone.

{
    "auth": {
        "email": "[email protected]",
        "key": "c2547eb745079dac9320b638f5e225cf483cc5cfdda41"
    },
    "zones": [
        {
            "name": "example.com",
            "records": [
                "example.com",
                "foo.example.com",
            ]
        },
        {
            "name": "example2.com",
            "records": [
                "example2.com",
                "bar.example2.com",
            ]
        }
    ]
}

docker

getting started
docker pull command

https://hub.docker.com/r/thomasdevoogdt/cloudflare-ddns

docker pull thomasdevoogdt/cloudflare-ddns
docker manual build
  • cloudflare-ddns: self chosen name
docker build -t cloudflare-ddns .
run
with command options
  • -v $(pwd)/config.json:/config.json: mount config folder to docker container
  • --config config.json --repeat 30: the same usage of the main.py app

Note: The manual build container needs to be run with the chosen name cloudflare-ddns.

docker run -v $(pwd)/config.json:/config.json -t thomasdevoogdt/cloudflare-ddns --config config.json --repeat 30
with environment variables
  • -v $(pwd)/config.json:/config.json: mount config folder to docker container
  • -e DDNS_CONFIG='config.json' -e DDNS_REPEAT='10': the same usage of the main.py app

Note: The manual build container needs to be run with the chosen name cloudflare-ddns.

docker run -v $(pwd)/config.json:/config.json -t -e DDNS_CONFIG='config.json' -e DDNS_REPEAT='10' thomasdevoogdt/cloudflare-ddns

cloudflare-ddns's People

Contributors

sgoudsme avatar thomasdevoogdt avatar

Watchers

 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.