-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
158 lines (149 loc) · 4.87 KB
/
docker-compose.yml
File metadata and controls
158 lines (149 loc) · 4.87 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
# make sure you enable host.docker.internal in your docker desktop settings
services:
localstack:
image: localstack/localstack:3.0.2
ports:
- '127.0.0.1:4566:4566' # LocalStack Gateway
- '127.0.0.1:4510-4559:4510-4559' # external services port range
env_file:
- 'compose/aws.env'
environment:
DEBUG: ${DEBUG:-1}
LS_LOG: WARN # Localstack DEBUG Level
SERVICES: s3,sqs,sns,firehose
LOCALSTACK_HOST: 127.0.0.1
volumes:
- '${TMPDIR:-/tmp}/localstack:/var/lib/localstack'
- './compose/start-localstack.sh:/etc/localstack/init/ready.d/start-localstack.sh'
healthcheck:
test: ['CMD', 'curl', 'localhost:4566']
interval: 5s
start_period: 5s
retries: 3
networks:
cdpuploader:
ipv4_address: 10.0.2.20
redis:
image: redis:7.2.3-alpine3.18
ports:
- '6379:6379'
restart: always
networks:
- cdpuploader
cdp-uploader:
image: defradigital/cdp-uploader:${CDP_UPLOADER_VERSION:-latest}
ports:
- '127.0.0.1:7337:7337'
links:
- 'localstack:localstack'
- 'redis:redis'
depends_on:
localstack:
condition: service_healthy
env_file:
- 'compose/aws.env'
environment:
VIRTUAL_HOST: ~^uploader\..*\.sslip\.io
VIRTUAL_PATH: /
VIRTUAL_PORT: 7337
PORT: 7337
NODE_ENV: development
REDIS_HOST: redis
LOCALSTACK_ENDPOINT: http://localhost.localstack.cloud:4566
S3_ENDPOINT: http://localhost.localstack.cloud:4566
SQS_ENDPOINT: http://localhost.localstack.cloud:4566
USE_SINGLE_INSTANCE_CACHE: true
MOCK_VIRUS_SCAN_ENABLED: true
MOCK_VIRUS_RESULT_DELAY: 3
FORMS_SUBMISSION_API_URL: 'http://host.docker.internal:3002'
CALLBACK_URL: 'http://host.docker.internal:3002/file'
extra_hosts:
- 'host.docker.internal:host-gateway'
- 'cdp.127.0.0.1.sslip.io:host-gateway'
dns:
# Set the DNS server to be the LocalStack container
- 10.0.2.20
networks:
- cdpuploader
proxy:
image: nginxproxy/nginx-proxy:1.4
ports:
- '7300:80'
environment:
- ENABLE_IPV6=true
- DEFAULT_ROOT=418
- DEFAULT_HOST=~^uploader\..*\.sslip\.io
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- cdpuploader
mongo:
# Initialise a Mongo cluster with a replicaset of 1 node.
# Based on https://medium.com/workleap/the-only-local-mongodb-replica-set-with-docker-compose-guide-youll-ever-need-2f0b74dd8384
# Since we are using transactions, we require a replicaset. Local dev with docker compose uses 1 node below, but our live
# environments have multiple nodes.
# The replicaset needs initialising, so the healthcheck can be hijacked to initialise this so that it can keep retrying
# until the operation is successful (might need to wait a while after container boot for this to work, hence the interval/retries)
# WARNING: do not turn on authentication, otherwise will need to deal with generating key pairs and sharing them between
# the replicaset nodes. For local development this is overkill, so just turn off auth and connect to Mongo without creds.
image: mongo:6.0
command: ['--replSet', 'rs0', '--bind_ip_all', '--port', '27017']
restart: unless-stopped
ports:
- 27017:27017
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongo:27017'}]}) }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
start_interval: 1s
retries: 30
environment:
MONGO_INITDB_DATABASE: forms-submission-api
mongo-express:
image: mongo-express
restart: unless-stopped
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/?replicaSet=rs0&directConnection=true
ME_CONFIG_BASICAUTH: false
# Prefer to run the app using `npm run dev`, but if you experience Docker networking issues
# you may want to uncomment the below and run it all in Docker.
#
# forms-submission-api:
# depends_on:
# mongo:
# condition: service_healthy
# build:
# context: .
# dockerfile: Dockerfile
# ports:
# - 3002:3000
# env_file:
# - '.env'
# environment:
# MONGO_URI: mongodb://mongo:27017/?replicaSet=rs0&directConnection=true
s3-manager:
image: cloudlena/s3manager
ports:
- 127.0.0.1:8082:8080
environment:
ENDPOINT: localhost.localstack.cloud:4566
USE_SSL: false
ACCESS_KEY_ID: dummy
SECRET_ACCESS_KEY: dummy
depends_on:
- localstack
dns:
# Set the DNS server to be the LocalStack container
- 10.0.2.20
networks:
- cdpuploader
networks:
cdpuploader:
driver: bridge
ipam:
config:
# Specify the subnet range for IP address allocation
- subnet: 10.0.2.0/24