-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
191 lines (181 loc) · 4.71 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
services:
brittle-api:
build:
context: .
target: brittle-api
command:
- serve
- --api-failure-rate=0.5
- --api-silent-failure-rate=0.3
- --api-min-latency=1
- --api-max-latency=3
- :8000
ports:
- 8000:8000
# Note: The broker doesn't start as a service here, it just runs the broker
# executable once. This is rather a placeholder than an actual service.
mongodb-broker:
build:
context: .
target: broker
depends_on:
mongodb:
condition: service_healthy
environment:
- EVENTSTORE_DRIVER=mongodb
- EVENTSTORE_DB_HOST=mongodb
profiles:
- mongodb-storage
mongodb:
image: mongo:4.4
healthcheck:
test: ["CMD", "mongo", "--eval", "db.help()"]
interval: 10s
timeout: 2s
retries: 1
ports:
- 27017/tcp
volumes:
- type: bind
source: ./docker-compose.d/setup-mongodb-event-store.sh
target: /docker-entrypoint-initdb.d/setup-event-store.sh
- type: volume
source: mongodb-data
target: /data/db
profiles:
- mongodb-storage
labels:
# Note: For Traefik, the router must have at least one rule, therefore
# the dummy catch-all `HostSNI()` rule.
- traefik.enable=true
- traefik.tcp.routers.mongodb.rule=HostSNI(`*`)
- traefik.tcp.routers.mongodb.entrypoints=mongodb
mongodb-processor:
build:
context: .
target: broker
depends_on:
mongodb:
condition: service_healthy
command:
- process
- --api-url=http://brittle-api:8000
environment:
- EVENTSTORE_DRIVER=mongodb
- EVENTSTORE_DB_HOST=mongodb
profiles:
- mongodb-storage
mongodb-watcher:
build:
context: .
target: broker
depends_on:
mongodb:
condition: service_healthy
command:
- watch-requests
environment:
- EVENTSTORE_DRIVER=mongodb
- EVENTSTORE_DB_HOST=mongodb
profiles:
- mongodb-storage
# Note: The broker doesn't start as a service here, it just runs the broker
# executable once. This is rather a placeholder than an actual service.
postgresql-broker:
build:
context: .
target: broker
depends_on:
postgresql:
condition: service_healthy
environment:
- EVENTSTORE_DRIVER=postgresql
- EVENTSTORE_DB_HOST=postgresql
profiles:
- postgresql-storage
postgresql:
image: postgres:13.8
environment:
- POSTGRES_PASSWORD=postgres
healthcheck:
test: ["CMD", "pg_isready", "-d", "db_prod"]
interval: 10s
timeout: 2s
retries: 1
ports:
- 5432/tcp
volumes:
- type: bind
source: ./docker-compose.d/setup-postgresql-event-store.sh
target: /docker-entrypoint-initdb.d/setup-event-store.sh
- type: volume
source: postgresql-data
target: /var/lib/postgresql/data
profiles:
- postgresql-storage
labels:
# Note: For Traefik, the router must have at least one rule, therefore
# the dummy catch-all `HostSNI()` rule.
- traefik.enable=true
- traefik.tcp.routers.postgresql.rule=HostSNI(`*`)
- traefik.tcp.routers.postgresql.entrypoints=postgresql
postgresql-processor:
build:
context: .
target: broker
depends_on:
postgresql:
condition: service_healthy
command:
- process
- --api-url=http://brittle-api:8000
environment:
- EVENTSTORE_DRIVER=postgresql
- EVENTSTORE_DB_HOST=postgresql
profiles:
- postgresql-storage
postgresql-watcher:
build:
context: .
target: broker
depends_on:
postgresql:
condition: service_healthy
command:
- watch-requests
environment:
- EVENTSTORE_DRIVER=postgresql
- EVENTSTORE_DB_HOST=postgresql
profiles:
- postgresql-storage
traefik:
image: traefik:2.10
command:
# turn off data exfiltration
- "--global.checknewversion=false"
- "--global.sendanonymoususage=false"
# web UI / dashboard
- "--api.insecure=true"
# configuration
- "--log.level=DEBUG"
- "--providers.docker=true"
# define MongoDB entrypoint
- --entrypoints.mongodb.address=:27017
# define PostgreSQL entrypoint
- --entrypoints.postgresql.address=:5432
ports:
- 80:80
# web UI at http://traefik.docker.localhost:8080
# (enabled by --api.insecure=true)
- 8080:8080
# expose MongoDB port
- 27017:27017/tcp
# expose PostgreSQL port
- 5432:5432/tcp
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
volumes:
mongodb-data:
postgresql-data: