-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
61 lines (58 loc) · 2.3 KB
/
docker-compose.yml
File metadata and controls
61 lines (58 loc) · 2.3 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
services:
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-audit-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
localstack:
image: localstack/localstack:3.0.2
ports:
- '4566:4566' # LocalStack Gateway
- '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:
- cdp-tenant
networks:
cdp-tenant:
driver: bridge
name: cdp-tenant