This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdocker-compose.production.yml
226 lines (226 loc) · 7.44 KB
/
docker-compose.production.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
# example docker-compose for running images in production environment
# All mandatory environment variables are required
version: "3.7"
x-rabbitmq-environment:
- &rabbitmq-environment
RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE:?Missing mandatory value for RABBITMQ_ERLANG_COOKIE}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-ergonode}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:?Missing mandatory value for RABBITMQ_DEFAULT_PASS}
CONSUL_HOST: ${CONSUL_HOST:-consul}
# CONSUL_ACL_TOKEN: CONSUL_ACL_TOKEN
x-rabbitmq:
- &rabbitmq
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/rabbitmq:${IMAGE_TAG:-latest}
networks:
ergonode:
aliases:
- rabbitmq
deploy:
mode: global
update_config:
failure_action: rollback
order: stop-first
depends_on:
- consul
x-networks:
- &ergonode-networks
networks:
ergonode:
x-deploy:
- &ergonode-deploy
deploy:
update_config:
failure_action: rollback
order: start-first
x-php-environment:
- &php-environment
APP_ENV: ${APP_ENV:-prod}
APP_SECRET: ${APP_SECRET:?Missing mandatory value for APP_SECRET}
DATABASE_URL: ${DATABASE_URL:?Missing mandatory value for DATABASE_URL}
JWT_PRIVATE_KEY_PATH: ${JWT_PRIVATE_KEY_PATH:-config/jwt/private.pem}
JWT_PUBLIC_KEY_PATH: ${JWT_PUBLIC_KEY_PATH:-config/jwt/public.pem}
JWT_PASSPHRASE: ${JWT_PASSPHRASE:?Missing mandatory value for JWT_PASSPHRASE}
JWT_TOKEN_TTL: ${JWT_TOKEN_TTL:-3600}
CORS_ALLOW_ORIGIN: ${CORS_ALLOW_ORIGIN:?Missing mandatory value for CORS_ALLOW_ORIGIN}
APP_HOST: ${APP_HOST:?Missing mandatory value for APP_HOST}
APP_SCHEME: ${APP_SCHEME:-https}
APP_URL: ${APP_URL:?Missing mandatory value for APP_URL}
TRUSTED_HOSTS: ${TRUSTED_HOSTS:-^localhost|example\.com$}
TRUSTED_PROXIES: ${TRUSTED_PROXIES}
MESSENGER_TRANSPORT_EXPORT_DSN: ${MESSENGER_TRANSPORT_EXPORT_DSN:-amqp://ergonode:ergonode@rabbit:5672/%2f/export}
MESSENGER_TRANSPORT_IMPORT_DSN: ${MESSENGER_TRANSPORT_IMPORT_DSN:-amqp://ergonode:ergonode@rabbit:5672/%2f/import}
MESSENGER_TRANSPORT_NOTIFICATION_DSN: ${MESSENGER_TRANSPORT_NOTIFICATION_DSN:-amqp://ergonode:ergonode@rabbit:5672/%2f/notification}
# each enty for CRONTAB must be delimited by ; example:
# * * * * * /srv/app/bin/console channel:export:schedule >> /srv/app/var/log/crond.log ; * * * * * /srv/app/bin/console some:other:cmd >> /srv/app/var/log/crond.log
CRONTAB: ${CRONTAB:-* * * * * /srv/app/bin/console channel:export:schedule >> /srv/app/var/log/crond.log}
x-php-volumes:
- &php-volumes
volumes:
- "multimedia:/srv/app/public/multimedia"
- "avatar:/srv/app/public/avatar"
- "import:/srv/app/import"
- "export:/srv/app/export"
- "jwt:/srv/app/config/jwt"
x-php-messenger:
- &php-messenger
working_dir: /srv/app
image: ${CONTAINER_REGISTRY_BASE:-ergonode}/php:${IMAGE_TAG:-latest}
<<: *php-volumes
environment:
<<: *php-environment
depends_on:
- postgres
- haproxy
command: bin/console messenger:consume --memory-limit=256M --time-limit=3600 -vv import export segment
restart: always
healthcheck:
disable: true
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
<<: *ergonode-networks
services:
php:
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/php:${IMAGE_TAG:-latest}
environment:
<<: *php-environment
<<: *php-volumes
<<: *ergonode-networks
<<: *ergonode-deploy
crond:
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/php:${IMAGE_TAG:-latest}
environment:
<<: *php-environment
<<: *php-volumes
<<: *ergonode-networks
command: ["crond"]
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-import:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv import
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-export:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv export
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-segment:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv segment
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-completeness:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv completeness
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-notification:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv notification
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
php-messenger-batch_action:
<<: *php-messenger
command: bin/console messenger:consume --memory-limit=128M --time-limit=3600 -vv batch_action
deploy:
replicas: 1
update_config:
failure_action: rollback
order: start-first
nuxtjs:
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/nuxtjs:${IMAGE_TAG:-latest}
environment:
NODE_ENV: ${NODE_ENV:-production}
API_BASE_URL: ${API_BASE_URL:?Missing mandatory value for API_BASE_URL}
<<: *ergonode-networks
<<: *ergonode-deploy
nginx:
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/nginx:${IMAGE_TAG:-latest}
environment:
APP_ENV: ${APP_ENV:-prod}
PHP_HOST: ${PHP_HOST:-php}
NUXTJS_HOST: ${PHP_HOST:-nuxtjs}
DOLLAR: "$$"
volumes:
- "multimedia:/srv/app/public/multimedia"
- "avatar:/srv/app/public/avatar"
ports:
- "${EXPOSED_NGINX_PORT:-80}:80"
<<: *ergonode-networks
<<: *ergonode-deploy
depends_on:
- php
- nuxtjs
consul:
image: consul:1.7
networks:
ergonode:
healthcheck:
test: ["CMD", "sh", "-c", "curl --fail http://localhost:8500 || exit 1"]
haproxy:
image: ${CONTAINER_REGISTRY_BASE:?Missing mandatory value for CONTAINER_REGISTRY_BASE}/haproxy:${IMAGE_TAG:-latest}
deploy:
mode: global
ports:
- "${EXPOSED_RABBITMQ_PORT:-15672}:15672"
networks:
ergonode:
aliases:
- rabbit
rabbitmq-01:
<<: *rabbitmq
hostname: rabbitmq-01
volumes:
- rabbitmq-01:/var/lib/rabbitmq
environment:
<<: *rabbitmq-environment
rabbitmq-02:
<<: *rabbitmq
hostname: rabbitmq-02
volumes:
- rabbitmq-02:/var/lib/rabbitmq
environment:
<<: *rabbitmq-environment
WAIT_FOR: rabbitmq-01
rabbitmq-03:
<<: *rabbitmq
hostname: rabbitmq-03
volumes:
- rabbitmq-03:/var/lib/rabbitmq
environment:
<<: *rabbitmq-environment
WAIT_FOR: rabbitmq-02
volumes:
multimedia:
avatar:
import:
export:
jwt:
rabbitmq-01:
rabbitmq-02:
rabbitmq-03:
networks:
ergonode:
attachable: true