github.com/pmoroney/dnscontrol@v0.2.4-0.20171024134423-fad98f73f44a/README.md (about)

     1  # DNSControl
     2  
     3  [![Build Status](https://travis-ci.org/StackExchange/dnscontrol.svg?branch=master)](https://travis-ci.org/StackExchange/dnscontrol)
     4  [![Gitter chat](https://badges.gitter.im/dnscontrol/Lobby.png)](https://gitter.im/dnscontrol/Lobby)
     5  [![Google Group chat](https://img.shields.io/badge/google%20group-chat-green.svg)](https://groups.google.com/forum/#!forum/dnscontrol-discuss)
     6  
     7  DNSControl is a system for maintaining DNS zones.  It has two parts:
     8  a domain specific language (DSL) for describing DNS zones plus
     9  software that processes the DSL and pushes the resulting zones to
    10  DNS providers such as Route53, CloudFlare, and Gandi.  It can talk
    11  to Microsoft ActiveDirectory and it generates the most beautiful
    12  BIND zone files ever.  It runs anywhere Go runs (Linux, macOS,
    13  Windows). The provider model is extensible, so more providers can be added.
    14  
    15  Currently supported DNS providers:
    16   - Active Directory
    17   - BIND
    18   - CloudFlare
    19   - Digitalocean
    20   - DNSimple
    21   - Gandi
    22   - Google
    23   - Namecheap
    24   - Name.com
    25   - NS1
    26   - Route 53
    27   - SoftLayer
    28   - Vultr
    29  
    30  At Stack Overflow, we use this system to manage hundreds of domains
    31  and subdomains across multiple registrars and DNS providers.
    32  
    33  You can think of it as a DNS compiler.  The configuration files are
    34  written in a DSL that looks a lot like JavaScript.  It is compiled
    35  to an intermediate representation (IR).  Compiler back-ends use the
    36  IR to update your DNS zones on services such as Route53, CloudFlare,
    37  and Gandi, or systems such as BIND and ActiveDirectory.
    38  
    39  # An Example
    40  
    41  `dnsconfig.js`:
    42  
    43  ```js
    44  // define our registrar and providers
    45  var namecom = NewRegistrar("name.com", "NAMEDOTCOM");
    46  var r53 = NewDnsProvider("r53", "ROUTE53")
    47  
    48  D("example.com", namecom, DnsProvider(r53),
    49    A("@", "1.2.3.4"),
    50    CNAME("www","@"),
    51    MX("@",5,"mail.myserver.com."),
    52    A("test", "5.6.7.8")
    53  )
    54  ```
    55  
    56  Running `dnscontrol preview` will talk to the providers (here name.com as registrar and route 53 as the dns host), and determine what changes need to be made.
    57  
    58  Running `dnscontrol push` will make those changes with the provider and my dns records will be correctly updated.
    59  
    60  See [Getting Started](https://stackexchange.github.io/dnscontrol/getting-started) page on documentation site.
    61  
    62  # Benefits
    63  
    64  * Editing zone files is error-prone.  Clicking buttons on a web
    65  page is irreproducible.
    66  * Switching DNS providers becomes a no-brainer.  The DNSControl
    67  language is vendor-agnostic.  If you use it to maintain your DNS
    68  zone records, you can switch between DNS providers easily. In fact,
    69  DNSControl will upload your DNS records to multiple providers, which
    70  means you can test one while switching to another. We've switched
    71  providers 3 times in three years and we've never lost a DNS record.
    72  * Adopt CI/CD principles to DNS!  At StackOverflow we maintain our
    73  DNSControl configurations in Git and use our CI system to roll out
    74  changes.  Keeping DNS information in a VCS means we have full
    75  history.  Using CI enables us to include unit-tests and system-tests.
    76  Remember when you forgot to include a "." at the end of an MX record?
    77  We haven't had that problem since we included a test to make sure
    78  Tom doesn't make that mistake... again.
    79  * Variables save time!  Assign an IP address to a constant and use
    80  the variable name throughout the file. Need to change the IP address
    81  globally? Just change the variable and "recompile."
    82  * Macros!  Define your SPF records, MX records, or other repeated
    83  data once and re-use them for all domains.
    84  * Control CloudFlare from a single location.  Enable/disable
    85  Cloudflare proxying (the "orange cloud" button) directly from your
    86  DNSControl files.
    87  * Keep similar domains in sync with transforms and other features.
    88  If one domain is supposed to be the same
    89  * It is extendable!  All the DNS providers are written as plugins.
    90  Writing new plugins is very easy.
    91  
    92  # Installation
    93  
    94  ## From source
    95  
    96  DNSControl can be built with Go version 1.7 or higher. To install, simply run 
    97  
    98  `go get github.com/StackExchange/dnscontrol`
    99  
   100  dnscontrol should be installed in $GOPATH/bin
   101  
   102  ## Via packages
   103  
   104  Get prebuilt binaries from [github releases](https://github.com/StackExchange/dnscontrol/releases/latest)
   105  
   106  ## Via [docker](https://hub.docker.com/r/stackexchange/dnscontrol/)
   107  
   108  ```
   109  docker run --rm -it -v $(pwd)/dnsconfig.js:/dns/dnsconfig.js -v $(pwd)/creds.json:/dns/creds.json stackexchange/dnscontrol dnscontrol preview
   110  ```