forked from cytopia/devilbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
485 lines (379 loc) · 11.5 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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
##
## -------------------------
## | D E V I L S T A C K |
## -------------------------
##
## Local LAMP/LEMP stack
##
##
## ${VARIABLE:-default} will evaluate to default if VARIABLE is unset or empty in the environment.
## ${VARIABLE-default} will evaluate to default only if VARIABLE is unset in the environment.
##
##
## -- DO NOT EDIT THIS FILE --
##
## Copy 'docker-compose.override.yml-example' to 'docker-compose.override.yml'
## and edit this file with your custom changes (override or even new services).
##
## Edit '.env' for configuration.
##
## If '.env' does not exist, copy 'env-example' to '.env'
## $ cp env-example .env
##
version: '2.1'
################################################################################
# SERVICES
################################################################################
services:
# ------------------------------------------------------------
# Bind (DNS Server)
# ------------------------------------------------------------
bind:
image: cytopia/bind:0.15
restart: always
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_BIND:-1053}:53/tcp"
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_BIND:-1053}:53/udp"
environment:
##
## Debug?
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
##
## Bind wildcard/host settings
##
- WILDCARD_DNS=${TLD_SUFFIX:-loc}=172.16.238.11
- EXTRA_HOSTS=${EXTRA_HOSTS}
##
## Forwarding
##
- DNS_FORWARDER=${BIND_DNS_RESOLVER:-8.8.8.8,8.8.4.4}
##
## Security
##
- DNSSEC_VALIDATE=${BIND_DNSSEC_VALIDATE:-no}
##
## Time settings
##
- TTL_TIME=${BIND_TTL_TIME}
- REFRESH_TIME=${BIND_REFRESH_TIME}
- RETRY_TIME=${BIND_RETRY_TIME}
- EXPIRY_TIME=${BIND_EXPIRY_TIME}
- MAX_CACHE_TIME=${BIND_MAX_CACHE_TIME}
##
## Query log
##
- DOCKER_LOGS=${BIND_LOG_DNS_QUERIES}
dns:
- 127.0.0.1
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
networks:
app_net:
ipv4_address: 172.16.238.100
# ------------------------------------------------------------
# PHP / HHVM
# ------------------------------------------------------------
php:
image: devilbox/php-fpm:${PHP_SERVER:-7.0}-work
restart: always
##
## All .env variables
##
## Source all variables defined in .env
## This also makes any custom variable available in each PHP/HHVM container
##
env_file:
- ./.env
environment:
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_COMPOSE_ENTRYPOINT
- DOCKER_LOGS
##
## UserID and GroupID
##
- NEW_UID
- NEW_GID
##
## Adjust timezone
##
- TIMEZONE
##
## Enable/Disable PHP Modules
##
- ENABLE_MODULES=${PHP_MODULES_ENABLE}
- DISABLE_MODULES=${PHP_MODULES_DISABLE}
##
## Mail-catching
##
- ENABLE_MAIL=1
##
## Enable 127.0.0.1 Port-forwarding
##
- FORWARD_PORTS_TO_LOCALHOST=3306:mysql:3306,5432:pgsql:5432,6379:redis:6379,11211:memcd:11211,27017:mongo:27017
##
## MySQL Backups
##
- MYSQL_BACKUP_USER=root
- MYSQL_BACKUP_PASS=${MYSQL_ROOT_PASSWORD}
- MYSQL_BACKUP_HOST=mysql
dns:
- 172.16.238.100
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
networks:
app_net:
ipv4_address: 172.16.238.10
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount custom mass virtual hosting
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd
# Mount logs
- ${DEVILBOX_PATH}/log/php-fpm-${PHP_SERVER}:/var/log/php
# Mount Mail directory
#- ${DEVILBOX_PATH}/run/mail:/var/mail
# Mount DB Backup directory
- ${DEVILBOX_PATH}/backups:/shared/backups
# Mount devilbox user-defined *.ini files in order
# to overwrite the default PHP.ini configuration
- ${DEVILBOX_PATH}/cfg/php-ini-${PHP_SERVER}:/etc/php-custom.d:ro
# Mount devilbox user-defined PHP-FPM *.conf files in order
# to overwrite the default PHP-FPM configuration
- ${DEVILBOX_PATH}/cfg/php-fpm-${PHP_SERVER}:/etc/php-fpm-custom.d:ro
# Mount devilbox user-defined *.so files in order
# to load custom PHP modules
- ${DEVILBOX_PATH}/mod/php-fpm-${PHP_SERVER}:/usr/lib64/php/custom-modules:ro
# Mount devilbox user-defined bash config
- ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d
# Certificate Authority public key
- ${DEVILBOX_PATH}/ca:/ca
depends_on:
- bind
# ------------------------------------------------------------
# Web Server
# ------------------------------------------------------------
httpd:
image: devilbox/${HTTPD_SERVER:-nginx-stable}:0.17
restart: always
environment:
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_RUNTIME=${DEBUG_COMPOSE_ENTRYPOINT}
- DOCKER_LOGS
##
## Adjust timezone
##
- TIMEZONE
##
## UserID and GroupID
##
- NEW_UID
- NEW_GID
##
## Disable default vhost?
##
- MAIN_VHOST_ENABLE=${DEVILBOX_UI_ENABLE}
- MAIN_VHOST_STATUS_ENABLE=1
- MAIN_VHOST_STATUS_ALIAS=/devilbox-httpd-status
- MAIN_VHOST_SSL_TYPE=both
- MAIN_VHOST_SSL_GEN=1
- MAIN_VHOST_SSL_CN=${DEVILBOX_UI_SSL_CN:-localhost}
##
## Enable Mass Vhosts
##
- MASS_VHOST_ENABLE=1
- MASS_VHOST_TLD=.${TLD_SUFFIX}
- MASS_VHOST_DOCROOT=${HTTPD_DOCROOT_DIR}
- MASS_VHOST_TPL=${HTTPD_TEMPLATE_DIR}
- MASS_VHOST_SSL_TYPE=both
- MASS_VHOST_SSL_GEN=1
##
## PHP-FPM Remote Server
##
- PHP_FPM_ENABLE=1
- PHP_FPM_SERVER_ADDR=php
- PHP_FPM_SERVER_PORT=9000
ports:
# ---- Format: ----
# [HOST-ADDR : ] HOST-PORT : DOCKER-PORT
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD}:80"
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HTTPD_SSL}:443"
networks:
app_net:
ipv4_address: 172.16.238.11
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount custom intranet
- ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro
# Mount custom mass virtual hosting
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd
# Mount custom web server config directory
- ${DEVILBOX_PATH}/cfg/${HTTPD_SERVER}:/etc/httpd-custom.d
# Mount logs
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER}
# Certificate Authority public key
- ${DEVILBOX_PATH}/ca:/ca
depends_on:
- bind
- php
# ------------------------------------------------------------
# MySQL Database
# ------------------------------------------------------------
mysql:
image: cytopia/${MYSQL_SERVER:-mariadb-10.1}:latest
environment:
##
## Debug?
##
- DEBUG_COMPOSE_ENTRYPOINT
##
## Adjust timezone
##
- TIMEZONE
##
## Adjust Root password
##
- MYSQL_ROOT_PASSWORD
##
## Socket directory Path
##
- MYSQL_SOCKET_DIR=/tmp/mysql
##
## Runtime settings
##
- MYSQL_GENERAL_LOG=${MYSQL_GENERAL_LOG}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MYSQL}:3306"
networks:
app_net:
ipv4_address: 172.16.238.12
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/${MYSQL_SERVER}:/var/log/mysql
# Mount devilbox default overwrites
- ${DEVILBOX_PATH}/.devilbox/etc/${MYSQL_SERVER}:/etc/mysql/conf.d:ro
# Mount devilbox user-defined cnf files in order
# to overwrite the MySQL server configuration
- ${DEVILBOX_PATH}/cfg/${MYSQL_SERVER}:/etc/mysql/docker-default.d:ro
# Mount MySQL Data directory
- ${HOST_PATH_MYSQL_DATADIR}/${MYSQL_SERVER}:/var/lib/mysql
depends_on:
- bind
- php
- httpd
# ------------------------------------------------------------
# PostgreSQL
# ------------------------------------------------------------
pgsql:
image: postgres:${PGSQL_SERVER:-9.6}
environment:
- POSTGRES_USER=${PGSQL_ROOT_USER}
- POSTGRES_PASSWORD=${PGSQL_ROOT_PASSWORD}
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_PGSQL}:5432"
networks:
app_net:
ipv4_address: 172.16.238.13
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/pgsql-${PGSQL_SERVER}:/var/log/postgresql
# Mount PostgreSQL Data directory
- ${HOST_PATH_PGSQL_DATADIR}/${PGSQL_SERVER}:/var/lib/postgresql/data/pgdata
depends_on:
- bind
- php
- httpd
# ------------------------------------------------------------
# Redis
# ------------------------------------------------------------
redis:
image: redis:${REDIS_SERVER:-3.2}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_REDIS}:6379"
networks:
app_net:
ipv4_address: 172.16.238.14
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/redis-${REDIS_SERVER}:/var/log/redis
depends_on:
- bind
- php
- httpd
# ------------------------------------------------------------
# Memcached
# ------------------------------------------------------------
memcd:
image: memcached:${MEMCD_SERVER:-latest}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MEMCD}:11211"
networks:
app_net:
ipv4_address: 172.16.238.15
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount logs
- ${DEVILBOX_PATH}/log/memcd-${MEMCD_SERVER}:/var/log/memcd
depends_on:
- bind
- php
- httpd
# ------------------------------------------------------------
# MongoDB
# ------------------------------------------------------------
mongo:
image: mongo:${MONGO_SERVER:-latest}
ports:
# [local-machine:]local-port:docker-port
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MONGO}:27017"
networks:
app_net:
ipv4_address: 172.16.238.16
volumes:
# ---- Format: ----
# HOST-DIRECTORY : DOCKER-DIRECTORY
# Mount MongoDB Data directory
- ${HOST_PATH_MONGO_DATADIR}/${MONGO_SERVER}:/data/db
depends_on:
- bind
- php
- httpd
################################################################################
# NETWORK
################################################################################
networks:
app_net:
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1