-
-
Save derhuerst/bcb831fb994e47c63c0179dfc6d7f098 to your computer and use it in GitHub Desktop.
build CoreDNS with a plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
cd "$(dirname $(realpath $0))" | |
set -x | |
# update Go | |
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu | |
# todo: determine latest version automatically | |
go_version='1.17.6' | |
cd /tmp | |
wget -c "https://golang.org/dl/go$go_version.linux-amd64.tar.gz" | |
mkdir -p "go$go_version" | |
tar -C "go$go_version" -xzf "go$go_version.linux-amd64.tar.gz" | |
rm -r /usr/local/go | |
mv "go$go_version/go" /usr/local/go | |
go version | |
# update coredns | |
cd ~/coredns | |
git fetch | |
latest_tag="$(curl 'https://api.github.com/repos/coredns/coredns/releases/latest' -L -s | jq .tag_name -r)" | |
git reset --hard "$latest_tag" | |
# pull ACME plugin | |
# https://github.com/chinzhiweiblank/coredns-acme/blob/v1.0.2/README.md#getting-started | |
echo 'acme:github.com/chinzhiweiblank/coredns-acme' >>plugin.cfg | |
go get github.com/chinzhiweiblank/coredns-acme | |
go generate | |
go mod tidy | |
# build & update coredns | |
go build | |
./coredns -version | |
mv coredns /usr/local/bin/ | |
systemctl restart coredns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment