-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
343 lines (317 loc) · 8.13 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
services:
powerhole-pdns-auth-db:
image: postgres:13
container_name: powerhole-pdns-auth-db
hostname: powerhole-pdns-auth-db
restart: always
mem_limit: "100M"
networks:
- powerhole-pdns-auth-db
environment:
POSTGRES_DB: powerhole
POSTGRES_USER: powerhole
POSTGRES_PASSWORD_FILE: /run/secrets/db_passwd
volumes:
- db_auth:/var/lib/postgresql/data
- ./authoritative/init.sql:/docker-entrypoint-initdb.d/init.sql
secrets:
- db_passwd
user: postgres:postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U pdns" ]
interval: 10s
timeout: 5s
retries: 10
cap_drop:
- ALL
security_opt:
- no-new-privileges
powerhole-pdns-authoritative:
build:
context: authoritative
# args:
# LOG_LEVEL: 6 # 3 - 6 (https://doc.powerdns.com/authoritative/settings.html#loglevel)
image: powerhole:authoritative
container_name: powerhole-pdns-authoritative
hostname: powerhole-pdns-authoritative
restart: always
mem_limit: "100M"
networks:
powerhole-pdns-auth-db:
powerhole-pdns-admin:
powerhole-pdns-authoritative:
ipv4_address: "172.26.0.122"
depends_on:
powerhole-pdns-auth-db:
condition: service_healthy
cap_drop:
- ALL
security_opt:
- no-new-privileges
powerhole-pdns-admin-db:
image: postgres:13
container_name: powerhole-pdns-admin-db
hostname: powerhole-pdns-admin-db
restart: always
mem_limit: "100M"
networks:
- powerhole-pdns-admin-db
environment:
POSTGRES_DB: powerhole_admin
POSTGRES_USER: powerhole_admin
POSTGRES_PASSWORD_FILE: /run/secrets/admin_db_password
volumes:
- db_admin:/var/lib/postgresql/data
secrets:
- admin_db_password
user: postgres:postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U pdns_admin" ]
interval: 10s
timeout: 5s
retries: 10
cap_drop:
- ALL
security_opt:
- no-new-privileges
powerhole-pdns-admin:
image: powerhole:admin
container_name: powerhole-pdns-admin
hostname: powerhole-pdns-admin
restart: always
mem_limit: "200M"
networks:
- powerhole-pdns-admin-db
- powerhole-pdns-admin
- powerhole-nginx-admin
environment:
- SECRET_KEY_FILE=/run/secrets/pdns_admin_secret_key
- SQLALCHEMY_DATABASE_URI_FILE=/run/secrets/db_uri
- GUNICORN_TIMEOUT=60
- GUNICORN_WORKERS=1
secrets:
- pdns_admin_secret_key
- db_uri
depends_on:
powerhole-pdns-admin-db:
condition: service_healthy
powerhole-pdns-authoritative:
condition: service_healthy
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
security_opt:
- no-new-privileges
powerhole-pdns-recursor:
build:
context: recursor
args:
LOG_LEVEL: 9 # 0 - 9 (https://doc.powerdns.com/recursor/settings.html#loglevel)
image: powerhole:recursor
container_name: powerhole-pdns-recursor
hostname: powerhole-pdns-recursor
restart: always
mem_limit: "50M"
init: true
networks:
powerhole-pdns-recursor:
ipv4_address: "172.26.0.114"
depends_on:
powerhole-pdns-authoritative:
condition: service_healthy
cap_drop:
- ALL
security_opt:
- no-new-privileges
powerhole-pdns-forwarder:
build: forwarder
image: powerhole:forwarder
container_name: powerhole-pdns-forwarder
hostname: powerhole-pdns-forwarder
restart: always
mem_limit: "50M"
init: true
networks:
powerhole-pdns-authoritative:
ipv4_address: "172.26.0.123"
powerhole-pdns-recursor:
ipv4_address: "172.26.0.115"
powerhole-pdns-forwarder:
ipv4_address: "172.26.0.130"
depends_on:
powerhole-pdns-authoritative:
condition: service_healthy
powerhole-pdns-recursor:
condition: service_healthy
cap_drop:
- ALL
security_opt:
- no-new-privileges
powerhole-pihole:
image: pihole/pihole:2024.07.0
container_name: powerhole-pihole
hostname: powerhole-pihole
restart: always
mem_limit: "50M"
ports:
- "53:53/tcp"
- "53:53/udp"
networks:
powerhole-pdns-forwarder:
ipv4_address: "172.26.0.131"
powerhole-nginx-pihole:
environment:
- TZ=Europe/Amsterdam
- PIHOLE_DNS_=172.26.0.130
- DNSMASQ_LISTENING=all
- DNS_BOGUS_PRIV=false # Forward private reverse lookups
volumes:
- pihole:/etc/pihole/
- dnsmasq:/etc/dnsmasq.d/
depends_on:
powerhole-pdns-forwarder:
condition: service_healthy
cap_drop:
- ALL
cap_add:
- AUDIT_WRITE
- CHOWN
- DAC_OVERRIDE
- FOWNER
- KILL
- SETGID
- SETUID
- SETFCAP
powerhole-nginx:
image: nginxinc/nginx-unprivileged:1.27.0
container_name: powerhole-nginx
hostname: powerhole-nginx
restart: always
mem_limit: "50M"
ports:
- "80:8080"
- "443:44380"
networks:
- powerhole-nginx-admin
- powerhole-nginx-pihole
volumes:
- type: bind
source: ./nginx/nginx.conf
target: /etc/nginx/nginx.conf
- type: bind
source: ./nginx/admin.conf
target: /etc/nginx/conf.d/default.conf
- type: bind
source: ./nginx/pihole.conf
target: /etc/nginx/conf.d/pihole.conf
secrets:
- source: certificate
target: /srv/ssl/fullchain.pem
- source: private_key
target: /srv/ssl/privkey.pem
- source: dh_params
target: /srv/ssl/dhparams.pem
depends_on:
powerhole-pdns-admin:
condition: service_healthy
powerhole-pihole:
condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "curl -sfk https://localhost:44380/health/ || exit 1" ]
interval: 30s
timeout: 5s
retries: 3
cap_drop:
- ALL
security_opt:
- no-new-privileges
volumes:
db_auth:
db_admin:
pihole:
dnsmasq:
secrets:
db_passwd:
file: ./secrets/db_password.txt
pdns_admin_secret_key:
file: ./secrets/pdns_admin_secret_key.txt
admin_db_password:
file: ./secrets/admin_db_password.txt
db_uri:
file: ./secrets/db_uri.txt
certificate:
file: ./secrets/ssl/fullchain.pem
private_key:
file: ./secrets/ssl/privkey.pem
dh_params:
file: ./secrets/ssl/dhparams.pem
networks:
powerhole-pdns-auth-db:
name: powerhole-pdns-auth-db
internal: true
ipam:
driver: default
config:
- subnet: "172.26.0.88/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_auth_db
powerhole-pdns-admin-db:
name: powerhole-pdns-admin-db
internal: true
ipam:
driver: default
config:
- subnet: "172.26.0.96/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_admin_db
powerhole-pdns-admin:
name: powerhole-pdns-admin
internal: true
ipam:
driver: default
config:
- subnet: "172.26.0.104/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_admin
powerhole-pdns-recursor:
name: powerhole-pdns-recursor
ipam:
driver: default
config:
- subnet: "172.26.0.112/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_rec
powerhole-pdns-authoritative:
name: powerhole-pdns-authoritative
internal: true
ipam:
driver: default
config:
- subnet: "172.26.0.120/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_auth
powerhole-pdns-forwarder:
name: powerhole-pdns-forwarder
ipam:
driver: default
config:
- subnet: "172.26.0.128/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_fwd
powerhole-nginx-admin:
name: powerhole-nginx-admin
ipam:
driver: default
config:
- subnet: "172.26.0.136/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_ng_admin
powerhole-nginx-pihole:
name: powerhole-nginx-pihole
ipam:
driver: default
config:
- subnet: "172.26.0.144/29"
driver_opts:
com.docker.network.bridge.name: dbr-ph_ng_hole