-
Notifications
You must be signed in to change notification settings - Fork 73
/
docker-compose.yml
275 lines (260 loc) · 10 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
services:
traefik:
image: traefik:2.11
command:
--providers.docker=true
--providers.docker.exposedByDefault=false
--entryPoints.http.address=:80
ports:
- "80:80"
networks:
- traefik-public
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
frontend:
build:
context: frontend/docker/development/nginx
networks:
- traefik-public
- default
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.frontend.rule=Host(`localhost`) || Host(`www.localhost`)
- traefik.http.routers.frontend.entryPoints=http
- traefik.http.services.frontend.loadBalancer.server.port=80
- traefik.http.middlewares.frontend-redirect.redirectRegex.regex=^(https?://)www.localhost/(.*)$$
- traefik.http.middlewares.frontend-redirect.redirectRegex.replacement=$${1}localhost/$${2}
- traefik.http.middlewares.frontend-redirect.redirectRegex.permanent=true
- traefik.http.routers.frontend.middlewares=frontend-redirect
frontend-node:
build:
context: frontend/docker/development/node
environment:
WDS_SOCKET_PORT: 0
REACT_APP_AUTH_URL: http://api.localhost
volumes:
- ./frontend:/app
command: sh -c "until [ -f .ready ] ; do sleep 1 ; done && yarn start"
tty: true
frontend-node-cli:
build:
context: frontend/docker/development/node
volumes:
- ./frontend:/app
api:
build:
context: api/docker
dockerfile: development/nginx/Dockerfile
volumes:
- ./api:/app
networks:
- traefik-public
- default
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.api.rule=Host(`api.localhost`)
- traefik.http.routers.api.entryPoints=http
- traefik.http.services.api.loadBalancer.server.port=80
api-php-fpm:
build:
context: api/docker
dockerfile: development/php-fpm/Dockerfile
environment:
APP_ENV: dev
APP_DEBUG: 1
PHP_IDE_CONFIG: serverName=API
DB_HOST: api-postgres
DB_USER: app
DB_PASSWORD_FILE: /run/secrets/api_db_password
DB_NAME: app
MAILER_HOST: mailer
MAILER_PORT: 1025
MAILER_USERNAME: app
MAILER_PASSWORD_FILE: /run/secrets/api_mailer_password
MAILER_FROM_EMAIL: [email protected]
FRONTEND_URL: http://localhost
SENTRY_DSN_FILE: /run/secrets/sentry_dsn
JWT_ENCRYPTION_KEY_FILE: /run/secrets/jwt_encryption_key
JWT_PUBLIC_KEY_PATH: /run/secrets/jwt_public_key
JWT_PRIVATE_KEY_PATH: /run/secrets/jwt_private_key
OAUTH_CALLBACK_URL: http://api.localhost
OAUTH_YANDEX_AUTH_URL: http://wiremock.localhost/oauth.yandex.ru
OAUTH_YANDEX_TOKEN_URL: http://wiremock/oauth.yandex.ru
OAUTH_YANDEX_API_URL: http://wiremock/login.yandex.ru
OAUTH_YANDEX_CLIENT_ID: app
OAUTH_YANDEX_CLIENT_SECRET_FILE: /run/secrets/oauth_yandex_client_secret
OAUTH_MAILRU_AUTH_URL: http://wiremock.localhost/oauth.mail.ru
OAUTH_MAILRU_TOKEN_URL: http://wiremock/oauth.mail.ru
OAUTH_MAILRU_API_URL: http://wiremock/oauth.mail.ru
OAUTH_MAILRU_CLIENT_ID: app
OAUTH_MAILRU_CLIENT_SECRET_FILE: /run/secrets/oauth_mailru_client_secret
volumes:
- ./api:/app
secrets:
- api_db_password
- api_mailer_password
- sentry_dsn
- jwt_encryption_key
- jwt_public_key
- jwt_private_key
- oauth_yandex_client_secret
- oauth_mailru_client_secret
api-php-cli:
build:
context: api/docker
dockerfile: development/php-cli/Dockerfile
environment:
APP_ENV: dev
APP_DEBUG: 1
DB_HOST: api-postgres
DB_USER: app
DB_PASSWORD_FILE: /run/secrets/api_db_password
DB_NAME: app
MAILER_HOST: mailer
MAILER_PORT: 1025
MAILER_USERNAME: app
MAILER_PASSWORD_FILE: /run/secrets/api_mailer_password
MAILER_FROM_EMAIL: [email protected]
FRONTEND_URL: http://localhost
SENTRY_DSN_FILE: /run/secrets/sentry_dsn
JWT_ENCRYPTION_KEY_FILE: /run/secrets/jwt_encryption_key
JWT_PUBLIC_KEY_PATH: /run/secrets/jwt_public_key
JWT_PRIVATE_KEY_PATH: /run/secrets/jwt_private_key
OAUTH_CALLBACK_URL: http://api.localhost
OAUTH_YANDEX_AUTH_URL: http://wiremock.localhost/oauth.yandex.ru
OAUTH_YANDEX_TOKEN_URL: http://wiremock/oauth.yandex.ru
OAUTH_YANDEX_API_URL: http://wiremock/login.yandex.ru
OAUTH_YANDEX_CLIENT_ID: app
OAUTH_YANDEX_CLIENT_SECRET_FILE: /run/secrets/oauth_yandex_client_secret
OAUTH_MAILRU_AUTH_URL: http://wiremock.localhost/oauth.mail.ru
OAUTH_MAILRU_TOKEN_URL: http://wiremock/oauth.mail.ru
OAUTH_MAILRU_API_URL: http://wiremock/oauth.mail.ru
OAUTH_MAILRU_CLIENT_ID: app
OAUTH_MAILRU_CLIENT_SECRET_FILE: /run/secrets/oauth_mailru_client_secret
volumes:
- ./api:/app
secrets:
- api_db_password
- api_mailer_password
- sentry_dsn
- jwt_encryption_key
- jwt_public_key
- jwt_private_key
- oauth_yandex_client_secret
- oauth_mailru_client_secret
api-postgres:
image: postgres:13.3-alpine
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD_FILE: /run/secrets/api_db_password
POSTGRES_DB: app
secrets:
- api_db_password
volumes:
- api-postgres:/var/lib/postgresql/data
ports:
- "54321:5432"
api-postgres-backup:
build:
context: ./api/docker/common
dockerfile: postgres-backup/Dockerfile
environment:
BACKUP_NAME: auction_api-postgres
POSTGRES_HOST: api-postgres
POSTGRES_DB: app
POSTGRES_USERNAME: app
POSTGRES_PASSWORD_FILE: /run/secrets/api_db_password
AWS_ACCESS_KEY_ID: storage_app
AWS_SECRET_ACCESS_KEY_FILE: /run/secrets/backup_aws_secret_access_key
AWS_DEFAULT_REGION: region
S3_ENDPOINT: http://backup-storage:9000
S3_BUCKET: backup
secrets:
- api_db_password
- backup_aws_secret_access_key
command: sh -c 'wait-for-it api-postgres:5432 -t 20 && backup'
mailer:
image: mailhog/mailhog
networks:
- traefik-public
- default
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.mailer.rule=Host(`mailer.localhost`)
- traefik.http.routers.mailer.entryPoints=http
- traefik.http.services.mailer.loadBalancer.server.port=8025
wiremock:
image: wiremock/wiremock:3x-alpine
networks:
- traefik-public
- default
volumes:
- ./wiremock:/home/wiremock
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost/__admin/health || exit 1
command:
- '--port=80'
- '--global-response-templating'
- '--verbose'
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.wiremock.rule=Host(`wiremock.localhost`)
- traefik.http.services.wiremock.loadBalancer.server.port=80
- traefik.http.routers.wiremock.entryPoints=http
backup-storage:
image: minio/minio
environment:
MINIO_ROOT_USER: storage_app
MINIO_ROOT_PASSWORD_FILE: /run/secrets/backup_aws_secret_access_key
secrets:
- backup_aws_secret_access_key
volumes:
- backup-storage:/data
entrypoint: sh -c 'mkdir -p /data/backup && docker-entrypoint.sh minio server /data --console-address ":80"'
networks:
- traefik-public
- default
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.backup-storage.rule=Host(`backup-storage.localhost`)
- traefik.http.routers.backup-storage.entryPoints=http
- traefik.http.services.backup-storage.loadBalancer.server.port=80
cucumber-node-cli:
build:
context: cucumber/docker/development/node
volumes:
- ./cucumber:/app
network_mode: service:traefik
secrets:
api_db_password:
file: ./docker/development/secrets/api_db_password
api_mailer_password:
file: ./docker/development/secrets/api_mailer_password
sentry_dsn:
file: ./docker/development/secrets/sentry_dsn
jwt_encryption_key:
file: ./docker/development/secrets/jwt_encryption_key
jwt_public_key:
file: ./docker/development/secrets/jwt_public_key
jwt_private_key:
file: ./docker/development/secrets/jwt_private_key
oauth_yandex_client_secret:
file: ./docker/development/secrets/oauth_yandex_client_secret
oauth_mailru_client_secret:
file: ./docker/development/secrets/oauth_mailru_client_secret
backup_aws_secret_access_key:
file: ./docker/development/secrets/backup_aws_secret_access_key
volumes:
api-postgres:
backup-storage:
networks:
traefik-public:
name: traefik-public