Coder Social home page Coder Social logo

digital-ocean-dns's Introduction

digital-ocean-dns

Generate and sync DNS zones from YAML to Digital Ocean's domains API.

setup

This requires a few Python modules to run. Install using pip:

$ pip install -r requirements.txt

Build a zone config in YAML format with the following format, or start from the sample config included in this repo:

token: your-digital-ocean-api-token
address: 127.0.0.1
defaults:
    - "NS @ ns1.digitalocean.com"
---
domain.com:
    - "A @ {address}"

usage

Check the current state of your domain records in Digital Ocean:

$ ./dodns.py print domains.yml
noswap.com
     NS @          ns1.digitalocean.com
     NS @          ns2.digitalocean.com
     NS @          ns3.digitalocean.com
      A @          127.0.0.1

Generate the expected state of your domains with the given configuration:

$ ./dodns.py calc domains.yml
noswap.com
     NS @          ns1.digitalocean.com.
     NS @          ns2.digitalocean.com.
     NS @          ns3.digitalocean.com.
     MX          1 aspmx.l.google.com.
     MX          5 alt1.aspmx.l.google.com.
     MX          5 alt2.aspmx.l.google.com.
     MX         10 alt3.aspmx.l.google.com.
     MX         10 alt4.aspmx.l.google.com.
    TXT @          keybase-site-verification=61SfD6EF6d3aurMV1ZehczN0OBgpPkjGlac3psdFw5s
    TXT @          v=spf1 include:_spf.google.com a mx -all
  CNAME *          @
   AAAA @          ::1
      A @          127.0.0.1

Calculate the differences between Digital Ocean and your configuration:

$ ./dodns.py diff domains.yml
noswap.com
+    MX          1 aspmx.l.google.com.
+    MX          5 alt1.aspmx.l.google.com.
+    MX          5 alt2.aspmx.l.google.com.
+    MX         10 alt3.aspmx.l.google.com.
+    MX         10 alt4.aspmx.l.google.com.
+   TXT @          keybase-site-verification=61SfD6EF6d3aurMV1ZehczN0OBgpPkjGlac3psdFw5s
+   TXT @          v=spf1 include:_spf.google.com a mx -all
+ CNAME *          @
+  AAAA @          ::1

Sync differences from configuration back to Digital Ocean:

$ ./dodns.py sync domains.yml

Verify new state in Digital Ocean:

$ ./dodns.py print domains.yml
noswap.com
     NS @          ns1.digitalocean.com
     NS @          ns2.digitalocean.com
     NS @          ns3.digitalocean.com
     MX          1 aspmx.l.google.com
     MX          5 alt1.aspmx.l.google.com
     MX          5 alt2.aspmx.l.google.com
     MX         10 alt3.aspmx.l.google.com
     MX         10 alt4.aspmx.l.google.com
    TXT @          keybase-site-verification=61SfD6EF6d3aurMV1ZehczN0OBgpPkjGlac3psdFw5s
    TXT @          v=spf1 include:_spf.google.com a mx -all
  CNAME *          noswap.com.
   AAAA @          ::1
      A @          127.0.0.1

license

Copyright 2016 John Reese, and licensed under the MIT License. See the LICENSE file for details.

digital-ocean-dns's People

Contributors

amyreese avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.