-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
210 lines (199 loc) · 5.84 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
version: "3.7"
services:
web:
image: brainsum/qashot-microsite-backend-web:0.11.0
container_name: "${PROJECT_NAME}_web"
environment:
- "JWT_SECRET_KEY=${JWT_SECRET_KEY}"
- "EXPOSED_PORT=${WEB_EXPOSED_PORT}"
- "WORKER_URL=${WORKER_URL}"
- "ADMIN_USER=${WEB_ADMIN_USER}"
- "ADMIN_PASS=${WEB_ADMIN_PASS}"
- "DB_USER=${WEB_DB_USER}"
- "DB_PASSWORD=${WEB_DB_PASSWORD}"
- "PROJECT_ENVIRONMENT=production"
- "RATE_LIMITER_PASSWORD=${RATE_LIMITER_PASSWORD}"
- "ORIGIN_ID=${MICROSITE_ORIGIN_ID}"
- "TESTS_PER_EMAIL_LIMIT=${WEB_TESTS_PER_EMAIL_LIMIT}"
- "EMAIL_LIMIT_EXCLUDED_DOMAINS=${WEB_EMAIL_LIMIT_EXCLUDED_DOMAINS}"
restart: unless-stopped
depends_on:
- web_db
- redis_rate_limiter
networks:
- frontend
- backend
- web_database
- web_rate_limiter
labels:
- "traefik.enable=true"
- "traefik.backend=web"
- "traefik.frontend.rule=Host:${PROJECT_BASE_URL}"
- "traefik.port=${WEB_EXPOSED_PORT}"
- "traefik.docker.network=${PROJECT_NAME}_frontend"
web_db:
image: bitnami/postgresql:10.5.0
container_name: "${PROJECT_NAME}_web_db"
stop_grace_period: 10s
restart: unless-stopped
environment:
- "POSTGRESQL_USERNAME=${WEB_DB_USER}"
- "POSTGRESQL_PASSWORD=${WEB_DB_PASSWORD}"
- "POSTGRESQL_DATABASE=web_db"
volumes:
- web_db_data:/bitnami
networks:
- web_database
labels:
- "traefik.enable=false"
mailer:
image: brainsum/qashot-microsite-backend-mailer:0.8.0
container_name: "${PROJECT_NAME}_mailer"
environment:
- "WORKER_URL=${WORKER_URL}"
- "JWT_SECRET_KEY=${JWT_SECRET_KEY}"
- "EXPOSED_PORT=${MAILER_EXPOSED_PORT}"
- "DB_USER=${MAILER_DB_USER}"
- "DB_PASSWORD=${MAILER_DB_PASSWORD}"
- "MAILER_TRANSPORTER=${MAILER_TRANSPORTER}"
- "MAILER_HOST=${MAILER_HOST}"
- "MAILER_PORT=${MAILER_PORT}"
- "MAILER_USER=${MAILER_USER}"
- "MAILER_PASS=${MAILER_PASS}"
- "MAILER_MAILGUN_API_KEY=${MAILER_MAILGUN_API_KEY}"
- "MAILER_MAILGUN_DOMAIN=${MAILER_MAILGUN_DOMAIN}"
- "PROJECT_ENVIRONMENT=production"
- "ORIGIN_ID=${MICROSITE_ORIGIN_ID}"
restart: unless-stopped
depends_on:
- web
- mailer_db
networks:
- backend
- mailer_database
- smtp_server
labels:
- "traefik.enable=false"
- "traefik.backend=mailer"
- "traefik.frontend.rule=Host:mailer.${PROJECT_BASE_URL}"
- "traefik.port=${MAILER_EXPOSED_PORT}"
- "traefik.docker.network=${PROJECT_NAME}_backend"
mailer_db:
image: bitnami/postgresql:10.5.0
container_name: "${PROJECT_NAME}_mailer_db"
stop_grace_period: 10s
restart: unless-stopped
environment:
- "POSTGRESQL_USERNAME=${MAILER_DB_USER}"
- "POSTGRESQL_PASSWORD=${MAILER_DB_PASSWORD}"
- "POSTGRESQL_DATABASE=mailer_db"
volumes:
- mailer_db_data:/bitnami
networks:
- mailer_database
labels:
- "traefik.enable=false"
queue:
image: brainsum/qashot-microsite-backend-queue:0.6.0
container_name: "${PROJECT_NAME}_queue"
environment:
- "WORKER_URL=${WORKER_URL}"
- "JWT_SECRET_KEY=${JWT_SECRET_KEY}"
- "EXPOSED_PORT=${QUEUE_EXPOSED_PORT}"
- "DB_USER=${QUEUE_DB_USER}"
- "DB_PASSWORD=${QUEUE_DB_PASSWORD}"
- "PROJECT_ENVIRONMENT=production"
- "ORIGIN_ID=${MICROSITE_ORIGIN_ID}"
restart: unless-stopped
depends_on:
- web
- queue_db
networks:
- backend
- queue_database
labels:
- "traefik.enable=false"
- "traefik.backend=queue"
- "traefik.frontend.rule=Host:queue.${PROJECT_BASE_URL}"
- "traefik.port=${QUEUE_EXPOSED_PORT}"
- "traefik.docker.network=${PROJECT_NAME}_backend"
queue_db:
# image: postgres:11.5-alpine
# image: bitnami/postgresql:10.10.0
image: bitnami/postgresql:10.5.0
container_name: "${PROJECT_NAME}_queue_db"
stop_grace_period: 10s
restart: unless-stopped
environment:
- "POSTGRESQL_USERNAME=${QUEUE_DB_USER}"
- "POSTGRESQL_PASSWORD=${QUEUE_DB_PASSWORD}"
- "POSTGRESQL_DATABASE=queue_db"
volumes:
- queue_db_data:/bitnami
networks:
- queue_database
labels:
- "traefik.enable=false"
# Note: Probably not needed, but:
# https://github.com/bitnami/bitnami-docker-redis#setting-up-a-replication
redis_rate_limiter:
# image: redis:5.0.6-alpine3.10
# image: bitnami/redis:5.0.5
image: bitnami/redis:4.0.14
container_name: "${PROJECT_NAME}_redis_rate_limiter"
restart: unless-stopped
environment:
- "REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL"
- "REDIS_PASSWORD=${RATE_LIMITER_PASSWORD}"
networks:
- web_rate_limiter
volumes:
- redis_rate_limiter_data:/bitnami/redis
labels:
- "traefik.enable=false"
mail_server:
image: boky/postfix:v1.1.3
restart: unless-stopped
container_name: "${PROJECT_NAME}_mail_server"
# @todo: v1 allows DKIM, set it up. @see: https://github.com/bokysan/docker-postfix#dkim
# @todo: TZ environment variable to set the timezone of the container
environment:
- "HOSTNAME=${MAIL_SERVER_HOSTNAME}"
- "ALLOWED_SENDER_DOMAINS=${MAIL_SERVER_ALLOWED_SENDER_DOMAINS}"
networks:
- smtp_server
labels:
- "traefik.enable=false"
# Other.
traefik:
image: traefik:v1.7.18-alpine
container_name: "${PROJECT_NAME}_traefik"
restart: unless-stopped
ports:
- "${TRAEFIK_HOST_PORT}:80"
networks:
- frontend
- backend
- mailer_database
- web_database
- queue_database
- web_rate_limiter
- smtp_server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/traefik.toml:/etc/traefik/traefik.toml
labels:
- "traefik.enable=false"
networks:
frontend: {}
backend: {}
mailer_database: {}
web_database: {}
queue_database: {}
web_rate_limiter: {}
smtp_server: {}
volumes:
mailer_db_data: {}
web_db_data: {}
queue_db_data: {}
redis_rate_limiter_data: {}