Skip to content

Commit 2b2a488

Browse files
committed
Merge branch 'master' of github.com:DNSCrypt/dnscrypt-server-docker
* 'master' of github.com:DNSCrypt/dnscrypt-server-docker: Fix incorrect port in README for Docker Compose (#107) Updated Kubernetes configurations and added docker-compose support (#106)
2 parents 07e738a + 3dffc2f commit 2b2a488

7 files changed

Lines changed: 59 additions & 13 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ COPY encrypted-dns.sh /var/svc/encrypted-dns/run
7373

7474
COPY watchdog.sh /var/svc/watchdog/run
7575

76+
RUN ln -sf /opt/encrypted-dns/etc/keys/encrypted-dns.toml /opt/encrypted-dns/etc/encrypted-dns.toml
77+
7678
VOLUME ["/opt/encrypted-dns/etc/keys"]
7779

7880
EXPOSE 443/udp 443/tcp 9100/tcp

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Table of contents:
2020
- [TLS (including HTTPS and DoH) forwarding](#tls-including-https-and-doh-forwarding)
2121
- [Filtering](#filtering)
2222
- [Join the network](#join-the-network)
23+
- [Usage with Docker Compose](#usage-with-docker-compose)
2324
- [Usage with Kubernetes](#usage-with-kubernetes)
2425
- [Customizing Unbound](#customizing-unbound)
2526
- [Changing the Unbound configuration file](#changing-the-unbound-configuration-file)
@@ -202,15 +203,26 @@ in minutes.
202203

203204
- Create a static IP on GCE. This will be used for the LoadBalancer.
204205
- Edit `kube/dnscrypt-init-job.yml`. Change `example.com` to your desired hostname
205-
and `192.0.2.53` to your static IP.
206-
- Edit `kube/dnscrypt-srv.yml` and change `loadBalancerIP` to your static IP.
206+
and `127.0.0.1` to your static IP.
207+
- Edit `kube/dnscrypt-srv.yml` and change `loadBalancerIP` to your static IP in both locations.
207208
- Run `kubectl create -f kube/dnscrypt-init-job.yml` to setup your keys.
208209
- Run `kubectl create -f kube/dnscrypt-deployment.yml` to deploy the dnscrypt server.
209210
- Run `kubectl create -f kube/dnscrypt-srv.yml` to expose your server to the world.
210211

211212
To get your public key just view the logs for the `dnscrypt-init` job. The public
212213
IP for your server is merely the `dnscrypt` service address.
213214

215+
# Usage with Docker Compose
216+
217+
You can setup a server very quickly with Docker Compose.
218+
219+
- Run `docker-compose up`
220+
- Ctrl-C after keys are setup.
221+
- Edit `docker-compose.yml` to use the start command.
222+
- Run `docker-compose up`
223+
224+
Now you will have a local server running on port 5443.
225+
214226
# Customizing Unbound
215227

216228
## Changing the Unbound configuration file

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3"
2+
services:
3+
dnscrypt:
4+
image: zquestz/dnscrypt-server:latest
5+
container_name: dnscrypt
6+
restart: always
7+
command: "init -N example.com -E '127.0.0.1:5443'"
8+
# command: "start"
9+
ports:
10+
- '5443:5443/udp'
11+
- '5443:5443/tcp'
12+
volumes:
13+
- keys:/opt/encrypted-dns/etc/keys
14+
environment:
15+
- TZ='UTC'
16+
volumes:
17+
keys:

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ KEYS_DIR="/opt/encrypted-dns/etc/keys"
1111
STATE_DIR="${KEYS_DIR}/state"
1212
LISTS_DIR="/opt/encrypted-dns/etc/lists"
1313
CONF_DIR="/opt/encrypted-dns/etc"
14-
CONFIG_FILE="${CONF_DIR}/encrypted-dns.toml"
14+
CONFIG_FILE="${KEYS_DIR}/encrypted-dns.toml"
1515
CONFIG_FILE_TEMPLATE="${CONF_DIR}/encrypted-dns.toml.in"
1616
SERVICES_DIR="/etc/runit/runsvdir/svmanaged"
1717

kube/dnscrypt-deployment.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: extensions/v1beta1
1+
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
namespace: default
@@ -9,22 +9,30 @@ spec:
99
strategy:
1010
type: Recreate
1111
replicas: 1
12+
selector:
13+
matchLabels:
14+
service: dnscrypt
1215
template:
1316
metadata:
1417
labels:
1518
service: dnscrypt
1619
spec:
1720
containers:
18-
- env:
19-
image: jedisct1/dnscrypt-server
21+
- image: zquestz/dnscrypt-server:latest
22+
imagePullPolicy: Always
2023
name: dnscrypt
24+
ports:
25+
- containerPort: 5443
26+
protocol: UDP
27+
- containerPort: 5443
28+
protocol: TCP
2129
volumeMounts:
2230
- name: dnscrypt-keys
2331
mountPath: /opt/encrypted-dns/etc/keys
2432
command: ["/entrypoint.sh", "start"]
2533
resources:
2634
requests:
27-
memory: "1Gi"
35+
memory: "64Mi"
2836
restartPolicy: Always
2937
volumes:
3038
- name: dnscrypt-keys

kube/dnscrypt-init-job.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ spec:
99
spec:
1010
containers:
1111
- name: dnscrypt-init
12-
image: jedisct1/dnscrypt-server
13-
command: ["/entrypoint.sh", "init", "-A", "-M", "0.0.0.0:9100", "-N", "example.com", "-E", "192.0.2.53:443"]
12+
image: zquestz/dnscrypt-server:latest
13+
imagePullPolicy: Always
14+
command: ["/entrypoint.sh", "init", "-A", "-M", "0.0.0.0:9100", "-N", "example.com", "-E", "127.0.0.1:5443"]
1415
volumeMounts:
1516
- name: dnscrypt-keys
1617
mountPath: /opt/encrypted-dns/etc/keys

kube/dnscrypt-srv.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@ kind: Service
33
metadata:
44
name: dnscrypt-tcp
55
namespace: default
6+
annotations:
7+
cloud.google.com/network-tier: Standard
68
spec:
79
ports:
810
- protocol: TCP
9-
port: 443
10-
targetPort: 443
11+
port: 5443
12+
targetPort: 5443
1113
selector:
1214
service: dnscrypt
1315
type: LoadBalancer
1416
loadBalancerIP: 0.0.0.0
17+
externalTrafficPolicy: Local
1518
---
1619
apiVersion: v1
1720
kind: Service
1821
metadata:
1922
name: dnscrypt-udp
2023
namespace: default
24+
annotations:
25+
cloud.google.com/network-tier: Standard
2126
spec:
2227
ports:
2328
- protocol: UDP
24-
port: 443
25-
targetPort: 443
29+
port: 5443
30+
targetPort: 5443
2631
selector:
2732
service: dnscrypt
2833
type: LoadBalancer
2934
loadBalancerIP: 0.0.0.0
35+
externalTrafficPolicy: Local

0 commit comments

Comments
 (0)