-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
308 lines (295 loc) · 7.76 KB
/
docker-compose.yml
File metadata and controls
308 lines (295 loc) · 7.76 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
version: '3.8'
services:
postgres:
image: postgres:15
container_name: product-postgres
environment:
POSTGRES_DB: product_service
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: basket-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
mariadb:
image: mariadb:10.11
container_name: payment-mariadb
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: payment_service
MYSQL_USER: payment
MYSQL_PASSWORD: password
ports:
- "3306:3306"
volumes:
- mariadb_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
elasticsearch:
image: elasticsearch:8.11.0
container_name: elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- "9200:9200"
- "9300:9300"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
product-service:
build:
context: .
dockerfile: dockerfiles/product.dockerfile
container_name: product-service
ports:
- "8080:8080"
- "50050:50050"
environment:
- ENVIRONMENT=development
- PORT=8080
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=password
- DB_NAME=product_service
- DB_SSL_MODE=disable
- LOG_LEVEL=debug
- LOG_FORMAT=text
- LOG_OUTPUT=console
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
basket-service:
build:
context: .
dockerfile: dockerfiles/basket.dockerfile
container_name: basket-service
ports:
- "8081:8081"
- "50051:50051"
environment:
- ENVIRONMENT=development
- PORT=8081
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_DB=0
- PRODUCT_SERVICE_URL=product-service:50050
- LOG_LEVEL=debug
- LOG_FORMAT=text
- LOG_OUTPUT=console
depends_on:
redis:
condition: service_healthy
product-service:
condition: service_started
restart: unless-stopped
payment-service:
build:
context: .
dockerfile: dockerfiles/payment.dockerfile
container_name: payment-service
ports:
- "8082:8082"
- "50052:50052"
environment:
- ENVIRONMENT=development
- PORT=8082
- DB_HOST=mariadb
- DB_PORT=3306
- DB_USER=payment
- DB_PASSWORD=password
- DB_NAME=payment_service
- DB_SSL_MODE=false
- BASKET_SERVICE_URL=basket-service:50051
- PRODUCT_SERVICE_URL=product-service:50050
- LOG_LEVEL=debug
- LOG_FORMAT=text
- LOG_OUTPUT=console
depends_on:
mariadb:
condition: service_healthy
basket-service:
condition: service_started
product-service:
condition: service_started
restart: unless-stopped
notification-service:
build:
context: .
dockerfile: dockerfiles/notification.dockerfile
container_name: notification-service
ports:
- "8084:8084"
environment:
- ENVIRONMENT=development
- PORT=8084
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=password
- DB_NAME=notification_service
- DB_SSL_MODE=disable
- KAFKA_BROKERS=kafka:9092
- LOG_LEVEL=debug
- LOG_FORMAT=text
- LOG_OUTPUT=console
depends_on:
postgres:
condition: service_healthy
kafka:
condition: service_healthy
restart: unless-stopped
search-service:
build:
context: .
dockerfile: dockerfiles/search.dockerfile
container_name: search-service
ports:
- "8085:8085"
environment:
- ENVIRONMENT=development
- PORT=8085
- ELASTICSEARCH_ADDRESSES=http://elasticsearch:9200
- ELASTICSEARCH_INDEX_NAME=products
- KAFKA_BROKERS=kafka:9092
- KAFKA_GROUP_ID=search-service-group
- LOG_LEVEL=debug
- LOG_FORMAT=text
- LOG_OUTPUT=console
depends_on:
elasticsearch:
condition: service_healthy
kafka:
condition: service_healthy
restart: unless-stopped
gateway:
build:
context: ./fiberv2-gateway
dockerfile: ../dockerfiles/gateway.dockerfile
container_name: fiberv2-gateway
ports:
- "8083:8080"
environment:
- ENVIRONMENT=development
- PORT=8080
- LOG_LEVEL=debug
- LOG_FORMAT=text
- PRODUCT_SERVICE_ENABLED=true
- PRODUCT_SERVICE_URLS=http://product-service:8080
- BASKET_SERVICE_ENABLED=true
- BASKET_SERVICE_URLS=http://basket-service:8081
- PAYMENT_SERVICE_ENABLED=true
- PAYMENT_SERVICE_URLS=http://payment-service:8082
- SEARCH_SERVICE_ENABLED=true
- SEARCH_SERVICE_URLS=http://search-service:8085
- CIRCUIT_BREAKER_ENABLED=true
- LOAD_BALANCER_ENABLED=true
- LOAD_BALANCER_STRATEGY=round_robin
- RATE_LIMIT_ENABLED=true
- RATE_LIMIT_REQUESTS=100
- RATE_LIMIT_WINDOW=1m
- RATE_LIMIT_BURST=10
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_DB=1
- REDIS_POOL_SIZE=10
- REDIS_MIN_IDLE_CONNS=5
- REDIS_MAX_RETRIES=3
- REDIS_DIAL_TIMEOUT=5s
- REDIS_READ_TIMEOUT=3s
- REDIS_WRITE_TIMEOUT=3s
- HEALTH_CHECK_ENABLED=true
- METRICS_ENABLED=true
depends_on:
redis:
condition: service_healthy
product-service:
condition: service_started
basket-service:
condition: service_started
payment-service:
condition: service_started
restart: unless-stopped
# Kafka
zookeeper:
image: confluentinc/cp-zookeeper:7.4.0
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
volumes:
- kafka_data:/var/lib/zookeeper/data
ports:
- "2181:2181"
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "2181"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
kafka:
image: confluentinc/cp-kafka:7.4.0
container_name: kafka
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_JMX_PORT: 9101
KAFKA_JMX_HOSTNAME: localhost
volumes:
- kafka_data:/var/lib/kafka/data
healthcheck:
test: ["CMD", "kafka-broker-api-versions", "--bootstrap-server", "localhost:9092"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
volumes:
postgres_data:
redis_data:
mariadb_data:
kafka_data:
elasticsearch_data: