github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/README.md (about)

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