github.com/philhug/dnscontrol@v0.2.4-0.20180625181521-921fa9849001/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   - Linode
    24   - Namecheap
    25   - Name.com
    26   - NS1
    27   - Route 53
    28   - SoftLayer
    29   - Vultr
    30   - OVH
    31  
    32  At Stack Overflow, we use this system to manage hundreds of domains
    33  and subdomains across multiple registrars and DNS providers.
    34  
    35  You can think of it as a DNS compiler.  The configuration files are
    36  written in a DSL that looks a lot like JavaScript.  It is compiled
    37  to an intermediate representation (IR).  Compiler back-ends use the
    38  IR to update your DNS zones on services such as Route53, CloudFlare,
    39  and Gandi, or systems such as BIND and ActiveDirectory.
    40  
    41  # An Example
    42  
    43  `dnsconfig.js`:
    44  
    45  ```js
    46  // define our registrar and providers
    47  var namecom = NewRegistrar("name.com", "NAMEDOTCOM");
    48  var r53 = NewDnsProvider("r53", "ROUTE53")
    49  
    50  D("example.com", namecom, DnsProvider(r53),
    51    A("@", "1.2.3.4"),
    52    CNAME("www","@"),
    53    MX("@",5,"mail.myserver.com."),
    54    A("test", "5.6.7.8")
    55  )
    56  ```
    57  
    58  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.
    59  
    60  Running `dnscontrol push` will make those changes with the provider and my dns records will be correctly updated.
    61  
    62  See [Getting Started](https://stackexchange.github.io/dnscontrol/getting-started) page on documentation site.
    63  
    64  # Benefits
    65  
    66  * Editing zone files is error-prone.  Clicking buttons on a web
    67  page is irreproducible.
    68  * Switching DNS providers becomes a no-brainer.  The DNSControl
    69  language is vendor-agnostic.  If you use it to maintain your DNS
    70  zone records, you can switch between DNS providers easily. In fact,
    71  DNSControl will upload your DNS records to multiple providers, which
    72  means you can test one while switching to another. We've switched
    73  providers 3 times in three years and we've never lost a DNS record.
    74  * Adopt CI/CD principles to DNS!  At StackOverflow we maintain our
    75  DNSControl configurations in Git and use our CI system to roll out
    76  changes.  Keeping DNS information in a VCS means we have full
    77  history.  Using CI enables us to include unit-tests and system-tests.
    78  Remember when you forgot to include a "." at the end of an MX record?
    79  We haven't had that problem since we included a test to make sure
    80  Tom doesn't make that mistake... again.
    81  * Variables save time!  Assign an IP address to a constant and use
    82  the variable name throughout the file. Need to change the IP address
    83  globally? Just change the variable and "recompile."
    84  * Macros!  Define your SPF records, MX records, or other repeated
    85  data once and re-use them for all domains.
    86  * Control CloudFlare from a single location.  Enable/disable
    87  Cloudflare proxying (the "orange cloud" button) directly from your
    88  DNSControl files.
    89  * Keep similar domains in sync with transforms and other features.
    90  If one domain is supposed to be the same
    91  * It is extendable!  All the DNS providers are written as plugins.
    92  Writing new plugins is very easy.
    93  
    94  # Installation
    95  
    96  ## From source
    97  
    98  DNSControl can be built with Go version 1.7 or higher. To install, simply run 
    99  
   100  `go get github.com/StackExchange/dnscontrol`
   101  
   102  dnscontrol should be installed in $GOPATH/bin
   103  
   104  ## Via packages
   105  
   106  Get prebuilt binaries from [github releases](https://github.com/StackExchange/dnscontrol/releases/latest)
   107  
   108  ## Via [docker](https://hub.docker.com/r/stackexchange/dnscontrol/)
   109  
   110  ```
   111  docker run --rm -it -v $(pwd)/dnsconfig.js:/dns/dnsconfig.js -v $(pwd)/creds.json:/dns/creds.json stackexchange/dnscontrol dnscontrol preview
   112  ```