-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdocker-compose.yml
480 lines (428 loc) · 12.9 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
version: "3.7"
services:
# ---------------------------
# Local Services
node-build-assets:
container_name: lpa-node-build-assets
image: lpa-node-build-assets
volumes:
- ./service-front:/service-front
build:
context: ./
dockerfile: node-build-assets/docker/Dockerfile
pgbouncer:
container_name: lpa-pgbouncer
build:
context: ./
dockerfile: service-api/docker/pgbouncer/Dockerfile
healthcheck:
test: ["CMD", "bash", "-c", "echo -n > /dev/tcp/127.0.0.1/6432 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
depends_on:
- postgres
# ports:
# - 6432:6432
environment:
POSTGRESQL_HOST: postgres
POSTGRESQL_USERNAME: lpauser
POSTGRESQL_PASSWORD: lpapass
POSTGRESQL_DATABASE: lpadb
PGBOUNCER_DATABASE: lpadb
postgres:
container_name: lpa-postgres
image: postgres:13.7
ports:
- 5434:5432
environment:
POSTGRES_HOST: postgres
POSTGRES_DB: lpadb
POSTGRES_USER: lpauser
POSTGRES_PASSWORD: lpapass
healthcheck:
test: ["CMD-SHELL", "pg_isready --username=lpauser --dbname=lpadb"]
interval: 10s
timeout: 5s
retries: 5
redis:
container_name: lpa-redis
image: library/redis:6.2-alpine
# ports:
# - 6379:6379
dynamodb:
container_name: lpa-dynamodb
image: amazon/dynamodb-local
# ports:
# - 8000:8000
govpaystub:
container_name: lpa-govpaystub
image: bbyars/mountebank
ports:
- 2527:2525
- 4547:4545
volumes:
- ./cypress/govpay-stubs:/app
command: --allowInjection --configfile /app/mountebank-config.ejs
localstack:
container_name: lpa-localstack
image: localstack/localstack:3.8.1
privileged: true
# ports:
# - 4568:4566
environment:
- SERVICES=sqs,s3,lambda,secretsmanager
- DEFAULT_REGION=eu-west-1
- HOSTNAME=localstack
- LAMBDA_EXECUTOR=docker
- DEBUG=1
# Configure lambdas started within localstack so
# that they use the external malpadev network.
# This enables them to resolve names of containers
# within the docker compose environment, providing
# they have an alias on this network.
- LAMBDA_DOCKER_NETWORK=malpadev
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
default:
aliases:
- sqs.eu-west-1.localhost.localstack.cloud
healthcheck:
test: ["CMD", "curl", "http://localhost:4566/_localstack/health?reload"]
local-config:
container_name: lpa-local-config
image: lpa-local-config
build:
context: ./local-config/
dockerfile: ./Dockerfile
depends_on:
dynamodb:
condition: service_started
postgres:
condition: service_healthy
localstack:
condition: service_healthy
volumes:
- ./local-config/:/app/
environment:
AWS_ACCESS_KEY_ID: "devkey"
AWS_SECRET_ACCESS_KEY: "secretdevkey"
AWS_ENDPOINT_DYNAMODB: dynamodb:8000
OPG_LPA_COMMON_SQS_ENDPOINT: localstack:4566
OPG_LPA_COMMON_PDF_QUEUE_NAME: pdf-queue.fifo
OPG_LPA_COMMON_S3_ENDPOINT: localstack:4566
OPG_LPA_COMMON_PDF_CACHE_S3_BUCKET: "lpacache"
OPG_LPA_COMMON_LAMBDA_ENDPOINT: localstack:4566
FRONT_DOMAIN: localhost:7002
# ---------------------------
# Front
front-web:
container_name: lpa-front-web
image: lpa-front-web
depends_on:
- front-app
volumes:
- ./service-front/public:/web
build:
context: ./
dockerfile: service-front/docker/web/Dockerfile
environment:
APP_HOST: front-app
APP_PORT: 9000
NGINX_LOG_LEVEL: warn
front-app:
container_name: lpa-front-app
image: lpa-front-app
build:
context: ./
args:
# Ideally, debug would always be enabled for front-app, as we often want to debug it. In practice,
# this still runs too slowly so we leave it off as default
ENABLE_XDEBUG: 0
dockerfile: service-front/docker/app/Dockerfile
volumes:
- ./service-front:/app
- ./tests:/app/tests
- ./shared:/shared
depends_on:
dynamodb:
condition: service_started
localstack:
condition: service_healthy
local-config:
condition: service_started
node-build-assets:
condition: service_started
govpaystub:
condition: service_started
environment:
OPG_LPA_STACK_NAME: "local"
OPG_LPA_STACK_ENVIRONMENT: "dev"
OPG_LPA_ENDPOINTS_API: "http://api-web"
OPG_LPA_COMMON_ADMIN_DYNAMODB_TABLE: "Properties"
OPG_LPA_COMMON_CRONLOCK_DYNAMODB_TABLE: "Locks"
OPG_LPA_COMMON_SESSION_DYNAMODB_TABLE: "Sessions"
OPG_LPA_FRONT_CSRF_SALT: "test"
# Local only
AWS_ACCESS_KEY_ID: "devkey"
AWS_SECRET_ACCESS_KEY: "secretdevkey"
OPG_LPA_COMMON_DYNAMODB_ENDPOINT: http://dynamodb:8000
PHP_OPCACHE_VALIDATE_TIMESTAMPS: 1
PHP_IDE_CONFIG: serverName=lpa-front-app
OPG_LPA_FRONT_EMAIL_TRANSPORT: notify
OPG_LPA_FRONT_EMAIL_NOTIFY_API_KEY: "${OPG_LPA_API_NOTIFY_API_KEY}"
OPG_LPA_FRONT_GOV_PAY_KEY: "${OPG_LPA_FRONT_GOV_PAY_KEY}"
OPG_LPA_FRONT_GOV_PAY_URL: "http://govpaystub:4545"
OPG_LPA_FRONT_OS_PLACES_HUB_LICENSE_KEY: "${OPG_LPA_FRONT_OS_PLACES_HUB_LICENSE_KEY}"
OPG_LPA_COMMON_ADMIN_ACCOUNTS: "${OPG_LPA_COMMON_ADMIN_ACCOUNTS}"
OPG_LPA_COMMON_REDIS_CACHE_URL: tcp://redis:6379
OPG_LPA_OS_PLACES_HUB_ENDPOINT : "https://api.os.uk/search/places/v1/postcode"
healthcheck:
test:
[
"CMD",
"/usr/local/bin/health-check.sh"
]
interval: 10s
timeout: 15s
retries: 3
start_period: 90s
front-ssl:
container_name: lpa-front-ssl
image: lpa-front-ssl
depends_on:
- front-web
build:
context: ./
dockerfile: local-ssl/docker/Dockerfile
ports:
- 7002:443
volumes:
- ./local-ssl/certs:/etc/nginx/certs
environment:
DOMAIN: "localhost"
TARGET_HOST_HEADER: "localhost:7002"
SSL_PORT: "443"
TARGET_HOST: "front-web"
TARGET_PORT: "80"
# ---------------------------
# API
api-web:
container_name: lpa-api-web
image: lpa-api-web
depends_on:
- api-app
build:
context: ./
dockerfile: service-api/docker/web/Dockerfile
ports:
- 7001:80
environment:
APP_HOST: api-app
APP_PORT: 9000
NGINX_LOG_LEVEL: warn
api-app:
container_name: lpa-api-app
image: lpa-api-app
build:
context: ./
args:
# Enable debug is recommended to default to off for api to avoid slowness.
# Turn this on if you ever need to debug the api
ENABLE_XDEBUG: 0
OPG_LPA_COMMON_APP_VERSION: "${OPG_LPA_COMMON_APP_VERSION}"
dockerfile: service-api/docker/app/Dockerfile
volumes:
- ./service-api:/app
- ./shared:/shared
depends_on:
dynamodb:
condition: service_started
localstack:
condition: service_healthy
local-config:
condition: service_started
postgres:
condition: service_healthy
environment:
OPG_LPA_STACK_NAME: "local"
OPG_LPA_STACK_ENVIRONMENT: "dev"
OPG_LPA_API_NOTIFY_API_KEY: "${OPG_LPA_API_NOTIFY_API_KEY}"
OPG_LPA_POSTGRES_HOSTNAME: "pgbouncer"
OPG_LPA_POSTGRES_PORT: "6432"
OPG_LPA_POSTGRES_NAME: "lpadb"
OPG_LPA_POSTGRES_USERNAME: "lpauser"
OPG_LPA_POSTGRES_PASSWORD: "lpapass"
# Fake key; deliberately committed
OPG_LPA_API_PDF_ENCRYPTION_KEY_DOCUMENT: "0L5Mn687f312aj827NQq648U7899o91r"
OPG_LPA_COMMON_ADMIN_DYNAMODB_TABLE: "Properties"
OPG_LPA_COMMON_PDF_CACHE_S3_BUCKET: "lpacache"
OPG_LPA_COMMON_CRONLOCK_DYNAMODB_TABLE: "Locks"
# if you have opg-data-lpa running locally, this allows the front-app
# /ping endpoints to return more realistic values
OPG_LPA_PROCESSING_STATUS_ENDPOINT: "http://host.docker.internal:4343/v1/"
# lifetime (in seconds) of authentication tokens
OPG_LPA_AUTH_TOKEN_TTL: 4500
OPG_LPA_COMMON_DYNAMODB_AUTO_CREATE: "true"
OPG_LPA_COMMON_ADMIN_ACCOUNTS: "${OPG_LPA_COMMON_ADMIN_ACCOUNTS}"
# Local only
AWS_ACCESS_KEY_ID: "devkey"
AWS_SECRET_ACCESS_KEY: "secretdevkey"
OPG_LPA_COMMON_DYNAMODB_ENDPOINT: http://dynamodb:8000
OPG_LPA_COMMON_S3_ENDPOINT: http://localstack:4566
OPG_LPA_COMMON_PDF_QUEUE_URL: http://localstack:4566/000000000000/pdf-queue.fifo
OPG_LPA_TELEMETRY_HOST: ''
OPG_LPA_TELEMETRY_PORT: ''
PHP_OPCACHE_VALIDATE_TIMESTAMPS: 1
PHP_IDE_CONFIG: serverName=lpa-api-app
healthcheck:
test:
[
"CMD",
"/usr/local/bin/health-check.sh"
]
interval: 10s
timeout: 15s
retries: 3
start_period: 90s
# ---------------------------
# Admin
admin-web:
container_name: lpa-admin-web
image: lpa-admin-web
depends_on:
- admin-app
volumes:
- ./service-admin/public:/web
build:
context: ./
dockerfile: service-admin/docker/web/Dockerfile
environment:
APP_HOST: admin-app
APP_PORT: 9000
NGINX_LOG_LEVEL: warn
admin-app:
container_name: lpa-admin-app
image: lpa-admin-app
build:
context: ./
dockerfile: service-admin/docker/app/Dockerfile
args:
# enable debug is recommended to default to off for admin app to avoid slowness, as admin is rarely debugged.
# Turn this on if you wish to debug the admin app
ENABLE_XDEBUG: 0
volumes:
- ./service-admin:/app
- ./shared:/shared
depends_on:
dynamodb:
condition: service_started
localstack:
condition: service_healthy
local-config:
condition: service_started
environment:
OPG_LPA_STACK_NAME: "local"
OPG_LPA_STACK_ENVIRONMENT: "dev"
OPG_LPA_ENDPOINTS_API: "http://api-web"
OPG_LPA_COMMON_ADMIN_DYNAMODB_TABLE: "Properties"
OPG_LPA_COMMON_CRONLOCK_DYNAMODB_TABLE: "Locks"
OPG_LPA_COMMON_SESSION_DYNAMODB_TABLE: "Sessions"
OPG_LPA_ADMIN_JWT_SECRET: "test-secret"
# Local only
AWS_ACCESS_KEY_ID: "devkey"
AWS_SECRET_ACCESS_KEY: "secretdevkey"
OPG_LPA_COMMON_DYNAMODB_ENDPOINT: http://dynamodb:8000
PHP_OPCACHE_VALIDATE_TIMESTAMPS: 1
PHP_IDE_CONFIG: serverName=lpa-admin-app
OPG_LPA_COMMON_ADMIN_ACCOUNTS: "${OPG_LPA_COMMON_ADMIN_ACCOUNTS}"
healthcheck:
test:
[
"CMD",
"/usr/local/bin/health-check.sh"
]
interval: 10s
timeout: 15s
retries: 3
start_period: 90s
admin-ssl:
container_name: lpa-admin-ssl
image: lpa-admin-ssl
depends_on:
- admin-web
build:
context: ./
dockerfile: local-ssl/docker/Dockerfile
ports:
- 7003:443
volumes:
- ./local-ssl/certs:/etc/nginx/certs
environment:
DOMAIN: "localhost"
TARGET_HOST_HEADER: "localhost:7003"
SSL_PORT: "443"
TARGET_HOST: "admin-web"
TARGET_PORT: "80"
# ---------------------------
# PDF
pdf-app:
container_name: lpa-pdf-app
image: lpa-pdf-app
depends_on:
localstack:
condition: service_healthy
local-config:
condition: service_started
volumes:
- ./service-pdf:/app
- ./shared:/shared
tmpfs:
- /tmp/
build:
context: ./
args:
# Other containers are built with debug on. Lines could be put here to build pdf with debug,
# but not doing as default due to pdf being slow already
ENABLE_XDEBUG: 0
dockerfile: service-pdf/docker/app/Dockerfile
environment:
OPG_LPA_COMMON_PDF_CACHE_S3_BUCKET: "lpacache"
# Local only
AWS_ACCESS_KEY_ID: "devkey"
AWS_SECRET_ACCESS_KEY: "secretdevkey"
# XDEBUG mode and session need setting for this to run when xdebug mode above is enabled
XDEBUG_MODE: debug
XDEBUG_SESSION: 1
OPG_LPA_COMMON_S3_ENDPOINT: http://localstack:4566
OPG_LPA_COMMON_PDF_QUEUE_URL: http://sqs.eu-west-1.localhost.localstack.cloud:4566/000000000000/pdf-queue.fifo
PHP_IDE_CONFIG: serverName=lpa-pdf-app
# ---------------------------
# Seeding
seeding:
container_name: lpa-seeding
image: lpa-seeding
build:
context: ./
dockerfile: service-seeding/docker/app/Dockerfile
depends_on:
local-config:
condition: service_started
postgres:
condition: service_healthy
dynamodb:
condition: service_started
api-app:
condition: service_started
volumes:
- ./scripts/non_live_seeding:/app
environment:
OPG_LPA_STACK_NAME: "local"
OPG_LPA_STACK_ENVIRONMENT: "dev"
OPG_LPA_POSTGRES_HOSTNAME: "postgres"
OPG_LPA_POSTGRES_PORT: "5432"
OPG_LPA_POSTGRES_NAME: "lpadb"
OPG_LPA_POSTGRES_USERNAME: "lpauser"
OPG_LPA_POSTGRES_PASSWORD: "lpapass"