forked from hmake98/nestjs-microservices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
302 lines (301 loc) · 6.55 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
version: "3"
services:
user:
build:
context: ./user
dockerfile: Dockerfile
restart: unless-stopped
hostname: user
ports:
- 9001:9001
env_file:
- ./user/.env
environment:
WAIT_HOSTS: postgres:5432, rabbitmq:5672
networks:
- backend
volumes:
- ./user:/var/www/user
- /var/www/user/node_modules
depends_on:
- fluent-bit
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: user-service
token:
build:
context: ./token
dockerfile: Dockerfile
restart: unless-stopped
hostname: token
environment:
WAIT_HOSTS: rabbitmq:5672
env_file:
- ./token/.env
networks:
- backend
depends_on:
- fluent-bit
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: token-service
post:
build:
context: ./post
dockerfile: Dockerfile
hostname: post
ports:
- 9002:9002
environment:
WAIT_HOSTS: postgres:5432, rabbitmq:5672
env_file:
- ./post/.env
networks:
- backend
volumes:
- ./post:/var/www/post
- /var/www/post/node_modules
depends_on:
- fluent-bit
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: post-service
notification:
build:
context: ./notification
dockerfile: Dockerfile
hostname: notification
ports:
- 9004:9004
environment:
WAIT_HOSTS: mongodb:27017, rabbitmq:5672
env_file:
- ./notification/.env
networks:
- backend
volumes:
- ./notification:/var/www/notification
- /var/www/notification/node_modules
depends_on:
- fluent-bit
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: notification-service
files:
build:
context: ./files
dockerfile: Dockerfile
hostname: files
ports:
- 9003:9003
environment:
WAIT_HOSTS: mongodb:27017, rabbitmq:5672
env_file:
- ./files/.env
networks:
- backend
volumes:
- ./files:/var/www/files
- /var/www/files/node_modules
depends_on:
- fluent-bit
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: files-service
mailer:
build:
context: ./mailer
dockerfile: Dockerfile
restart: unless-stopped
hostname: mailer
environment:
WAIT_HOSTS: rabbitmq:5672
env_file:
- ./mailer/.env
networks:
- backend
depends_on:
- fluent-bit
volumes:
- ./mailer:/var/www/mailer
- /var/www/mailer/node_modules
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: mailer-service
kong:
build:
context: ./kong
dockerfile: Dockerfile
container_name: kong
restart: on-failure
networks:
- backend
command: "kong start"
depends_on:
- fluent-bit
volumes:
- ./kong/kong.yml:/usr/local/kong/declarative/kong.yml
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /usr/local/kong/declarative/kong.yml
KONG_PROXY_LISTEN: 0.0.0.0:8080
KONG_PROXY_LISTEN_SSL: 0.0.0.0:8443
KONG_ADMIN_LISTEN: 0.0.0.0:9000
ports:
- "8080:8080"
- "9000:9000"
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: kong
database:
image: postgres:latest
restart: on-failure
container_name: postgres
hostname: database
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=master123
- POSTGRES_DB=postgres
volumes:
- pg_data:/var/lib/postgresql/data
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: database
rabbitmq:
image: "rabbitmq:3-management"
restart: on-failure
container_name: rabbitmq
hostname: rabbitmq
volumes:
- rabbit_data:/var/lib/rabbitmq
ports:
- "5672:5672"
- "15671:15672"
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: rabbitmq
cache:
hostname: redis
image: redis:latest
restart: on-failure
container_name: redis
ports:
- "6379:6379"
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: cache
mongodb:
image: mongo:latest
container_name: mongodb
restart: on-failure
hostname: mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: master123
ports:
- 27017:27017
volumes:
- mongo_data:/data/db
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: mongodb
fluent-bit:
hostname: fluentd
build:
context: ./fluent-bit
dockerfile: Dockerfile
container_name: fluent-bit
environment:
- LOKI_URL=http://loki:3100/loki/api/v1/push
ports:
- "24224:24224"
- "24224:24224/udp"
networks:
- backend
loki:
image: grafana/loki:latest
restart: on-failure
container_name: loki
expose:
- "3100"
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: loki
grafana:
image: grafana/grafana:latest
restart: on-failure
container_name: grafana
ports:
- "3000:3000"
environment:
GF_RENDERING_SERVER_URL: http://renderer:8081/render
GF_RENDERING_CALLBACK_URL: http://grafana:3000/
GF_LOG_FILTERS: rendering:debug
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: grafana
renderer:
image: grafana/grafana-image-renderer:latest
restart: on-failure
container_name: grafana-image-renderer
expose:
- "8081"
environment:
ENABLE_METRICS: "true"
networks:
- backend
logging:
driver: fluentd
options:
fluentd-address: host.docker.internal:24224
tag: renderer
networks:
backend:
driver: bridge
volumes:
pg_data:
driver: local
rabbit_data:
driver: local
mongo_data:
driver: local