-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
311 lines (297 loc) · 7.38 KB
/
compose.yaml
File metadata and controls
311 lines (297 loc) · 7.38 KB
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
303
304
305
306
307
308
309
310
311
name: nestjs-microservices
networks:
backend:
driver: bridge
services:
rabbitmq:
image: rabbitmq:4.3.0-management-alpine
container_name: rabbitmq_4_3
restart: unless-stopped
sysctls:
net.core.somaxconn: 4096
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
RABBITMQ_CHANNEL_MAX: "2048"
RABBITMQ_CONNECTION_MAX: "500"
RABBITMQ_HANDSHAKE_TIMEOUT: "20000"
ports:
- "5672:5672"
- "15672:15672"
volumes:
- rabbitmq-data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- backend
deploy:
resources:
limits:
cpus: '1.0'
memory: 1024M
reservations:
cpus: '0.25'
memory: 512M
redis:
image: redis:7.4-alpine
container_name: redis_7_4
restart: unless-stopped
expose:
- 6379
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 3s
retries: 5
command: >
redis-server
--appendonly yes
--appendfsync everysec
--maxmemory 384mb
--maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 256M
postgres:
image: postgres:18.4-alpine
container_name: postgres_18_4
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: orders_pass
POSTGRES_DB: orders_db
PGDATA: /var/lib/postgresql/18/docker
command: ["postgres", "-c", "wal_level=logical", "-c", "max_wal_senders=4", "-c", "max_replication_slots=4", "-c", "max_connections=150"]
expose:
- 5432
volumes:
- pgdata:/var/lib/postgresql
- ./init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dlq_db" ]
interval: 5s
timeout: 3s
retries: 5
start_period: 15s
networks:
- backend
deploy:
resources:
limits:
cpus: '1.5'
memory: 2048M
reservations:
cpus: '0.5'
memory: 512M
pgbouncer:
image: edoburu/pgbouncer:v1.24.0-p1
container_name: pgbouncer_edoburu_1_24
restart: unless-stopped
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: orders_pass
LISTEN_PORT: 6432
# Включаем безопасную проверку через SQL-запрос
AUTH_TYPE: scram-sha-256
AUTH_QUERY: "SELECT * FROM public.get_auth_text($1)"
PGBOUNCER_POOL_MODE: transaction
# PGBOUNCER_POOL_MODE: session
PGBOUNCER_MAX_CLIENT_CONN: 500
PGBOUNCER_DEFAULT_POOL_SIZE: 30
PGBOUNCER_EXTRA_FLAGS: --max_prepared_statements=100 --log_connections=0
PGBOUNCER_DATABASES_INI_SECTION: |
orders_db = host=postgres port=5432 dbname=orders_db
dlq_db = host=postgres port=5432 dbname=dlq_db
# orders_db = host=postgres port=5432 dbname=orders_db auth_user=orders_user connect_query='SET statement_timeout = 30000'
# dlq_db = host=postgres port=5432 dbname=dlq_db auth_user=orders_user connect_query='SET statement_timeout = 30000'
# notifications_db = host=postgres port=5432 dbname=notifications_db auth_user=orders_user pool_mode=session connect_query='SET statement_timeout = 30000'
expose:
- 6432
depends_on:
postgres:
condition: service_started
healthcheck:
test: ["CMD", "pg_isready", "-h", "localhost", "-p", "6432"]
interval: 3s
timeout: 2s
retries: 3
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
debezium-server:
image: debezium/server:3.0.0.Final
container_name: debezium_cdc
restart: unless-stopped
environment:
- QUARKUS_CONFIG_LOCATIONS=file:/debezium/conf/application.properties
volumes:
- ./debezium-conf:/debezium/conf
- debezium-data:/debezium/data
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
producer-service:
build:
context: .
dockerfile: Dockerfile
args:
APP_NAME: producer-service
restart: unless-stopped
environment:
RABBITMQ_URI: amqp://rabbitmq:5672
DB_HOST: pgbouncer
DB_PORT: 6432
DB_NAME: orders_db
DB_USER: orders_user
DB_PASSWORD: orders_pass
ports:
- "3000:3000"
depends_on:
rabbitmq:
condition: service_healthy
pgbouncer:
condition: service_healthy
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 256M
consumer-service:
build:
context: .
dockerfile: Dockerfile
args:
APP_NAME: consumer-service
restart: unless-stopped
environment:
RABBITMQ_URI: amqp://rabbitmq:5672
DB_HOST: pgbouncer
DB_PORT: 6432
DB_NAME: orders_db
DB_USER: orders_user
DB_PASSWORD: orders_pass
depends_on:
rabbitmq:
condition: service_healthy
pgbouncer:
condition: service_healthy
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 256M
notification-service:
build:
context: .
dockerfile: Dockerfile
args:
APP_NAME: notification-service
restart: unless-stopped
environment:
RABBITMQ_URI: amqp://rabbitmq:5672
REDIS_URL: redis://redis:6379
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: notifications_db
DB_USER: orders_user
DB_PASSWORD: orders_pass
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 256M
dlq-logger-service:
build:
context: .
dockerfile: Dockerfile
args:
APP_NAME: dlq-logger-service
restart: unless-stopped
environment:
RABBITMQ_URI: amqp://rabbitmq:5672
DB_HOST: pgbouncer
DB_PORT: 6432
DB_NAME: dlq_db
DB_USER: orders_user
DB_PASSWORD: orders_pass
depends_on:
rabbitmq:
condition: service_healthy
pgbouncer:
condition: service_healthy
networks:
- backend
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 256M
volumes:
rabbitmq-data:
driver: local
pgdata:
driver: local
redis_data:
driver: local
debezium-data:
driver: local