-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose-all.yml
504 lines (459 loc) · 18.8 KB
/
docker-compose-all.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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
version: '3.6'
services:
pg:
image: postgres:$POSTGRES_VERSION
environment:
- 'POSTGRES_DB=$POSTGRES_DB'
- 'POSTGRES_USER=$POSTGRES_USER'
- 'POSTGRES_PASSWORD=$POSTGRES_PASSWORD'
volumes:
- 'pg-data-volume:/var/lib/postgresql/data'
- './docker/pg/create-users.sql:/docker-entrypoint-initdb.d/create-users.sql'
command: -c log_min_messages=FATAL
rabbitmq:
image: rabbitmq:$RABBITMQ_VERSION
hostname: rabbitmq
volumes:
- './docker/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf'
- './docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins'
- 'rabbitmq-data-volume:/var/lib/rabbitmq/mnesia/rabbit@rabbitmq'
environment:
- 'RABBITMQ_LOGS=-'
ports:
- $RABBITMQ_MANAGEMENT_LOCAL_PORT:15672
redis:
image: redis:$REDIS_VERSION
volumes:
- 'redis-data-volume:/data'
# This acts as HTTP reverse proxy for all the other containers.
nginx:
image: nginx:1.19.4
volumes:
- './docker/nginx/nginx.conf:/etc/nginx/nginx.conf'
- './docker/nginx/templates:/etc/nginx/templates'
- './docker/nginx/ssl/cert.pem:/etc/nginx/ssl/cert.pem'
- './docker/nginx/ssl/key.pem:/etc/nginx/ssl/key.pem'
ports:
- $PUBLIC_PORT:$PUBLIC_PORT
environment:
- 'PORT=$PUBLIC_PORT'
- 'CREDITORS_HYDRA_URL=http://creditors-hydra:4444'
- 'CREDITORS_LOGIN_URL=http://creditors-login:8080'
- 'CREDITORS_SERVER_URL=http://creditors-apiproxy:8080'
- 'CREDITORS_SWAGGER_UI_URL=http://creditors-swagger-ui:8080'
- 'CREDITORS_WEBAPP_URL=http://creditors-webapp:80'
- 'TRADE_SERVER_URL=http://trade-webserver:8080'
- 'TRADE_SWAGGER_UI_URL=http://trade-swagger-ui:8080'
- 'NGINX_ENTRYPOINT_QUIET_LOGS=1'
depends_on:
- creditors-hydra
- creditors-login
- creditors-apiproxy
- creditors-swagger-ui
- creditors-webapp
- trade-webserver
- trade-swagger-ui
# This container acts as a reverse proxy. It extracts the the creditor ID
# from the the incoming HTTP request, calculates a sharding key, and then,
# based on the sharding key, decides to which server to forward the
# incoming request. In this simple example, `creditors-server` is the only
# shard.
creditors-apiproxy:
image: ghcr.io/swaptacular/swpt_apiproxy:latest
volumes:
- './docker/apiproxy/creditors.conf:/etc/apiproxy.conf'
environment:
- 'MIN_CREDITOR_ID=$MIN_CREDITOR_ID'
- 'MAX_CREDITOR_ID=$MAX_CREDITOR_ID'
- 'APIPROXY_PORT=8080'
- 'APIPROXY_CONFIG_FILE=/etc/apiproxy.conf'
restart: always
creditors-server:
build:
context: .
dockerfile: Dockerfile
target: app-image
environment:
- 'MIN_CREDITOR_ID=$MIN_CREDITOR_ID'
- 'MAX_CREDITOR_ID=$MAX_CREDITOR_ID'
- 'PIN_PROTECTION_SECRET=some-long-string-that-must-be-kept-secret'
- 'OAUTH2_INTROSPECT_URL=http://creditors-hydra:4445/oauth2/introspect'
- 'OAUTH2_SUPERUSER_USERNAME=creditors-superuser'
- 'OAUTH2_SUPERVISOR_USERNAME=creditors-supervisor'
- 'WEBSERVER_PROCESSES=1'
- 'WEBSERVER_THREADS=3'
- 'WEBSERVER_PORT=8080'
- 'POSTGRES_URL=postgresql+psycopg://swpt_creditors:swpt_creditors@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'PROTOCOL_BROKER_QUEUE=swpt_creditors'
- 'PROTOCOL_BROKER_QUEUE_ROUTING_KEY=#'
- 'PROTOCOL_BROKER_PROCESSES=1'
- 'PROTOCOL_BROKER_THREADS=3'
- 'PROTOCOL_BROKER_PREFETCH_COUNT=10'
- 'FLUSH_PROCESSES=1'
- 'FLUSH_PERIOD=1.5'
- 'DELETE_PARENT_SHARD_RECORDS=false'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
depends_on:
- pg
- rabbitmq
- creditors-hydra
# The purpose of this container is to create the database schema for
# the `creditors-server` container, and all the necessary RabbitMQ
# objects (queues, exchanges, etc.). It has to be run only once, but
# running it multiple times should not do any harm. Set
# `SETUP_RABBITMQ_BINDINGS` to anything other than "yes", if you do
# not want RabbitMQ exchanges and bindings to be (re)configured.
creditors-server-config:
build:
context: .
dockerfile: Dockerfile
target: app-image
environment:
- 'MIN_CREDITOR_ID=$MIN_CREDITOR_ID'
- 'MAX_CREDITOR_ID=$MAX_CREDITOR_ID'
- 'POSTGRES_URL=postgresql+psycopg://swpt_creditors:swpt_creditors@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'PROTOCOL_BROKER_QUEUE=swpt_creditors'
- 'PROTOCOL_BROKER_QUEUE_ROUTING_KEY=#'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
- 'SETUP_RABBITMQ_BINDINGS=yes'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
command: configure
depends_on:
- pg
- rabbitmq
# From the `swagger-ui-image`, runs a Swagger UI cleint for the
# "Payments Web API".
creditors-swagger-ui:
build:
context: .
dockerfile: Dockerfile
target: swagger-ui-image
environment:
- 'BASE_URL=/creditors-swagger-ui'
- 'API_ROOT=https://$PUBLIC_HOST/'
- 'OAUTH2_AUTHORIZATION_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/auth'
- 'OAUTH2_TOKEN_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/token'
- 'OAUTH2_REFRESH_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/token'
- 'OAUTH2_REDIRECT_URL=https://$PUBLIC_HOST/creditors-swagger-ui/oauth2-redirect.html'
# Serves the creditors UI webapp (useful for testing).
creditors-webapp:
image: ghcr.io/swaptacular/swpt_creditors_ui:$SWPT_CREDITORS_UI_VERSION
environment:
- 'SERVER_API_ENTRYPOINT=https://$PUBLIC_HOST/creditors/.wallet'
- 'SERVER_API_TIMEOUT=8000'
- 'AUTHORIZATION_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/auth'
- 'TOKEN_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/token'
- 'CLIENT_ID=creditors-webapp'
- 'REDIRECT_URL=https://$PUBLIC_HOST/creditors-webapp/'
- 'TRANSFER_DELETION_DELAY_SECONDS=1296000'
- 'DEBTOR_INFOS_REVISION_DAYS=7'
# This container runs the Web UI for user registrations, login, and
# OAuth2 authorization consent. Note that in production it is
# recommended to also run one "login" container with the `flush`
# command.
creditors-login:
image: ghcr.io/swaptacular/swpt_login:$SWPT_LOGIN_VERSION
environment:
- 'HYDRA_ADMIN_URL=http://creditors-hydra:4445/'
- 'SUBJECT_PREFIX=creditors:'
- 'WEBSERVER_PORT=8080'
- 'WEBSERVER_PROCESSES=1'
- 'WEBSERVER_THREADS=3'
- 'SQLALCHEMY_DATABASE_URI=postgresql://swpt_creditors_login:swpt_creditors_login@pg/${POSTGRES_DB}'
- 'REDIS_URL=redis://redis:6379/0?health_check_interval=30'
- 'SITE_TITLE=Swaptacular'
- 'ABOUT_URL=https://swaptacular.github.io/overview'
- 'MAIL_SERVER=mail'
- 'MAIL_PORT=1025'
- 'MAIL_DEFAULT_SENDER=Swaptacular <[email protected]>'
- 'RECAPTCHA_PUBLIC_KEY=6Lc902MUAAAAAJL22lcbpY3fvg3j4LSERDDQYe37'
- 'RECAPTCHA_PIVATE_KEY=6Lc902MUAAAAAN--r4vUr8Vr7MU1PF16D9k2Ds9Q'
- 'SUPERVISOR_CLIENT_ID=creditors-supervisor'
- 'SUPERVISOR_CLIENT_SECRET=creditors-supervisor'
- 'API_AUTH2_TOKEN_URL=https://nginx:$PUBLIC_PORT/creditors-hydra/oauth2/token'
- 'API_RESOURCE_SERVER=https://nginx:$PUBLIC_PORT'
- 'API_TIMEOUT_SECONDS=5'
- 'APP_SIGNUP_REDIRECT_URL=https://$PUBLIC_HOST/creditors-webapp/'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
depends_on:
- pg
- redis
- mail
- creditors-hydra
# The purpose of this container is to initialize the database of the
# `creditors-login` container, and to create a predefined set of
# OAuth2 clients (like "swagger-ui"). It has to be run only once,
# but running it multiple times should not do any harm.
#
# IMPORTANT NOTE: The method of defining OAuth2 clients which we use
# here will not work with Ory Hydra version 2 or newer. Also, to
# configure the default admin API endpoint in Ory Hydra >= 2, you
# should use the "ORY_SDK_URL" environment variable instead of
# "HYDRA_ADMIN_URL" ('ORY_SDK_URL=http://creditors-hydra:4445/').
creditors-login-config:
image: ghcr.io/swaptacular/swpt_login:$SWPT_LOGIN_VERSION
volumes:
- './docker/hydra:/etc/hydra-config'
environment:
- 'HYDRA_ADMIN_URL=http://creditors-hydra:4445/'
- 'SQLALCHEMY_DATABASE_URI=postgresql://swpt_creditors_login:swpt_creditors_login@pg/${POSTGRES_DB}'
command: >
sh -c '/usr/src/app/entrypoint.sh configure
&& (
hydra clients get creditors-webapp --fake-tls-termination > /dev/null
|| hydra clients import
/etc/hydra-config/creditors-supervisor.json
/etc/hydra-config/swagger-ui.json
/etc/hydra-config/creditors-webapp.json
--fake-tls-termination
)'
depends_on:
- pg
- creditors-hydra
restart: on-failure
# This container runs the Ory Hydra open source OAuth 2.0 server
# (https://github.com/ory/hydra), which is used to generate and
# verify access tokens.
#
# IMPORTANT NOTE: Here we use an old version (v1.11.10) of Ory
# Hydra. The reason for this is that from version 2, Ory Hydra does
# not allow users to chose client IDs (they are always automatically
# generated UUIDs). However, for this demo to work without
# complicated parameters tweaking, we need to be able to choose the
# client IDs.
#
# Another important backward incompatible change that Ory Hydra 2
# brings is that it prefixes all admin API endpoints with "/admin/".
#
# Therefore, in the client containers, instead of:
# 'HYDRA_ADMIN_URL=http://creditors-hydra:4445/' and
# 'OAUTH2_INTROSPECT_URL=http://creditors-hydra:4445/oauth2/introspect'
#
# with Ory Hydra >= 2, we would have:
# 'HYDRA_ADMIN_URL=http://creditors-hydra:4445/admin/' and
# 'OAUTH2_INTROSPECT_URL=http://creditors-hydra:4445/admin/oauth2/introspect'
creditors-hydra:
image: oryd/hydra:v1.11.10
environment:
- 'SERVE_PUBLIC_PORT=4444'
- 'SERVE_ADMIN_PORT=4445'
- 'SERVE_TLS_ALLOW_TERMINATION_FROM=0.0.0.0/0'
- 'TTL_ACCESS_TOKEN=720h'
- 'TTL_REFRESH_TOKEN=720h'
- 'SECRETS_SYSTEM=$HYDRA_SYSTEM_SECRET'
- 'URLS_SELF_ISSUER=https://$PUBLIC_HOST/creditors-hydra/'
- 'URLS_LOGIN=https://$PUBLIC_HOST/creditors-login/'
- 'URLS_CONSENT=https://$PUBLIC_HOST/creditors-consent/'
- 'URLS_ERROR=https://github.com/swaptacular/swpt_login'
- 'DSN=postgres://hydra_creditors:hydra_creditors@pg/${POSTGRES_DB}?sslmode=disable&max_conns=2&max_idle_conns=1&max_conn_lifetime=30s'
- 'SQA_OPT_OUT=true'
- 'LOG_LEVEL=warn'
- 'LOG_FORMAT=json'
depends_on:
- pg
restart: on-failure
# The purpose of this container is to initialize the database of the
# `creditors-hydra` container. It has to be run only once, but
# running it multiple times should not do any harm.
creditors-hydra-config:
image: oryd/hydra:v1.11.10
environment:
- 'DSN=postgres://hydra_creditors:hydra_creditors@pg/${POSTGRES_DB}?sslmode=disable&max_conns=2&max_idle_conns=1&max_conn_lifetime=30s'
command:
migrate sql --read-from-env --yes
depends_on:
- pg
restart: on-failure
creditors-stomp-server:
image: ghcr.io/swaptacular/swpt_stomp:$SWPT_STOMP_VERSION
environment:
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'SWPT_SERVER_PORT=1234'
- 'SWPT_SERVER_CERT=/etc/swpt/server.crt'
- 'SWPT_SERVER_KEY=/secrets/swpt-server.key'
- 'SWPT_NODEDATA_URL=file:///var/lib/swpt-nodedata'
- 'APP_LOG_LEVEL=info'
- 'APP_LOG_FORMAT=json'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
volumes:
- './docker/nodedata/server.crt:/etc/swpt/server.crt'
- './docker/nodedata/server.key:/secrets/swpt-server.key'
- './docker/nodedata:/var/lib/swpt-nodedata'
ports:
- $SWPT_SERVER_LOCAL_PORT:1234
command: swpt-server
depends_on:
- rabbitmq
restart: always
# The purpose of this container is to create and configure the RabbitMQ
# queue, from which the "creditors-peer-1234abcd" container will consume
# messages (to send them to the given peer). It has to be run only once,
# but running it multiple times should not do any harm.
creditors-peer-1234abcd-config:
image: ghcr.io/swaptacular/swpt_stomp:$SWPT_STOMP_VERSION
environment:
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'SWPT_SERVER_CERT=/etc/swpt/server.crt'
- 'SWPT_SERVER_KEY=/secrets/swpt-server.key'
- 'SWPT_NODEDATA_URL=file:///var/lib/swpt-nodedata'
- 'APP_LOG_LEVEL=info'
- 'APP_LOG_FORMAT=json'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
volumes:
- './docker/nodedata/server.crt:/etc/swpt/server.crt'
- './docker/nodedata/server.key:/secrets/swpt-server.key'
- './docker/nodedata:/var/lib/swpt-nodedata'
command: configure-queue 1234abcd ca.1234abcd
depends_on:
- rabbitmq
restart: on-failure
# The purpose of this container is to open and maintain a permanent client
# STOMP connection to the "1234abcd" peer, sending outgoing Swaptacular
# Messaging Protocol messages to this peer.
#
# NOTE: Similar containers must be configured for every added peer!
creditors-peer-1234abcd:
image: ghcr.io/swaptacular/swpt_stomp:$SWPT_STOMP_VERSION
environment:
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'SWPT_SERVER_CERT=/etc/swpt/server.crt'
- 'SWPT_SERVER_KEY=/secrets/swpt-server.key'
- 'SWPT_NODEDATA_URL=file:///var/lib/swpt-nodedata'
- 'APP_LOG_LEVEL=info'
- 'APP_LOG_FORMAT=json'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
volumes:
- './docker/nodedata/server.crt:/etc/swpt/server.crt'
- './docker/nodedata/server.key:/secrets/swpt-server.key'
- './docker/nodedata:/var/lib/swpt-nodedata'
extra_hosts:
- "host.docker.internal:host-gateway"
command: swpt-client 1234abcd ca.1234abcd
depends_on:
- rabbitmq
restart: always
# The `creditors-login` container needs access to a mail server
# instance. This runs a dummy mail server which is useful only for
# testing.
mail:
image: mailhog/mailhog:v1.0.1
ports:
- $MAILHOG_LOCAL_PORT:8025
trade-solver:
image: ghcr.io/swaptacular/swpt_trade:$SWPT_TRADE_VERSION
environment:
- 'TURN_PERIOD=10m'
- 'TURN_PERIOD_OFFSET=0'
- 'TURN_CHECK_INTERVAL=5s'
- 'TURN_PHASE1_DURATION=1m'
- 'TURN_PHASE2_DURATION=5m'
- 'BASE_DEBTOR_INFO_LOCATOR=$BASE_DEBTOR_INFO_LOCATOR'
- 'BASE_DEBTOR_ID=$BASE_DEBTOR_ID'
- 'MAX_DISTANCE_TO_BASE=10'
- 'MIN_TRADE_AMOUNT=1000'
- 'SOLVER_POSTGRES_URL=postgresql+psycopg://swpt_solver:swpt_solver@pg:5432/${POSTGRES_DB}'
- 'SOLVER_CLIENT_POOL_SIZE=0'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
command: solver
depends_on:
- pg
trade-worker:
image: ghcr.io/swaptacular/swpt_trade:$SWPT_TRADE_VERSION
environment:
- 'MIN_COLLECTOR_ID=$MIN_COLLECTOR_ID'
- 'MAX_COLLECTOR_ID=$MAX_COLLECTOR_ID'
- 'TRANSFERS_HEALTHY_MAX_COMMIT_DELAY=5m'
- 'TRANSFERS_AMOUNT_CUT=1e-6'
- 'WORKER_POSTGRES_URL=postgresql+psycopg://swpt_worker:swpt_worker@pg:5432/${POSTGRES_DB}'
- 'SOLVER_POSTGRES_URL=postgresql+psycopg://swpt_solver:swpt_solver@pg:5432/${POSTGRES_DB}'
- 'SOLVER_CLIENT_POOL_SIZE=0'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'PROTOCOL_BROKER_QUEUE=swpt_trade'
- 'PROTOCOL_BROKER_QUEUE_ROUTING_KEY=#'
- 'PROTOCOL_BROKER_PROCESSES=1'
- 'PROTOCOL_BROKER_THREADS=3'
- 'PROTOCOL_BROKER_PREFETCH_COUNT=10'
- 'FLUSH_PROCESSES=1'
- 'FLUSH_PERIOD=1.5'
- 'HTTP_FETCH_PROCESSES=1'
- 'HTTP_FETCH_PERIOD=5.0'
- 'HTTP_FETCH_CONNECTIONS=100'
- 'HTTP_FETCH_TIMEOUT=10.0'
- 'TRIGGER_TRANSFERS_PROCESSES=1'
- 'TRIGGER_TRANSFERS_PERIOD=5.0'
- 'HANDLE_PRISTINE_COLLECTORS_THREADS=1'
- 'HANDLE_PRISTINE_COLLECTORS_PERIOD=60.0'
- 'DELETE_PARENT_SHARD_RECORDS=false'
- 'APP_ROLL_WORKER_TURNS_WAIT=5.0'
- 'APP_VERIFY_SSL_CERTS=false'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
extra_hosts:
- "host.docker.internal:host-gateway"
command: worker
depends_on:
- pg
- rabbitmq
trade-webserver:
image: ghcr.io/swaptacular/swpt_trade:$SWPT_TRADE_VERSION
environment:
- 'MIN_COLLECTOR_ID=$MIN_COLLECTOR_ID'
- 'MAX_COLLECTOR_ID=$MAX_COLLECTOR_ID'
- 'OAUTH2_INTROSPECT_URL=http://creditors-hydra:4445/oauth2/introspect'
- 'OAUTH2_SUPERUSER_USERNAME=creditors-superuser'
- 'OAUTH2_SUPERVISOR_USERNAME=creditors-supervisor'
- 'SOLVER_POSTGRES_URL=postgresql+psycopg://swpt_solver:swpt_solver@pg:5432/${POSTGRES_DB}'
- 'SOLVER_CLIENT_POOL_SIZE=0'
- 'WEBSERVER_PROCESSES=1'
- 'WEBSERVER_THREADS=3'
- 'WEBSERVER_PORT=8080'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
command: webserver
depends_on:
- pg
- creditors-hydra
# The purpose of this container is to create the database schema for
# `trade-solver`, `trade-worker`, and `trade-webserver` containers,
# and all the necessary RabbitMQ objects (queues, exchanges, etc.).
# It has to be run only once, but running it multiple times should
# not do any harm. Set `SETUP_RABBITMQ_BINDINGS` to anything other
# than "yes", if you do not want RabbitMQ exchanges and bindings to
# be (re)configured.
trade-config:
image: ghcr.io/swaptacular/swpt_trade:$SWPT_TRADE_VERSION
environment:
- 'SOLVER_POSTGRES_URL=postgresql+psycopg://swpt_solver:swpt_solver@pg:5432/${POSTGRES_DB}'
- 'WORKER_POSTGRES_URL=postgresql+psycopg://swpt_worker:swpt_worker@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'PROTOCOL_BROKER_QUEUE=swpt_trade'
- 'PROTOCOL_BROKER_QUEUE_ROUTING_KEY=#'
- 'APP_LOG_LEVEL=warning'
- 'APP_LOG_FORMAT=json'
- 'SETUP_RABBITMQ_BINDINGS=yes'
- 'SUBSTITUTE_LOCALHOST_IN_VARS=PROTOCOL_BROKER_URL'
command: configure
depends_on:
- pg
- rabbitmq
trade-swagger-ui:
image: ghcr.io/swaptacular/swpt_trade_swagger_ui:$SWPT_TRADE_VERSION
environment:
- 'BASE_URL=/trade-swagger-ui'
- 'API_ROOT=https://$PUBLIC_HOST/'
- 'OAUTH2_AUTHORIZATION_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/auth'
- 'OAUTH2_TOKEN_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/token'
- 'OAUTH2_REFRESH_URL=https://$PUBLIC_HOST/creditors-hydra/oauth2/token'
- 'OAUTH2_REDIRECT_URL=https://$PUBLIC_HOST/trade-swagger-ui/oauth2-redirect.html'
volumes:
pg-data-volume:
rabbitmq-data-volume:
redis-data-volume: