-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
163 lines (150 loc) · 4.94 KB
/
docker-compose.yml
File metadata and controls
163 lines (150 loc) · 4.94 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
version: '4'
services:
# Product Service (Port 8081)
product-service:
image: ankurgangwar/product-service:latest
container_name: product-service
ports:
- "8081:8080" # External:8081 -> Container:8080
depends_on:
- mongodb-product-service
environment:
SPRING_DATA_MONGODB_URI: mongodb://root:password@mongodb-product-service:27017/product-service?authSource=admin
mongodb-product-service:
image: mongo:7.0.5
container_name: mongodb-product-service
ports:
- "27017:27017" # MongoDB default port
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: product-service
volumes:
- mongodb-product-data:/data/db
# Inventory Service (Port 8082)
inventory-service:
image: ankurgangwar/inventory-service:latest
container_name: inventory-service
ports:
- "8082:8080" # External:8082 -> Container:8080
depends_on:
- mysql-inventory-service
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-inventory-service:3306/inventory_service
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: mysql
mysql-inventory-service:
image: mysql:8.3.0
container_name: mysql-inventory-service
ports:
- "3306:3306" # MySQL default port
environment:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: inventory_service
volumes:
- mysql-inventory-data:/var/lib/mysql
# Order Service (Port 8083)
order-service:
image: ankurgangwar/order-service:latest
container_name: order-service
ports:
- "8083:8080" # External:8083 -> Container:8080
depends_on:
- mysql-order-service
- inventory-service
- broker
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-order-service:3306/order_service
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: mysql
INVENTORY_URL: http://inventory-service:8080
SPRING_KAFKA_BOOTSTRAP_SERVERS: broker:29092
mysql-order-service:
image: mysql:8.3.0
container_name: mysql-order-service
ports:
- "3307:3306" # External:3307 -> Container:3306
environment:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: order_service
volumes:
- mysql-order-data:/var/lib/mysql
# Notification Service (Port 8084)
notification-service:
image: ankurgangwar/notification-service:latest
container_name: notification-service
ports:
- "8084:8080" # External:8084 -> Container:8080
depends_on:
- broker
environment:
SPRING_KAFKA_BOOTSTRAP_SERVERS: broker:29092
SPRING_MAIL_HOST: sandbox.smtp.mailtrap.io
SPRING_MAIL_PORT: 2525
SPRING_MAIL_USERNAME: username # fill mailtrap username
SPRING_MAIL_PASSWORD: password # fill mailtrap password
# API Gateway (Port 8080)
api-gateway:
image: ankurgangwar/api-gateway
container_name: api-gateway
ports:
- "8080:8080" # External:8080 -> Container:8080
depends_on:
- product-service
- order-service
- inventory-service
environment:
PRODUCT_SERVICE_URL: http://product-service:8080
ORDER_SERVICE_URL: http://order-service:8080
INVENTORY_SERVICE_URL: http://inventory-service:8080
# Kafka Infrastructure
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181" # Zookeeper default port
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
broker:
image: confluentinc/cp-kafka:7.5.0
container_name: broker
ports:
- "9092:9092" # Kafka external port
- "29092:29092" # Kafka internal port for container communication
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
schema-registry:
image: confluentinc/cp-schema-registry:7.5.0
hostname: schema-registry
container_name: schema-registry
ports:
- "8085:8081" # External:8085 -> Container:8081
depends_on:
- broker
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:29092'
SCHEMA_REGISTRY_LISTENERS: http://schema-registry:8081
# Kafka UI (Port 8086)
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- "8086:8080" # External:8086 -> Container:8080
environment:
KAFKA_CLUSTERS_NAME: local
KAFKA_CLUSTERS_BOOTSTRAP_SERVERS: 'broker:29092'
KAFKA_CLUSTERS_SCHEMAREGISTRY: http://schema-registry:8081
DYNAMIC_CONFIG_ENABLED: 'true'
volumes:
mongodb-product-data:
mysql-inventory-data:
mysql-order-data: