diff --git a/cmd/dnsp/.gitignore b/cmd/dnsp/.gitignore new file mode 100644 index 0000000..718d694 --- /dev/null +++ b/cmd/dnsp/.gitignore @@ -0,0 +1 @@ +dnsp diff --git a/cmd/dnsp/Dockerfile b/cmd/dnsp/Dockerfile new file mode 100644 index 0000000..e968903 --- /dev/null +++ b/cmd/dnsp/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:latest + +RUN apt-get update +RUN apt-get install dnsutils -y +RUN mkdir /app +ADD *.go /app/ +WORKDIR /app +RUN go get -u github.com/gophergala/dnsp/... +RUN go build -o /app/dnsp + +EXPOSE 53 + +ENTRYPOINT ["/app/dnsp"] diff --git a/cmd/dnsp/Makefile b/cmd/dnsp/Makefile new file mode 100644 index 0000000..cd3929e --- /dev/null +++ b/cmd/dnsp/Makefile @@ -0,0 +1,6 @@ +build: + docker build . -t dnsp +serve: + docker run --rm -p 53:53/udp dnsp --resolve 8.8.4.4,8.8.8.8 --blacklist=https://hosts-file.net/download/hosts.txt --poll 1h -l 0.0.0.0:53 +debug: + docker run --rm -p 5353:53/udp dnsp --resolve 8.8.4.4,8.8.8.8 --blacklist=https://hosts-file.net/download/hosts.txt --poll 1h -l 0.0.0.0:53 diff --git a/cmd/dnsp/README.md b/cmd/dnsp/README.md new file mode 100644 index 0000000..6ee66a5 --- /dev/null +++ b/cmd/dnsp/README.md @@ -0,0 +1,14 @@ +# dnsp +DNSP Server binary and docker file. + +### Building Docker Image + +`make build` + +### Running Docker Container Locally (port 5353) + +`make debug` + +### Running Docker Container as Server (port 53) + +`make serve` diff --git a/cmd/dnsp/deployment.yaml b/cmd/dnsp/deployment.yaml new file mode 100644 index 0000000..d9dcda6 --- /dev/null +++ b/cmd/dnsp/deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: dnsp-home + labels: + app: dnsp-home +spec: + revisionHistoryLimit: 1 + replicas: 2 + selector: + matchLabels: + app: dnsp-home + strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + type: RollingUpdate + template: + metadata: + labels: + app: dnsp-home + name: dnsp-home + spec: + terminationGracePeriodSeconds: 15 + containers: + - args: + - --blacklist=https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts + - --poll=72h + - --resolve=8.8.8.8,4.4.4.4 + name: "dnsp-home" + image: "docker.io/integrii/dnsp" + imagePullPolicy: Always + resources: + requests: + memory: "50Mi" + cpu: "100m" + readinessProbe: + exec: + command: + - "nslookup" + - "google.com." + - "127.0.0.1" + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 1 + livenessProbe: + exec: + command: + - "nslookup" + - "google.com." + - "127.0.0.1" + initialDelaySeconds: 120 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 1 + ports: + - containerPort: 53 + name: dns-server + protocol: UDP diff --git a/cmd/dnsp/service.yaml b/cmd/dnsp/service.yaml new file mode 100644 index 0000000..27f510e --- /dev/null +++ b/cmd/dnsp/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: dnsp-home + name: dnsp-home +spec: + ports: + - port: 53 + protocol: UDP + targetPort: dns-server + selector: + app: dnsp-home + type: LoadBalancer