-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.vpn.yml
More file actions
356 lines (344 loc) · 10.9 KB
/
docker-compose.vpn.yml
File metadata and controls
356 lines (344 loc) · 10.9 KB
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
344
345
346
347
348
349
350
351
352
353
354
355
356
# Secure configuration for VPN-only access
# Bind Jenkins to localhost only - accessible only via VPN
services:
dnsmasq:
image: strm/dnsmasq:latest
container_name: dnsmasq
network_mode: host # Use host networking to serve DNS to VPN clients
cap_add:
- NET_ADMIN
- NET_BIND_SERVICE # Required to bind to port 53
volumes:
- dnsmasq_config:/etc/dnsmasq.d
- dnsmasq_leases:/var/lib/misc
command:
- --address=/hs/10.200.0.1
- --address=/jenkins.hs/10.200.0.1
- --address=/kanban.hs/10.200.0.1
- --address=/draw.hs/10.200.0.1
- --address=/diagram.hs/10.200.0.1
- --address=/startpage.hs/10.200.0.1
- --address=/tempmail.hs/10.200.0.1
- --address=/semaphoreui.hs/10.200.0.1
- --server=8.8.8.8
- --server=8.8.4.4
- --log-queries
- --no-resolv # Don't use /etc/resolv.conf
- --listen-address=10.200.0.1 # Listen only on VPN interface (10.200.0.1)
- --bind-interfaces # Only bind to specified interfaces
- --port=5353 # Use non-standard port to avoid conflict with systemd-resolved (port 53)
# Port forwarding: iptables redirects 10.200.0.1:53 → 10.200.0.1:5353 (see README)
depends_on:
- wireguard
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.1'
memory: 64M
# Note: dnsmasq listens on 10.200.0.1:5353 to avoid conflict with systemd-resolved (127.0.0.1:53)
# iptables port forwarding redirects 10.200.0.1:53 → 10.200.0.1:5353
# WireGuard clients use standard DNS = 10.200.0.1 (port 53, transparently forwarded to 5353)
wireguard:
image: linuxserver/wireguard:latest
container_name: wireguard
network_mode: host # Required for WireGuard to route traffic properly
# Note: With network_mode: host, ports are directly exposed on the host
# No port mapping needed - WireGuard listens on SERVERPORT (91820) directly
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- SERVERURL=${WIREGUARD_SERVER_URL:-auto} # Auto-detect or set to your VPS IP
- SERVERPORT=51820 # Port WireGuard listens on (must match actual listening port with host networking)
- PEERS=${WIREGUARD_PEERS:-1} # Number of client configs to generate
- PEERDNS=10.200.0.1 # Use dnsmasq on standard port 53 for custom domain resolution (jenkins.hs, kanban.hs)
- INTERNAL_SUBNET=10.200.0.0
- ALLOWEDIPS=10.200.0.0/24,10.0.0.0/24 # VPN clients can reach VPN services AND standard Docker bridge
- PERSISTENTKEEPALIVE_PEERS=
- LOG_CONFS=true
volumes:
- wireguard_config:/config
- /lib/modules:/lib/modules # Read-write: allows module installation if needed (read-only is safer but may prevent some operations)
# Note: sysctls are not allowed with network_mode: host
# The sysctl net.ipv4.conf.all.src_valid_mark=1 should be set on the host if needed
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
jenkins:
image: jenkins/jenkins:latest-jdk25
container_name: jenkins
# Important: Explicit DNS so Jenkins can always reach the internet (update center),
# even if host DNS/dnsmasq/WireGuard setup is changing.
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:9080:8080"
- "10.200.0.1:9500:50000"
depends_on:
- wireguard
volumes:
- jenkins_home:/var/jenkins_home
restart: unless-stopped
networks:
- jenkins-network
security_opt:
- no-new-privileges:true
read_only: false
tmpfs:
- /tmp:size=2g
- /var/jenkins_home/tmp:size=2g
deploy:
resources:
limits:
cpus: '1'
memory: 2G
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/login" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
docker-agent:
build: .
container_name: jenkins-docker-agent
user: root
privileged: true
# Explicit DNS so builds running on the agent can resolve/pull dependencies reliably
# even if host DNS/dnsmasq is misconfigured.
dns:
- 1.1.1.1
- 8.8.8.8
environment:
- JENKINS_URL=http://jenkins:8080 # Uses Docker service name - works via Docker network, not host ports
- JENKINS_AGENT_NAME=docker-agent
- JENKINS_SECRET=${JENKINS_SECRET:-Y0UR_AGENT_SECRET}
- JENKINS_AGENT_WORKDIR=/home/jenkins/workspace
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- jenkins_agent_workspace:/home/jenkins/workspace
# IMPORTANT: Do NOT auto-start this agent. Start it manually after adding the node in Jenkins UI:
# docker compose up -d docker-agent
restart: "no"
networks:
- jenkins-network
# Note: Agent communicates with Jenkins via Docker network (jenkins:8080), not via host ports
# This works even though Jenkins is only bound to 10.0.0.1 externally
kanban:
image: kanboard/kanboard:latest
container_name: kanban
hostname: kanban.hs # Custom hostname for DNS resolution
# Explicit DNS so Kanban can reach the internet (updates/plugins, if needed)
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:9090:80"
# Access via: http://kanban.hs:9090 (when connected to VPN)
depends_on:
- wireguard
volumes:
- kanban_data:/var/www/app/data
environment:
# Use sqlite with the data directory mounted as a volume
- DB_DRIVER=sqlite
- DB_FILENAME=data/db.sqlite
restart: unless-stopped
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
excalidraw:
image: excalidraw/excalidraw:latest
container_name: excalidraw
hostname: draw.hs
# Explicit DNS for internet access
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:8081:80"
# Access via: http://draw.hs (when connected to VPN)
depends_on:
- wireguard
restart: unless-stopped
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
drawio:
image: jgraph/drawio:latest
container_name: drawio
hostname: diagram.hs
# Explicit DNS for internet access
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:8082:8080"
# Access via: http://diagram.hs (when connected to VPN)
depends_on:
- wireguard
restart: unless-stopped
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
dashboard:
build: .
image: ghcr.io/swe-himelrana/glance-dashboard:latest
container_name: dashboard
hostname: startpage.hs
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1)
ports:
- "10.200.0.1:8083:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./startpage.yml:/app/config/glance.yml:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=${TZ:-Etc/UTC}
depends_on:
- wireguard
restart: unless-stopped
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.3'
memory: 256M
tempmail:
image: ghcr.io/swe-himelrana/tempmail:latest
container_name: tempmail
hostname: tempmail.hs
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:8084:80"
volumes:
- type: bind
source: ./tempmail.yml
target: /var/www/html/tempmail.yml
read_only: true
- tempmail_data:/var/www/html/data
# Fix permissions for SQLite database (www-data user needs write access)
user: "www-data:www-data"
restart: unless-stopped
depends_on:
- wireguard
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.3'
memory: 256M
semaphore:
image: semaphoreui/semaphore:latest
container_name: ansible-semaphore
hostname: semaphoreui.hs
# Explicit DNS for internet access
dns:
- 1.1.1.1
- 8.8.8.8
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:8085:3000"
# Access via: https://ansible.hs (when connected to VPN)
environment:
- SEMAPHORE_DB_DIALECT=bolt # Use BoltDB (lightweight, no MySQL needed)
- SEMAPHORE_ADMIN=admin
- SEMAPHORE_ADMIN_PASSWORD=${SEMAPHORE_ADMIN_PASSWORD:-changeme} # Change in .env
- SEMAPHORE_ADMIN_NAME=Admin
- SEMAPHORE_ADMIN_EMAIL=${SEMAPHORE_ADMIN_EMAIL:-admin@localhost}
- SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/
- ANSIBLE_HOST_KEY_CHECKING=false # Disable host key checking for easier setup
volumes:
- semaphore_data:/etc/semaphore # Stores BoltDB and configuration
- semaphore_playbooks:/tmp/semaphore # Playbook storage
restart: unless-stopped
depends_on:
- wireguard
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
nginx:
image: nginx:alpine
container_name: nginx-proxy
# Bind only to VPN interface (10.200.0.1) - accessible only via WireGuard VPN
# Requires VPN IP service setup (see README.md)
ports:
- "10.200.0.1:8980:80"
- "10.200.0.1:8943:443"
# Forwarding: iptables redirects 10.200.0.1:80 -> 8980, 443 -> 8943
# This allows access via standard ports (http://jenkins.hs, https://jenkins.hs)
# without conflict with the main server's Nginx on 0.0.0.0:80/443
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- jenkins
- kanban
- excalidraw
- drawio
- dashboard
- tempmail
- semaphore
restart: unless-stopped
networks:
- jenkins-network
deploy:
resources:
limits:
cpus: '0.2'
memory: 128M
networks:
jenkins-network:
driver: bridge
internal: false
volumes:
jenkins_home:
jenkins_agent_workspace:
wireguard_config:
kanban_data:
dnsmasq_config:
dnsmasq_leases:
tempmail_data:
semaphore_data:
semaphore_playbooks: