Make CoreDNS a server type plugin for Caddy (#220)

* Make CoreDNS a server type plugin for Caddy

Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.

Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.

And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.

Fix Makefile to support new mode of operation.
This commit is contained in:
Miek Gieben
2016-08-19 17:14:17 -07:00
committed by GitHub
parent a1989c3523
commit 9ac3cab1b7
140 changed files with 2058 additions and 8229 deletions

View File

@@ -1,7 +1,8 @@
# CoreDNS
CoreDNS is DNS server that started as a fork of [Caddy](https://github.com/mholt/caddy/). It has the
same model: it chains middleware.
same model: it chains middleware. In fact to similar that CoreDNS is now a server type plugin for
CAddy, i.e. you'll need Caddy to compile CoreDNS.
CoreDNS is the successor of [SkyDNS](https://github.com/skynetservices/skydns). SkyDNS is a thin
layer that exposes services in etcd in the DNS. CoreDNS builds on this idea and is a generic DNS
@@ -38,7 +39,7 @@ There are still few [issues](https://github.com/miekg/coredns/issues), and work
things fast and reduce the memory usage.
All in all, CoreDNS should be able to provide you with enough functionality to replace parts of
BIND9, Knot, NSD or PowerDNS.
BIND9, Knot, NSD or PowerDNS and SkyDNS.
Most documentation is in the source and some blog articles can be [found
here](https://miek.nl/tags/coredns/). If you do want to use CoreDNS in production, please let us
know and how we can help.
@@ -46,6 +47,25 @@ know and how we can help.
<https://caddyserver.com/> is also full of examples on how to structure a Corefile (renamed from
Caddyfile when I forked it).
## Compilation
CoreDNS (as a servertype plugin for Caddy) has a hard dependency on Caddy - this is *almost* like
the normal Go dependencies, but with a small twist, caddy (the source) need to know that CoreDNS
exists and for this we need to add 1 line `_ "github.com/miekg/coredns/core"` to file in caddy.
You have the source of CoreDNS, this should preferably be downloaded under your `$GOPATH`. Get all
dependencies:
go get ./...
Then, execute `go generate`, this will patch Caddy to add CoreDNS, and then `go build` as you would
normally do:
go generate
go build
Should yield a `coredns` binary.
## Examples
Start a simple proxy:
@@ -95,15 +115,17 @@ All the above examples are possible with the *current* CoreDNS.
## What remains to be done
* Website?
* Logo?
* Optimizations.
* Load testing.
* The [issues](https://github.com/miekg/coredns/issues).
## Blog
## Blog and Contact
Website: <https://coredns.io>
Twitter: `@coredns.io`
Docs: <https://miek.nl/tags/coredns/>
Github: <https://github.com/miekg/coredns>
<https://miek.nl/tags/coredns/>
## Systemd service file
@@ -123,7 +145,7 @@ LimitNOFILE=8192
User=coredns
WorkingDirectory=/home/coredns
ExecStartPre=/sbin/setcap cap_net_bind_service=+ep /opt/bin/coredns
ExecStart=/opt/bin/coredns -pidfile /home/coredns/coredns.pid -conf=/etc/coredns
ExecStart=/opt/bin/coredns -pidfile /home/coredns/coredns.pid -conf=/etc/coredns/Corefile
ExecReload=/bin/kill -SIGUSR1 $MAINPID
Restart=on-failure