-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
291 lines (276 loc) · 8.51 KB
/
docker-compose.yml
File metadata and controls
291 lines (276 loc) · 8.51 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
# =============================================================================
# xshopai - Local Development Infrastructure
# =============================================================================
# This file contains ALL infrastructure services needed for local development.
# Run this BEFORE starting any application services.
#
# Quick Start:
# docker-compose up -d
# docker-compose down
# docker-compose down --volumes # Remove all data
#
# Services included:
# - Service Discovery (Consul)
# - Message Broker (RabbitMQ)
# - Distributed Tracing (Zipkin)
# - Email Testing (Mailpit)
# - Cache & Session Store (Redis)
# - MongoDB (3 instances: user, product, review)
# - PostgreSQL (2 instances: audit, order-processor)
# - SQL Server (2 instances: order, payment)
# - MySQL (1 instance: inventory)
#
# Note: Auth service uses user-service database (no separate database)
# Cart service uses Redis (no separate database)
services:
# ============================================================================
# Service Discovery
# ============================================================================
consul:
image: hashicorp/consul:1.17
container_name: dev-consul
restart: unless-stopped
ports:
- "8500:8500" # HTTP API + Web UI
- "8600:8600/udp" # DNS
command: agent -server -bootstrap-expect=1 -ui -client=0.0.0.0 -bind=127.0.0.1
volumes:
- consul_data:/consul/data
networks:
- xshopai-dev
healthcheck:
test: ["CMD", "consul", "members"]
interval: 10s
timeout: 5s
retries: 3
# ============================================================================
# Message Broker
# ============================================================================
rabbitmq:
image: rabbitmq:3-management
container_name: dev-rabbitmq
restart: unless-stopped
ports:
- "5672:5672" # AMQP
- "15672:15672" # Management UI
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin123
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- xshopai-dev
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ============================================================================
# Distributed Tracing
# ============================================================================
zipkin:
image: openzipkin/zipkin:latest
container_name: dev-zipkin
restart: unless-stopped
ports:
- "9411:9411"
environment:
JAVA_OPTS: -Xms512m -Xmx512m
networks:
- xshopai-dev
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9411/health"]
interval: 10s
timeout: 5s
retries: 3
# ============================================================================
# Email Testing
# ============================================================================
mailpit:
image: axllent/mailpit:latest
container_name: dev-mailpit
restart: unless-stopped
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
environment:
MP_MAX_MESSAGES: 5000
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
networks:
- xshopai-dev
# ============================================================================ # Cache & Session Store
# ============================================================================
redis:
image: redis:7-alpine
container_name: dev-redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --requirepass redis_dev_pass_123
volumes:
- redis_data:/data
networks:
- xshopai-dev
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis_dev_pass_123", "ping"]
interval: 10s
timeout: 5s
retries: 3
# ============================================================================ # MongoDB Databases
# ============================================================================
user-mongodb:
image: mongo:latest
container_name: dev-user-mongodb
restart: unless-stopped
ports:
- "27018:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
MONGO_INITDB_DATABASE: user_service_db
volumes:
- user_mongodb_data:/data/db
networks:
- xshopai-dev
product-mongodb:
image: mongo:latest
container_name: dev-product-mongodb
restart: unless-stopped
ports:
- "27019:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
MONGO_INITDB_DATABASE: product_service_db
volumes:
- product_mongodb_data:/data/db
networks:
- xshopai-dev
review-mongodb:
image: mongo:latest
container_name: dev-review-mongodb
restart: unless-stopped
ports:
- "27020:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
MONGO_INITDB_DATABASE: review_service_db
volumes:
- review_mongodb_data:/data/db
networks:
- xshopai-dev
# ============================================================================
# PostgreSQL Databases
# ============================================================================
audit-postgres:
image: postgres:16
container_name: dev-audit-postgres
restart: unless-stopped
ports:
- "5434:5432"
environment:
POSTGRES_DB: audit_service_db
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin123
volumes:
- audit_postgres_data:/var/lib/postgresql/data
networks:
- xshopai-dev
order-processor-postgres:
image: postgres:16
container_name: dev-order-processor-postgres
restart: unless-stopped
ports:
- "5435:5432"
environment:
POSTGRES_DB: order_processor_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- order_processor_postgres_data:/var/lib/postgresql/data
networks:
- xshopai-dev
# ============================================================================
# SQL Server Databases
# ============================================================================
order-sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: dev-order-sqlserver
restart: unless-stopped
ports:
- "1434:1433"
environment:
SA_PASSWORD: Admin123!
ACCEPT_EULA: Y
MSSQL_PID: Developer
volumes:
- order_sqlserver_data:/var/opt/mssql
networks:
- xshopai-dev
payment-sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: dev-payment-sqlserver
restart: unless-stopped
ports:
- "1433:1433"
environment:
SA_PASSWORD: Admin123!
ACCEPT_EULA: Y
MSSQL_PID: Developer
volumes:
- payment_sqlserver_data:/var/opt/mssql
networks:
- xshopai-dev
# ============================================================================
# MySQL Database
# ============================================================================
inventory-mysql:
image: mysql:latest
container_name: dev-inventory-mysql
restart: unless-stopped
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: inventory_root_pass_123
MYSQL_DATABASE: inventory_service_db
MYSQL_USER: admin
MYSQL_PASSWORD: admin123
volumes:
- inventory_mysql_data:/var/lib/mysql
networks:
- xshopai-dev
# ============================================================================
# Volumes
# ============================================================================
volumes:
consul_data:
name: xshopai-dev-consul
rabbitmq_data:
name: xshopai-dev-rabbitmq
redis_data:
name: xshopai-dev-redis
user_mongodb_data:
name: xshopai-dev-user-mongodb
product_mongodb_data:
name: xshopai-dev-product-mongodb
review_mongodb_data:
name: xshopai-dev-review-mongodb
audit_postgres_data:
name: xshopai-dev-audit-postgres
order_processor_postgres_data:
name: xshopai-dev-order-processor-postgres
order_sqlserver_data:
name: xshopai-dev-order-sqlserver
payment_sqlserver_data:
name: xshopai-dev-payment-sqlserver
inventory_mysql_data:
name: xshopai-dev-inventory-mysql
# ============================================================================
# Network
# ============================================================================
networks:
xshopai-dev:
name: xshopai-dev-network
driver: bridge