-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathdocker-compose.yml
256 lines (245 loc) · 6.51 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
services:
workspace-builder:
container_name: workspace-builder
build:
context: ./workspace
args:
- DOJO_WORKSPACE=${DOJO_WORKSPACE}
environment:
- DOJO_WORKSPACE=${DOJO_WORKSPACE}
volumes:
- /data/workspace:/out
workspacefs:
container_name: workspacefs
privileged: true
build:
context: ./workspacefs
volumes:
- /data/workspacefs:/run/workspace:shared
- /data/workspace/nix:/nix
depends_on:
workspace-builder:
condition: service_completed_successfully
dojofs:
container_name: dojofs
privileged: true
pid: host
build:
context: ./dojofs
volumes:
- /run/dojofs:/run/dojofs:shared
- /var/run/docker.sock:/var/run/docker.sock:ro
homefs:
container_name: homefs
privileged: true
build:
context: ./homefs
environment:
- STORAGE_ROOT=/run/homefs
- STORAGE_HOST=192.168.42.1
volumes:
- /run/homefs:/run/homefs:shared
- /var/run/docker/plugins:/var/run/docker/plugins
ports:
- "4201:4201"
ctfd:
container_name: ctfd
profiles:
- main
hostname: ctfd
build: /opt/CTFd
platform: linux/amd64
user: root
restart: always
privileged: true
entrypoint: ""
command:
- /bin/sh
- -c
- |
if [ "$DOJO_ENV" != "development" ]; then
./docker-entrypoint.sh;
else
FLASK_DEBUG=True WERKZEUG_DEBUG_PIN=off flask run --host 0.0.0.0 --port 8000;
fi
ulimits:
nofile:
soft: 32768
hard: 1048576
environment:
- UPLOAD_FOLDER=/var/uploads
- DATABASE_URL=mysql+pymysql://${DB_USER}:${DB_PASS}@${DB_HOST}/${DB_NAME}
- REDIS_URL=redis://cache:6379
- WORKERS=8
- LOG_FOLDER=/var/log/CTFd
- ACCESS_LOG=-
- ERROR_LOG=-
- REVERSE_PROXY=true
- SERVER_SENT_EVENTS=false
- SECRET_KEY=${SECRET_KEY}
- DOJO_HOST=${DOJO_HOST}
- HOST_DATA_PATH=/data
- MAIL_SERVER=${MAIL_SERVER}
- MAIL_PORT=${MAIL_PORT}
- MAIL_USERNAME=${MAIL_USERNAME}
- MAIL_PASSWORD=${MAIL_PASSWORD}
- MAIL_ADDRESS=${MAIL_ADDRESS}
- DOCKER_USERNAME=${DOCKER_USERNAME}
- DOCKER_TOKEN=${DOCKER_TOKEN}
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
- DISCORD_CLIENT_SECRET=${DISCORD_CLIENT_SECRET}
- DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN}
- DISCORD_GUILD_ID=${DISCORD_GUILD_ID}
- INTERNET_FOR_ALL=${INTERNET_FOR_ALL}
- VIRTUAL_HOST=${VIRTUAL_HOST}
- VIRTUAL_PORT=8000
- LETSENCRYPT_HOST=${LETSENCRYPT_HOST}
- MAC_HOSTNAME=${MAC_HOSTNAME}
- MAC_USERNAME=${MAC_USERNAME}
- MAC_KEY_FILE=${MAC_KEY_FILE}
- MAC_GUEST_CONTROL_FILE=${MAC_GUEST_CONTROL_FILE}
volumes:
- /data/CTFd/logs:/var/log/CTFd
- /data/CTFd/uploads:/var/uploads
- /data/mac:/var/data/mac
- /data/homes:/var/homes:shared
- /data/dojos:/var/dojos
- /data/workspace_nodes.json:/var/workspace_nodes.json:ro
- /data/ssh_host_keys/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro
- ./user_firewall.allowed:/var/user_firewall.allowed:ro
- /etc/docker/seccomp.json:/etc/docker/seccomp.json:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/pwn.college/dojo_plugin:/opt/CTFd/CTFd/plugins/dojo_plugin:ro
- /opt/pwn.college/dojo_theme:/opt/CTFd/CTFd/themes/dojo_theme:ro
healthcheck:
test:
- "CMD"
- "python"
- "-c"
- |
import requests
response = requests.get('http://localhost:8000')
response.raise_for_status()
interval: 10s
timeout: 10s
retries: 3
depends_on:
workspace-builder:
condition: service_completed_successfully
workspacefs:
condition: service_started
dojofs:
condition: service_started
homefs:
condition: service_started
db:
condition: service_healthy
restart: true
cache:
condition: service_started
db:
container_name: db
profiles:
- main
build:
context: ./db
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${DB_PASS}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASS}
- MYSQL_DATABASE=${DB_NAME}
- DB_EXTERNAL=${DB_EXTERNAL}
volumes:
- /data/mysql:/var/lib/mysql
command: [/start.sh]
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASS}", "-u${DB_USER}", "-h${DB_HOST}"]
interval: 10s
timeout: 10s
retries: 3
cache:
container_name: cache
profiles:
- main
image: redis:4
restart: always
volumes:
- /data/redis:/data
sshd:
container_name: sshd
profiles:
- main
build:
context: ./sshd
volumes:
- /data/workspace_nodes.json:/var/workspace_nodes.json:ro
- /data/ssh_host_keys:/etc/ssh:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /data/mac:/var/data/mac:ro
environment:
- DB_HOST=${DB_HOST}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- REDIS_URL=redis://cache:6379
- MAC_HOSTNAME=${MAC_HOSTNAME}
- MAC_USERNAME=${MAC_USERNAME}
- MAC_KEY_FILE=${MAC_KEY_FILE}
- MAC_GUEST_CONTROL_FILE=${MAC_GUEST_CONTROL_FILE}
ports:
- "22:22"
nginx-proxy:
container_name: nginx-proxy
profiles:
- main
image: nginxproxy/nginx-proxy:1.5
restart: always
ports:
- "80:80"
- "443:443"
environment:
- DEFAULT_HOST=${DOJO_HOST}
- TRUST_DOWNSTREAM_PROXY=false
- LOG_JSON=true
volumes:
- conf:/etc/nginx/conf.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs:ro
- ./nginx-proxy/etc/nginx/vhost.d:/etc/nginx/vhost.d
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
default:
workspace_net:
aliases:
- nginx
ipv4_address: 10.0.0.3
acme-companion:
container_name: nginx-proxy-acme
profiles:
- main
image: nginxproxy/acme-companion:2.3
restart: always
volumes_from:
- nginx-proxy
volumes:
- certs:/etc/nginx/certs:rw
- acme:/etc/acme.sh
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
conf:
html:
certs:
acme:
networks:
default:
driver: bridge
workspace_net:
name: workspace_net
driver: bridge
ipam:
config:
- subnet: 10.0.0.0/8
driver_opts:
com.docker.network.bridge.name: "workspace_net"
com.docker.network.bridge.enable_icc: "false"