-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
325 lines (314 loc) · 15.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
version: '3.7'
services:
# Load balancer in the cluster
traefik:
image: traefik:v2.9.1
command:
- --api.insecure=true
- --providers.docker
- --log.level=DEBUG
- --entrypoints.web.address=:80
# Internal entrypoint for communication between services, e.g.
# api-proxy -> worker -> director.
- --entrypoints.internal.address=:8090
# Prevent overriding X-Forwarded headers for internal requests
- --entryPoints.internal.forwardedHeaders.insecure
- --providers.docker.exposedbydefault=false
labels:
- "traefik.enable=true"
ports:
- "127.0.0.1:80:80"
- "127.0.0.1:8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# UI pointing towards the director
director-ui4:
image: ${REGISTRY}/ui4/ng:${FF_VERSION}
environment:
- FACT_FINDER_URL=http://director:8080/fact-finder
- ANALYTICS_URL=http://analytics:9000
- FACT_FINDER_GWT_UI_URL=http://director-gwt-ui:8080/fact-finder-ui
labels:
- "traefik.enable=true"
- "traefik.http.services.ui.loadbalancer.server.port=80"
- "traefik.http.routers.ui.rule=PathPrefix(`/fact-finder-ui`)"
- "traefik.http.routers.ui.entrypoints=web"
- "traefik.http.routers.ui.middlewares=\
strip-ffui-prefix@docker"
- "traefik.http.middlewares.strip-ffui-prefix\
.stripprefix.prefixes=/fact-finder-ui"
# Classic GWT UI included in ui4
director-gwt-ui:
image: ${REGISTRY}/ui/ng:${FF_VERSION}
user: factfinder
environment:
- "JAVA_OPTS=-Dserver.url=\
http://traefik:8090/director/fact-finder/ui/ws/soap/ -Xmx3g"
# Director which is used to change configuration via UI, receive delta-updates, etc.
director:
image: ${REGISTRY}/ff/ng:${FF_VERSION}
user: factfinder
environment:
# Adjust Xmx for your setup.
- JAVA_OPTS=-Xmx3g -Dfff.node.logs.subdirectory=director
# Internal resources directory
- FACTFINDER_RESOURCES=/home/factfinder
# URL pointing towards analytics internal/external
- analytics.public.url=http://localhost/analytics
- analytics.url=http://analytics:9000
# Use postgres database for product data
- importer.dialect=POSTGRES
- importer.serverName=postgres
# Configure client credentials for the workers. Workers must be
# able to create oauth tokens to communicate with analytics.
- oauth.authorization.client.ff_worker.secret=shared-secret
# Director should use the director role
- cluster.role=director
# Import specific channels on startup which are configured accordingly
- useImportOnStartup=false
# Message queue for features like A/B testing. Change login data according to your settings.
# For further information please refer to the RabbitMQ documentation
- rabbitmq.uri=amqp://rabbitmquser:rabbitmqsecurepassword@rabbitmq:5672
- trustHttpForwardedHeaders=true
# Tune tcp keepalive settings for ipvs loadbalancer used e.g. by docker swarm.
# See https://web.archive.org/web/20200614124130if_/https://success.docker.com/article/ipvs-connection-timeout-issue
# for more details.
sysctls:
- net.ipv4.tcp_keepalive_time=600
labels:
- "traefik.enable=true"
- "traefik.http.services.director.loadbalancer.server.port=8080"
- "traefik.http.routers.director.rule=PathPrefix(`/director`)"
- "traefik.http.routers.director.middlewares=\
strip-director-prefix@docker"
# Listen on external and internal entrypoints for api-proxy
# routing.
- "traefik.http.routers.director.entrypoints=web,internal"
- "traefik.http.middlewares.strip-director-prefix\
.stripprefix.prefixes=/director"
volumes:
# Mount resource directory for FACT-Finder configuration
- ./resources:/home/factfinder/fact-finder
# Worker 1 to respond to search requests. You can add more workers.
worker-1:
image: ${REGISTRY}/ff/ng:${FF_VERSION}
user: factfinder
environment:
# Adjust Xmx for your setup.
# Use a separate log directory per worker to avoid messing up your
# app, search and shoppingcart logs.
- JAVA_OPTS=-Xmx3g -Dfff.node.logs.subdirectory=worker-1
# Internal resources directory
- FACTFINDER_RESOURCES=/home/factfinder
# URL pointing towards analytics
- analytics.url=http://analytics:9000
# Use postgres database for product data
- importer.dialect=POSTGRES
- importer.serverName=postgres
# Worker should use the worker role
# Restricts workers capabilities, e.g. a worker is not allowed to
# do full imports.
- cluster.role=worker
# Configures a centralized oauth authorization server, such that
# all tokens are valid on all workers. To make it work, all of the
# three next variables must be set.
- oauth.server.url=http://traefik:8090/director/fact-finder
# The credentials must match with the director setting
# `oauth.authorization.client`.
- oauth.client.id=ff_worker
- oauth.client.secret=shared-secret
# Import specific channels on startup which are configured accordingly
- useImportOnStartup=false
# Automatically poll for new imports & delta updates already
# applied on the director.
- useClusterSync=true
# Disable scheduled jobs on workers. If you have to use scheduled
# jobs on your worker, make sure to configure a separate scheduler
# directory using
# - scheduler.directory={APP_RESOURCES}/conf/scheduler.worker/
- useScheduledJobs=false
# Message queue for features like A/B testing. Change login data according to your settings.
# For further information please refer to the RabbitMQ documentation
- rabbitmq.uri=amqp://rabbitmquser:rabbitmqsecurepassword@rabbitmq:5672
- trustHttpForwardedHeaders=true
# Tune tcp keepalive settings for ipvs loadbalancer used e.g. by docker swarm.
# See https://web.archive.org/web/20200614124130if_/https://success.docker.com/article/ipvs-connection-timeout-issue
# for more details.
sysctls:
- net.ipv4.tcp_keepalive_time=600
labels:
- "traefik.enable=true"
- "traefik.http.services.worker.loadbalancer.server.port=8080"
- "traefik.http.services.worker.loadBalancer.sticky.cookie.name=ff_worker"
- "traefik.http.routers.worker.rule=PathPrefix(`/worker`)"
- "traefik.http.routers.worker.middlewares=\
strip-worker-prefix@docker"
- "traefik.http.routers.worker.entrypoints=web,internal"
- "traefik.http.middlewares.strip-worker-prefix\
.stripprefix.prefixes=/worker"
volumes:
# Mount resource directory for FACT-Finder configuration
- ./resources:/home/factfinder/fact-finder
# Worker 2 to respond to search requests. You can add more workers.
worker-2:
image: ${REGISTRY}/ff/ng:${FF_VERSION}
user: factfinder
environment:
# Adjust Xmx for your setup.
# Use a separate log directory per worker to avoid messing up your
# app, search and shoppingcart logs.
- JAVA_OPTS=-Xmx3g -Dfff.node.logs.subdirectory=worker-2
# Internal resources directory
- FACTFINDER_RESOURCES=/home/factfinder
# URL pointing towards analytics
- analytics.url=http://analytics:9000
# Use postgres database for product data
- importer.dialect=POSTGRES
- importer.serverName=postgres
# Worker should use the worker role
# Restricts workers capabilities, e.g. a worker is not allowed to
# do full imports.
- cluster.role=worker
# Configures a centralized oauth authorization server, such that
# all tokens are valid on all workers. To make it work, all of the
# three next variables must be set.
- oauth.server.url=http://traefik:8090/director/fact-finder
# The credentials must match with the director setting
# `oauth.authorization.client`.
- oauth.client.id=ff_worker
- oauth.client.secret=shared-secret
# Import specific channels on startup which are configured accordingly
- useImportOnStartup=false
# Automatically poll for new imports & delta updates already
# applied on the director.
- useClusterSync=true
# Disable scheduled jobs on workers. If you have to use scheduled
# jobs on your worker, make sure to configure a separate scheduler
# directory using
# - scheduler.directory={APP_RESOURCES}/conf/scheduler.worker/
- useScheduledJobs=false
# Message queue for features like A/B testing. Change login data according to your settings.
# For further information please refer to the RabbitMQ documentation
- rabbitmq.uri=amqp://rabbitmquser:rabbitmqsecurepassword@rabbitmq:5672
# Tune tcp keepalive settings for ipvs loadbalancer used e.g. by docker swarm.
# See https://web.archive.org/web/20200614124130if_/https://success.docker.com/article/ipvs-connection-timeout-issue
# for more details.
sysctls:
- net.ipv4.tcp_keepalive_time=600
labels:
- "traefik.enable=true"
- "traefik.http.services.worker.loadbalancer.server.port=8080"
- "traefik.http.services.worker.loadBalancer.sticky.cookie.name=ff_worker"
- "traefik.http.routers.worker.rule=PathPrefix(`/worker`)"
- "traefik.http.routers.worker.middlewares=\
strip-worker-prefix@docker"
- "traefik.http.routers.worker.entrypoints=web,internal"
- "traefik.http.middlewares.strip-worker-prefix\
.stripprefix.prefixes=/worker"
volumes:
# Mount resource directory for FACT-Finder configuration
- ./resources:/home/factfinder/fact-finder
# Translates incoming requests on /director/fact-finder/rest/v2 or
# /director/fact-finder/rest/v3 or /director/fact-finder/rest/v4
# to /director/fact-finder/rest/v5
api-proxy-director:
image: ${REGISTRY}/ff-api-proxy/ng:${FF_VERSION}
# Set target-version to the current API version of FACT-Finder
command: >
--target http://traefik:8090/director/fact-finder
--target-version 5
--trust-proxy
labels:
- "traefik.enable=true"
- "traefik.http.services.api-proxy-director\
.loadbalancer.server.port=3000"
- "traefik.http.routers.api-proxy-director.entrypoints=web"
# Create rules for every API version in use below target-version beginning from v2
- "traefik.http.routers.api-proxy-director.rule=\
PathPrefix(`/director/fact-finder/rest/v2`) || PathPrefix(`/director/fact-finder/rest/v3`) || PathPrefix(`/director/fact-finder/rest/v4`)"
- "traefik.http.routers.api-proxy-director.middlewares=\
strip-api-proxy-director-prefix@docker"
- "traefik.http.middlewares.strip-api-proxy-director-prefix.\
stripprefix.prefixes=/director/fact-finder"
# Translates incoming requests on /worker/fact-finder/rest/v2 or
# /worker/fact-finder/rest/v3 or /worker/fact-finder/rest/v4 to
# /worker/fact-finder/rest/v5
api-proxy-worker:
image: ${REGISTRY}/ff-api-proxy/ng:${FF_VERSION}
# Use the internal traefik entrypoint, such that the traefik
# load balancer will be used. If you'd point directly to the swarm
# service, the swarm load balancer would be used without support for
# sticky session and weights.
#
# Set target-version to the current API version of FACT-Finder
command: >
--target http://traefik:8090/worker/fact-finder
--target-version 5
--trust-proxy
labels:
- "traefik.enable=true"
- "traefik.http.services.api-proxy-worker\
.loadbalancer.server.port=3000"
- "traefik.http.routers.api-proxy-worker.entrypoints=web"
# Create rules for every API version in use below target-version beginning from v2
- "traefik.http.routers.api-proxy-worker.rule=\
PathPrefix(`/worker/fact-finder/rest/v2`) || PathPrefix(`/worker/fact-finder/rest/v3`) || PathPrefix(`/worker/fact-finder/rest/v4`)"
- "traefik.http.routers.api-proxy-worker.middlewares=\
strip-api-proxy-worker-prefix@docker"
- "traefik.http.middlewares.strip-api-proxy-worker-prefix\
.stripprefix.prefixes=/worker/fact-finder"
# Analytics software to analyse FACT-Finder logfiles
analytics:
image: ${REGISTRY}/newlytics:${ANALYTICS_TAG}
command: ['-Dconfig.file=/opt/docker/production.conf']
volumes:
- ./resources:/home/factfinder/ff
- ./analytics/resources:/home/factfinder/analytics
- ./analytics/production.conf:/opt/docker/production.conf
environment:
- LOGS_DIRECTORY=/home/factfinder/ff/logs
- PG_DATABASE_URL=jdbc:postgresql://postgres/analytics?user=postgres
- OAUTH_URL=http://traefik:8090/director/fact-finder
- FF_URL=http://traefik:8090/director/fact-finder
# Set to the current API version of FACT-Finder
- FF_API_VERSION=v5
# Tune tcp keepalive settings for ipvs loadbalancer used e.g. by docker swarm.
# See https://web.archive.org/web/20200614124130if_/https://success.docker.com/article/ipvs-connection-timeout-issue
# for more details.
sysctls:
- net.ipv4.tcp_keepalive_time=600
depends_on:
- director
- postgres
labels:
- "traefik.enable=true"
- "traefik.http.services.analytics\
.loadbalancer.server.port=9000"
- "traefik.http.routers.analytics.entrypoints=web"
- "traefik.http.routers.analytics.rule=\
PathPrefix(`/analytics`)"
- "traefik.http.routers.analytics.middlewares=\
strip-analytics-prefix@docker"
- "traefik.http.middlewares.strip-analytics-prefix\
.stripprefix.prefixes=/analytics"
logging:
driver: 'json-file'
# Database for product data and delta updates
postgres:
image: postgres:15.0-alpine
shm_size: 256M
volumes:
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
# Tune tcp keepalive settings for ipvs loadbalancer used e.g. by docker swarm.
# See https://web.archive.org/web/20200614124130if_/https://success.docker.com/article/ipvs-connection-timeout-issue
# for more details.
sysctls:
- net.ipv4.tcp_keepalive_time=600
# Message queue
rabbitmq:
image: rabbitmq:3.11.1-management
volumes:
- ./rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
- ./rabbitmq/rabbitmq.definitions:/var/lib/rabbitmq/definitions.json