So… How do you automatically build “CoreDNS” as a plugin in Caddy?
Right now I manually edit caddy/caddymain/run.go and add my servertype. I would be nice to have some sort of automatic way of doing this, like caddyext did for plugins in the go’old days.
Preferable something that works with go get. Should I write a go generate thing that does this automatically…? Should not be too hard come to think of it…
We’ll probably be building a replacement for caddyext in the future, although the details remain to be decided. All it takes is adding a line to run.go.
Anyway, the build server on caddyserver.com does this for you, so most people won’t need it. And developers already have their hands in the code anyway. So I’m still unsure at how much this tool will need to do, really.
Hmm, call me old fashion, but I still like make to build me a binary that I can use. Also something like this will be needed for my travis tests (in the future). Having a build server is nice, but easy building from source is a big plus, esp for getting new devs involved.
A rather not play with sed/awk, so I think I will go ahead and use go/ast to add this one line, just so that I’m able to go build my project.
Also this would be a regression from the current CoreDNS, something I have a hard time accepting.
Double hmmm. I’m not sure where this go gen script should live… For now I will add some detailed notes in the README, but it would be nice of there is some for automation here.
Not sure I follow… you can do a git pull, yes, then add that line and build – should do the trick. Not sure how you want to add that import line though.
Sorry, I was in a rush and it was a bit terse. But yes, just what you said.
Shall I whip up an go gen thingy that adds that line? I think you should then be able to build with go build -tags=coredns and let it add that line. (I think)
So, next, how would my build work? Dev. downloads the CoreDNS repo, does a go get -u or whatever. This should pull in Caddy. (We can now assume caddy lives in ../../mholt/caddy??).
Anyway this script needs to be triggered, so when you you run go build in the coredns’s dir it will execute. This can be done as a go generate thing. OK done.
But now you need to build caddy yourself. This involves going to the caddymain’s dir and running ./build.bash. Then I would like to copy the caddy binary to my dir and rename it to coredns
I could make go generate execute these steps well, meaning the whole thing can still be build with go build.
If you’re distributing CoreDNS as its own binary from its own website, then yes, that is probably a good idea. But from the Caddy download page, for instance, there’s no reason that HTTP and DNS both can’t be compiled in. The user chooses at launch time which server type the Caddyfile is for.