-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
257 lines (242 loc) · 7.82 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
# Docker compose configuration for local development
version: '2'
services:
# The local mock version of the public haproxy router, responsible for serving the correct "web" service based on the VIRTUAL_HOST
# locally we only have a single "web" service, nonetheless it is important to locally mimic the complete request chain
router:
image: dockercloud/haproxy:1.4.2
links:
- web
ports:
- "80:80"
# Publish stats port
- "1936"
environment:
TIMEOUT: connect 500, client 120000, server 120000
# Some sort of protection for the stats endpoint (needless to say, you should use a unique secure password in production)
STATS_AUTH: stats:n3v3rg0nnAg1v3y0uup
# DOCKER_TLS_VERIFY: ${DOCKER_TLS_VERIFY}
# DOCKER_HOST: ${DOCKER_HOST}
# DOCKER_CERT_PATH: ${DOCKER_CERT_PATH}
# volumes:
# - $DOCKER_CERT_PATH:$DOCKER_CERT_PATH
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# The nginx server for serving static files directly, cached contents via the memcached server and php files via the php service
web:
image: nginx:1.7
links:
- phphaproxy
- phpfiles
volumes:
- .:/app:rw
ports:
- "80"
environment:
NGINX_ERROR_LOG_LEVEL: 'notice'
VIRTUAL_HOST: '*.127.0.0.1.xip.io, 127.0.0.1, *.sq.build.neamlabs.com, *.foundersassistant.127.0.0.1.xip.io, *.foundersassistant.build.neamlabs.com, *.spending-report.127.0.0.1.xip.io, *.spending-report.build.neamlabs.com, *.neamtime.127.0.0.1.xip.io, *.neamtime.build.neamlabs.com, *.ngrok.io'
# The haproxy router is configured to respond to port 80 without ssl, thus we need to make sure that proxying to the web service's port 443 is not attempted
# A separate haproxy and corresponding web service needs to be set up to respond to port 443 with ssl if required
EXCLUDE_PORTS: 443
working_dir: '/app'
command: "/app/stack/nginx/run.sh"
# HA Proxy for php service scaling
phphaproxy:
image: dockercloud/haproxy:1.5.1
links:
- phpha
ports:
- "9000"
# Publish stats port
- "1936"
environment:
MODE: tcp
TIMEOUT: connect 500, client 120000, server 120000
# Some sort of protection for the stats endpoint (needless to say, you should use a unique secure password in production)
STATS_AUTH: stats:n3v3rg0nnAg1v3y0uup
# DOCKER_TLS_VERIFY: ${DOCKER_TLS_VERIFY}
# DOCKER_HOST: ${DOCKER_HOST}
# DOCKER_CERT_PATH: ${DOCKER_CERT_PATH}
# volumes:
# - $DOCKER_CERT_PATH:$DOCKER_CERT_PATH
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# The elastically scalable php service for interpreting php code without access to /files
phpha:
image: neam/dna-project-base-debian-php:0.6.2-php7.0
links:
- mailcatcher
- redisphpsessionhandler
- localdb
volumes:
- .:/app:rw
# Use to inspect the local tmp files directory if necessary
# - .local-tmp-files:/local-tmp-files:rw
ports:
- "9000"
- "9089" # Xdebug
environment:
TCP_PORTS: '9000'
DISPLAY_PHP_ERRORS: 'off'
XDEBUG_DEFAULT_ENABLE: 'off'
RUNNING_LOCALLY: '1'
HHVM: '0' # 1 = Use HHVM instead of the default PHP interpreter
env_file:
- .env
working_dir: '/app'
command: "/app/stack/php/run.sh"
# The redis service used as the PHP session handler for all containers
redisphpsessionhandler:
image: redis
ports:
- "6379"
# The single-node php service for interpreting php code with read-write access to user-generated files
# (to support file uploads and other local file manipulations)
phpfiles:
image: neam/dna-project-base-debian-php:0.6.2-php7.0
links:
- mailcatcher
- redisphpsessionhandler
- localdb
volumes:
- .:/app:rw
- .files:/files:rw
ports:
- "9000"
- "9089" # Xdebug
environment:
DISPLAY_PHP_ERRORS: 'on'
XDEBUG_DEFAULT_ENABLE: 'off'
RUNNING_LOCALLY: '1'
HHVM: '0' # 1 = Use HHVM instead of the default PHP interpreter
env_file:
- .env
working_dir: '/app'
command: "/app/stack/php/run.sh"
# Local MySQL database server to mimic a cloud database
localdb:
image: mysql:5.7.11
volumes:
- ./stack/localdb/.db/mysql:/var/lib/mysql:rw
- ./stack/localdb/:/stack/localdb:rw
ports:
- "13306:3306"
environment:
MYSQL_ROOT_PASSWORD: "local-mysql-pass"
command: "/stack/localdb/run.sh"
# Memcached server for serving cached contents via the nginx-memcache plugin
#memcached:
# image: memcached:1.4.22
# ports:
# - "11211"
# Mailcatcher server for catching outgoing email when not in production
mailcatcher:
image: nisenabe/mailcatcher
expose:
- "25"
ports:
- "1080"
# A container to run builder commands locally
builder:
image: neam/php-app-builder:0.6.2
volumes:
- .:/app:rw # TODO: Make read-only when Yii is configured properly not to write to anywhere else than under /files
- .:/__PROJECT__:rw
- .files:/files:rw
- ../.git:/.git
- ~/.composer:/root/.composer
- ~/.gitconfig:/root/.gitconfig
- ~/.ssh:/root/.docker-host-ssh:ro
working_dir: '/app'
command: "/app/stack/php/shell.sh"
# Containers to run tester commands locally - start a shell by running stack/tester-shell.sh <flavor>
tester-hhvm:
image: neam/dna-project-base-debian-php-tester:0.6.2
links:
- web
- api-mock
- localdb
volumes:
- .:/app:rw
- .:/__PROJECT__:rw
- .files:/files:rw
- ../.git:/.git
- ~/.composer:/root/.composer
- ~/.gitconfig:/root/.gitconfig
- ~/.ssh:/root/.ssh:ro
environment:
RUNNING_LOCALLY: '1'
HHVM: '1' # 1 = Use HHVM instead of the default PHP interpreter
working_dir: '/app/dna/tests'
env_file:
- .current-local-cli-data-profile
command: "/app/stack/php/shell.sh"
tester-php5:
image: neam/dna-project-base-debian-php-tester:0.6.2
links:
- web
- api-mock
- localdb
volumes:
- .:/app:rw
- .:/__PROJECT__:rw
- .files:/files:rw
- ../.git:/.git
- ~/.composer:/root/.composer
- ~/.gitconfig:/root/.gitconfig
- ~/.ssh:/root/.ssh:ro
environment:
RUNNING_LOCALLY: '1'
HHVM: '0' # 1 = Use HHVM instead of the default PHP interpreter
working_dir: '/app/dna/tests'
env_file:
- .current-local-cli-data-profile
command: "/app/stack/php/shell.sh"
tester-php7.0:
image: neam/dna-project-base-debian-php-tester:0.6.2-php7.0
links:
- web
- api-mock
- localdb
volumes:
- .:/app:rw
- .:/__PROJECT__:rw
- .files:/files:rw
- ../.git:/.git
- ~/.composer:/root/.composer
- ~/.gitconfig:/root/.gitconfig
- ~/.ssh:/root/.ssh:ro
environment:
RUNNING_LOCALLY: '1'
HHVM: '0' # 1 = Use HHVM instead of the default PHP interpreter
working_dir: '/app/dna/tests'
env_file:
- .current-local-cli-data-profile
command: "/app/stack/php/shell.sh"
# A container to serve a mock version of the api according to an api blueprint TODO
api-mock:
image: neam/api-mock
volumes:
- .:/app:rw
working_dir: '/app'
command: "true"
# A container to run worker/administration commands locally - start a shell by running stack/shell.sh
worker:
image: neam/php-app-worker:0.6.2-php7.0
links:
- localdb
volumes:
- .:/app:rw
- .:/__PROJECT__:rw
- .files:/files:rw
- ../.git:/.git
- ~/.composer:/root/.composer
- ~/.gitconfig:/root/.gitconfig
- ~/.ssh:/root/.ssh:ro
environment:
RUNNING_LOCALLY: '1'
HHVM: '0' # 1 = Use HHVM instead of the default PHP interpreter
working_dir: '/app'
env_file:
- .current-local-cli-data-profile
command: "/app/stack/php/shell.sh"