-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
167 lines (154 loc) · 4 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
version: '3.5'
services:
payment_gateway:
build:
context: .
dockerfile: ./payment_gateway/Dockerfile
container_name: payment_gateway
restart: always
image: payment_gateway
depends_on:
- kafka
transaction:
build:
context: .
dockerfile: ./transaction/Dockerfile
container_name: transaction
image: transaction
environment:
PG_URL: 'postgres://postgres:root@transaction_postgres:5432/postgres?sslmode=disable'
ports:
- 8083:8080
depends_on:
transaction_postgres:
condition: service_healthy
transaction_redis:
condition: service_healthy
kafka:
condition: service_started
transaction_postgres:
container_name: transaction_pg_db
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=root
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
volumes:
- transaction-pg-data:/var/lib/postgresql/data
image: postgres:15-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 1s
timeout: 1s
retries: 10
monitor:
build:
context: .
dockerfile: ./monitor/Dockerfile
container_name: monitor
image: monitor
ports:
- 8080:8080
depends_on:
kafka:
condition: service_started
user:
build:
context: .
dockerfile: ./user/Dockerfile
container_name: user
image: user
ports:
- 8081:8080
depends_on:
user_postgres:
condition: service_healthy
user_postgres:
container_name: user_pg_db
ports:
- 5433:5432
environment:
- POSTGRES_PASSWORD=user_root
- POSTGRES_USER=user_service
- POSTGRES_DB=user_db
volumes:
#- user-pg-data:/var/lib/postgresql/data
- ./docker-entrypoint-initdb.d/init.sql:/docker-entrypoint-initdb.d/init.sql
image: postgres:15-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -d user_db -U user_service"]
interval: 1s
timeout: 1s
retries: 10
transaction_redis:
container_name: transaction_redis_db
image: redis:7.2.3-alpine3.18
volumes:
- transaction-redis-data:/data
ports:
- 6379:6379
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 1s
retries: 10
zookeeper:
image: confluentinc/cp-zookeeper:7.6.0
restart: always
container_name: zookeeper
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
healthcheck:
test: echo stat | nc localhost 2181
interval: 10s
timeout: 10s
retries: 3
ports:
- "2181:2181"
kafka:
image: confluentinc/cp-kafka:7.6.0
container_name: kafka
healthcheck:
test: ps augwwx | egrep [S]upportedKafka
restart: always
depends_on:
- zookeeper
ports:
- "9091:9091"
environment:
KAFKA_BROKER_ID: 1
KAFKA_LISTNERS: LISTNER_INT://kafka:29091,LISTENER_EXT://0.0.0.0:9091
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: LISTNER_INT://kafka:29091,LISTENER_EXT://localhost:9091
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTNER_INT:PLAINTEXT,LISTENER_EXT:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTNER_INT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_LOG_RETENTION_MINUTES: 1440
KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 10
ZOOKEEPER: zookeeper:2181
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
ports:
- "8082:8080"
restart: always
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:29091
- DYNAMIC_CONFIG_ENABLED=true
depends_on:
- kafka
volumes:
transaction-pg-data:
name: transaction-pg-data
transaction-redis-data:
name: transaction-redis-data
user-pg-data:
name: user-pg-data