-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
287 lines (248 loc) · 10.7 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
version: '3.6'
volumes:
pg-data-volume:
rabbitmq-data-volume:
gateway-cache-volume:
accounts-cache-volume:
redis-data-volume:
postfix-spool-volume:
services:
pg:
image: postgres:$POSTGRES_VERSION
environment:
- 'POSTGRES_DB=$POSTGRES_DB'
- 'POSTGRES_USER=$POSTGRES_USER'
- 'POSTGRES_PASSWORD=$POSTGRES_USER'
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
ports:
- $POSTGRES_LOCAL_PORT:5432
restart: always
rabbitmq:
image: rabbitmq:$RABBITMQ_VERSION
hostname: rabbitmq
volumes:
- './docker/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf'
- './docker/rabbitmq/create-bindings.sh:/usr/local/bin/create-bindings.sh'
- 'rabbitmq-data-volume:/var/lib/rabbitmq/mnesia/rabbit@rabbitmq'
environment:
- 'RABBITMQ_LOGS=-'
ports:
- $RABBITMQ_MANAGEMENT_LOCAL_PORT:15672
restart: always
accounts-apiproxy:
image: ghcr.io/swaptacular/swpt_apiproxy:latest
volumes:
- './docker/apiproxy/accounts.conf:/etc/apiproxy.conf'
environment:
- 'APIPROXY_PORT=8080'
- 'APIPROXY_CONFIG_FILE=/etc/apiproxy.conf'
restart: always
accounts-server:
image: ghcr.io/swaptacular/swpt_accounts:$SWPT_ACCOUNTS_VERSION
env_file: configuration/accounts-server.env
environment:
- 'WEBSERVER_PORT=8080'
- 'FETCH_API_URL=http://accounts-cache:80'
- 'POSTGRES_URL=postgresql+psycopg://swpt_accounts:swpt_accounts@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'CHORES_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
restart: always
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:
image: ghcr.io/swaptacular/swpt_creditors:$SWPT_CREDITORS_VERSION
env_file: configuration/creditors-server.env
environment:
- 'WEBSERVER_PORT=8080'
- 'POSTGRES_URL=postgresql+psycopg://swpt_creditors:swpt_creditors@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'OAUTH2_INTROSPECT_URL=http://creditors-login:4445/oauth2/introspect'
- 'REDIS_URL=redis://redis:6379/2?health_check_interval=30'
- 'PIN_PROTECTION_SECRET=$CREDITORS_PIN_PROTECTION_SECRET'
- 'MIN_CREDITOR_ID=$MIN_CREDITOR_ID'
- 'MAX_CREDITOR_ID=$MAX_CREDITOR_ID'
- 'APP_CREDITOR_SUBJECT_REGEX=^creditors:([0-9]+)$$'
restart: always
creditors-login:
image: ghcr.io/swaptacular/swpt_login:$SWPT_LOGIN_VERSION
env_file: configuration/creditors-login.env
environment:
- 'SUBJECT_PREFIX=creditors:'
- 'SERVE_TLS_ALLOW_TERMINATION_FROM=0.0.0.0/0'
- 'SERVE_PUBLIC_PORT=4444'
- 'SERVE_ADMIN_PORT=4445'
- 'WEBSERVER_PORT=8080'
- 'SECRETS_COOKIE=$CREDITORS_LOGIN_COOKIE_SECRET'
- 'SECRETS_SYSTEM=$CREDITORS_LOGIN_SYSTEM_SECRET'
- 'SUPERVISOR_CLIENT_SECRET=$CREDITORS_SUPERVISOR_CLIENT_SECRET'
- 'HYDRA_DSN=postgres://hydra_creditors:hydra_creditors@pg/${POSTGRES_DB}?sslmode=disable&max_conns=2&max_idle_conns=1&max_conn_lifetime=30s'
- 'SQLALCHEMY_DATABASE_URI=postgresql://swpt_creditors_login:swpt_creditors_login@pg/${POSTGRES_DB}'
- 'REDIS_URL=redis://redis:6379/0?health_check_interval=30'
- 'URLS_SELF_ISSUER=https://$PUBLIC_HOST/creditors-hydra/'
- 'URLS_LOGIN=https://$PUBLIC_HOST/creditors-login/'
- 'URLS_CONSENT=https://$PUBLIC_HOST/creditors-consent/'
- 'API_AUTH2_TOKEN_URL=https://nginx:$PUBLIC_PORT/creditors-hydra/oauth2/token'
- 'API_RESOURCE_SERVER=https://nginx:$PUBLIC_PORT'
- 'HYDRA_ADMIN_URL=http://creditors-login:4445'
- 'RECAPTCHA_PUBLIC_KEY=$RECAPTCHA_PUBLIC_KEY'
- 'RECAPTCHA_PIVATE_KEY=$RECAPTCHA_PIVATE_KEY'
- 'MAIL_SERVER=mail'
- 'MAIL_PORT=25'
restart: always
creditors-webapp:
image: ghcr.io/swaptacular/swpt_creditors_ui:$SWPT_CREDITORS_UI_VERSION
env_file: configuration/creditors-webapp.env
restart: always
creditors-swagger-ui:
image: ghcr.io/swaptacular/swpt_creditors_swagger_ui:$SWPT_CREDITORS_VERSION
environment:
- 'API_ROOT=https://$PUBLIC_HOST/'
- 'BASE_URL=/creditors-swagger-ui'
- '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'
restart: always
debtors-apiproxy:
image: ghcr.io/swaptacular/swpt_apiproxy:latest
volumes:
- './docker/apiproxy/debtors.conf:/etc/apiproxy.conf'
environment:
- 'MIN_DEBTOR_ID=$MIN_DEBTOR_ID'
- 'MAX_DEBTOR_ID=$MAX_DEBTOR_ID'
- 'APIPROXY_PORT=8080'
- 'APIPROXY_CONFIG_FILE=/etc/apiproxy.conf'
restart: always
debtors-server:
image: ghcr.io/swaptacular/swpt_debtors:$SWPT_DEBTORS_VERSION
env_file: configuration/debtors-server.env
environment:
- 'WEBSERVER_PORT=8080'
- 'POSTGRES_URL=postgresql+psycopg://swpt_debtors:swpt_debtors@pg:5432/${POSTGRES_DB}'
- 'PROTOCOL_BROKER_URL=amqp://guest:guest@rabbitmq:5672'
- 'OAUTH2_INTROSPECT_URL=http://debtors-login:4445/oauth2/introspect'
- 'MIN_DEBTOR_ID=$MIN_DEBTOR_ID'
- 'MAX_DEBTOR_ID=$MAX_DEBTOR_ID'
- 'APP_DEBTOR_SUBJECT_REGEX=^debtors:([0-9]+)$$'
restart: always
debtors-login:
image: ghcr.io/swaptacular/swpt_login:$SWPT_LOGIN_VERSION
env_file: configuration/debtors-login.env
environment:
- 'SUBJECT_PREFIX=debtors:'
- 'SERVE_TLS_ALLOW_TERMINATION_FROM=0.0.0.0/0'
- 'SERVE_PUBLIC_PORT=4444'
- 'SERVE_ADMIN_PORT=4445'
- 'WEBSERVER_PORT=8080'
- 'SECRETS_COOKIE=$DEBTORS_LOGIN_COOKIE_SECRET'
- 'SECRETS_SYSTEM=$DEBTORS_LOGIN_SYSTEM_SECRET'
- 'SUPERVISOR_CLIENT_SECRET=$DEBTORS_SUPERVISOR_CLIENT_SECRET'
- 'HYDRA_DSN=postgres://hydra_debtors:hydra_debtors@pg/${POSTGRES_DB}?sslmode=disable&max_conns=2&max_idle_conns=1&max_conn_lifetime=30s'
- 'SQLALCHEMY_DATABASE_URI=postgresql://swpt_debtors_login:swpt_debtors_login@pg/${POSTGRES_DB}'
- 'REDIS_URL=redis://redis:6379/1?health_check_interval=30'
- 'URLS_SELF_ISSUER=https://$PUBLIC_HOST/debtors-hydra/'
- 'URLS_LOGIN=https://$PUBLIC_HOST/debtors-login/'
- 'URLS_CONSENT=https://$PUBLIC_HOST/debtors-consent/'
- 'API_AUTH2_TOKEN_URL=https://nginx:$PUBLIC_PORT/debtors-hydra/oauth2/token'
- 'API_RESOURCE_SERVER=https://nginx:$PUBLIC_PORT'
- 'HYDRA_ADMIN_URL=http://debtors-login:4445'
- 'RECAPTCHA_PUBLIC_KEY=$RECAPTCHA_PUBLIC_KEY'
- 'RECAPTCHA_PIVATE_KEY=$RECAPTCHA_PIVATE_KEY'
- 'MAIL_SERVER=mail'
- 'MAIL_PORT=25'
restart: always
debtors-webapp:
image: ghcr.io/swaptacular/swpt_debtors_ui:$SWPT_DEBTORS_UI_VERSION
env_file: configuration/debtors-webapp.env
restart: always
debtors-swagger-ui:
image: ghcr.io/swaptacular/swpt_debtors_swagger_ui:$SWPT_DEBTORS_VERSION
environment:
- 'API_ROOT=https://$PUBLIC_HOST/'
- 'BASE_URL=/debtors-swagger-ui'
- 'OAUTH2_AUTHORIZATION_URL=https://$PUBLIC_HOST/debtors-hydra/oauth2/auth'
- 'OAUTH2_TOKEN_URL=https://$PUBLIC_HOST/debtors-hydra/oauth2/token'
- 'OAUTH2_REFRESH_URL=https://$PUBLIC_HOST/debtors-hydra/oauth2/token'
- 'OAUTH2_REDIRECT_URL=https://$PUBLIC_HOST/debtors-swagger-ui/oauth2-redirect.html'
restart: always
# This is the HTTP gateway for all the containers.
nginx:
image: nginx:$NGINX_VERSION
volumes:
- 'gateway-cache-volume:/var/lib/nginx/data'
- './docker/nginx/templates:/etc/nginx/templates:ro'
- './docker/nginx/ssl/cert.pem:/etc/nginx/ssl/cert.pem:ro'
- './docker/nginx/ssl/key.pem:/etc/nginx/ssl/key.pem:ro'
ports:
- $PUBLIC_PORT:$PUBLIC_PORT
environment:
PORT: $PUBLIC_PORT
CREDITORS_HYDRA_URL: 'http://creditors-login:4444'
CREDITORS_LOGIN_URL: 'http://creditors-login:8080'
CREDITORS_SERVER_URL: 'http://creditors-apiproxy:8080'
CREDITORS_WEBAPP_URL: 'http://creditors-webapp:80'
CREDITORS_SWAGGER_UI_URL: 'http://creditors-swagger-ui:8080'
DEBTORS_HYDRA_URL: 'http://debtors-login:4444'
DEBTORS_LOGIN_URL: 'http://debtors-login:8080'
DEBTORS_SERVER_URL: 'http://debtors-apiproxy:8080'
DEBTORS_WEBAPP_URL: 'http://debtors-webapp:80'
DEBTORS_SWAGGER_UI_URL: 'http://debtors-swagger-ui:8080'
CERTIFICATE_FILE: '/etc/nginx/ssl/cert.pem'
CERTIFICATE_KEY_FILE: '/etc/nginx/ssl/key.pem'
CACHE_KEYS_ZONE: '10m'
CACHE_MAX_SIZE: '1g'
NGINX_ENTRYPOINT_QUIET_LOGS: '1'
restart: always
# The purpose of this container is to serve as HTTP cache for the
# `account-server` container. In complex deployments, it is possible
# to run several `account-server` instances, each instance being
# responsible for a different range of debtors, and each instance
# making HTTP requests to other `account-server` instances
# (including itself). A properly configured HTTP cache ensures that
# the system scales well. (See the `FETCH_API_URL` configuration
# variable.)
accounts-cache:
image: nginx:$NGINX_VERSION
volumes:
- 'accounts-cache-volume:/var/lib/nginx/data'
- './docker/accounts-cache/nginx.conf:/etc/nginx/nginx.conf'
- './docker/accounts-cache/templates:/etc/nginx/templates'
environment:
- 'PORT=80'
- 'ACCOUNTS_SERVER_URL=http://accounts-apiproxy:8080'
- 'CACHE_KEYS_ZONE=10m'
- 'CACHE_MAX_SIZE=1g'
- 'NGINX_ENTRYPOINT_QUIET_LOGS=1'
restart: always
# This is a dummy mail server which is useful only for testing. It
# is necessary to have mail server, because the signup/login
# procedure sends e-mails to the users.
mail:
image: epandurski/docker_postfix:$MAIL_RELAYER_VERSION
volumes:
- 'postfix-spool-volume:/var/spool/postfix'
environment:
- 'SMTP_SERVER=$SMTP_SERVER'
- 'SMTP_PORT=$SMTP_PORT'
- 'SMTP_USERNAME=$SMTP_USERNAME'
- 'SMTP_PASSWORD=$SMTP_PASSWORD'
- 'SERVER_HOSTNAME=$MAIL_SERVER_HOSTNAME'
restart: always
# This Redis instance is used by the services that perform the
# OAuth2 login and consent (`creditors-login` and `debtors-login`).
redis:
image: redis:$REDIS_VERSION
volumes:
- 'redis-data-volume:/data'
restart: always