Skip to content

Commit

Permalink
Merge pull request #16 from nlnwa/log-service
Browse files Browse the repository at this point in the history
Refactor and utilize forward plugin to enable multiple upstream servers
  • Loading branch information
Langvann authored Mar 25, 2021
2 parents 6573d2e + 83785fe commit 5b9e052
Show file tree
Hide file tree
Showing 1,225 changed files with 3,495 additions and 504,601 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/.idea/

# Binaries
/resolve
/veidemann-dns-resolver
36 changes: 17 additions & 19 deletions Corefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
.:53 {
resolve 8053
archivingcache {
eviction 1h
maxSizeMb 2048
contentWriterHost {$CONTENT_WRITER_HOST}
contentWriterPort {$CONTENT_WRITER_PORT}
dbHost {$DB_HOST}
dbPort {$DB_PORT}
dbUser {$DB_USER}
dbPassword {$DB_PASSWORD}
dbName {$DB_NAME}
upstreamDNS {$DNS_SERVER}
.:1053 {
resolve :8443
prometheus :9153
debug
errors
log
forward . 8.8.8.8 1.1.1.1 9.9.9.9 {
# except IGNORED_NAMES...
# force_tcp
# prefer_udp
# expire DURATION
# max_fails INTEGER
# tls CERT KEY CA
# tls_servername NAME
# policy random|round_robin|sequential
# health_check DURATION [no_rec]
# max_concurrent MAX
}
# log . {
# class denial error
# }
prometheus 0.0.0.0:9153
health :8080
#debug
}
29 changes: 29 additions & 0 deletions Corefile.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.:53 {
ready :8181
resolve :8053
prometheus :9153
single
archivingcache {
eviction 1h
maxSizeMb 2048
contentWriterHost {$CONTENT_WRITER_HOST}
contentWriterPort {$CONTENT_WRITER_PORT}
dbHost {$DB_HOST}
dbPort {$DB_PORT}
dbUser {$DB_USER}
dbPassword {$DB_PASSWORD}
dbName {$DB_NAME}
}
forward . {$DNS_SERVER} {
# except IGNORED_NAMES...
# force_tcp
# prefer_udp
# expire DURATION
# max_fails INTEGER
# tls CERT KEY CA
# tls_servername NAME
# policy random|round_robin|sequential
# health_check DURATION [no_rec]
# max_concurrent MAX
}
}
39 changes: 22 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
FROM golang:1.11
FROM golang:1.15 as build

RUN apt-get update -qqy \
&& apt-get -qqy install unzip \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
WORKDIR /build

COPY plugin /go/src/github.com/nlnwa/veidemann-dns-resolver/plugin
COPY iputil /go/src/github.com/nlnwa/veidemann-dns-resolver/iputil
COPY vendor /go/src/github.com/nlnwa/veidemann-dns-resolver/vendor
COPY main.go /go/src/github.com/nlnwa/veidemann-dns-resolver/main.go
COPY go.mod go.sum ./
RUN go mod download

RUN cd /go/src/github.com/nlnwa/veidemann-dns-resolver \
&& go test -race ./... \
&& CGO_ENABLED=0 go build -tags netgo -o /coredns
COPY . .

RUN go test ./...
RUN CGO_ENABLED=0 go build -tags netgo

FROM alpine:latest

FROM gcr.io/distroless/base
LABEL maintainer="Norsk nettarkiv"

EXPOSE 53 53/udp 9153 8053 8080
# dns port
EXPOSE 53 53/udp
# veidemann.api.dnsresolver.Resolve
EXPOSE 8053
# prometheus metrics
EXPOSE 9153
# readiness
EXPOSE 8181

ENV DNS_SERVER=8.8.8.8 \
CONTENT_WRITER_HOST=contentwriter \
CONTENT_WRITER_HOST=veidemann-contentwriter \
CONTENT_WRITER_PORT=8080 \
DB_HOST=localhost \
DB_PORT=28015 \
DB_USER=admin \
DB_PASSWORD=admin \
DB_NAME=veidemann

COPY --from=0 /coredns /coredns
COPY Corefile /Corefile
COPY --from=0 /build/veidemann-dns-resolver /veidemann-dns-resolver
COPY Corefile.docker /Corefile

ENTRYPOINT ["/coredns"]
ENTRYPOINT ["/veidemann-dns-resolver"]
Loading

0 comments on commit 5b9e052

Please sign in to comment.