-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
460 lines (411 loc) · 14.9 KB
/
docker-compose.yml
File metadata and controls
460 lines (411 loc) · 14.9 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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
version: '3.8'
# ExhibitFlow Microservices Architecture
# This docker-compose orchestrates all services in the ExhibitFlow platform
networks:
exhibitflow-network:
driver: bridge
volumes:
postgres_stall_data:
driver: local
postgres_reservation_data:
driver: local
postgres_notification_data:
driver: local
redis_data:
driver: local
eureka-logs:
driver: local
services:
# ==========================================
# Infrastructure Services
# ==========================================
# Service Registry (Eureka Server)
eureka-server:
build:
context: ./service-registery
dockerfile: Dockerfile
container_name: eureka-server
ports:
- "8761:8761"
environment:
SPRING_PROFILES_ACTIVE: docker
EUREKA_CLIENT_REGISTER_WITH_EUREKA: "false"
EUREKA_CLIENT_FETCH_REGISTRY: "false"
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8761/actuator/health" ]
interval: 30s
timeout: 3s
retries: 5
start_period: 60s
volumes:
- eureka-logs:/app/logs
restart: unless-stopped
# Redis (for API Gateway rate limiting)
redis:
image: redis:7-alpine
container_name: exhibitflow-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
command: redis-server --appendonly yes
restart: unless-stopped
# PostgreSQL for Stall Service
postgres-stall:
image: postgres:16-alpine
container_name: stall-postgres
environment:
POSTGRES_DB: ${STALL_DB_NAME:-stalldb}
POSTGRES_USER: ${STALL_DB_USER:-stalluser}
POSTGRES_PASSWORD: ${STALL_DB_PASSWORD:-stallpass}
ports:
- "5432:5432"
volumes:
- postgres_stall_data:/var/lib/postgresql/data
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${STALL_DB_USER:-stalluser} -d ${STALL_DB_NAME:-stalldb}" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# PostgreSQL for Reservation Service
postgres-reservation:
image: postgres:16-alpine
container_name: reservation-postgres
environment:
POSTGRES_DB: ${RESERVATION_DB_NAME:-reservation_db}
POSTGRES_USER: ${RESERVATION_DB_USER:-postgres}
POSTGRES_PASSWORD: ${RESERVATION_DB_PASSWORD:-Prami@3990}
ports:
- "5433:5432"
volumes:
- postgres_reservation_data:/var/lib/postgresql/data
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${RESERVATION_DB_USER:-postgres} -d ${RESERVATION_DB_NAME:-reservation_db}" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# PostgreSQL for Notification Service
postgres-notification:
image: postgres:16-alpine
container_name: notification-postgres
environment:
POSTGRES_DB: notificationdb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5434:5432"
volumes:
- postgres_notification_data:/var/lib/postgresql/data
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d notificationdb" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# Zookeeper (for Kafka)
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
container_name: exhibitflow-zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "nc", "-z", "localhost", "2181" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# Kafka (for Event Streaming)
kafka:
image: confluentinc/cp-kafka:7.5.0
container_name: exhibitflow-kafka
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "kafka-broker-api-versions", "--bootstrap-server", "localhost:9092" ]
interval: 10s
timeout: 10s
retries: 5
restart: unless-stopped
# ==========================================
# Application Services
# ==========================================
# Identity Service (Authentication & Authorization)
identity-service:
build:
context: ./identity-service
dockerfile: Dockerfile
container_name: identity-service
depends_on:
eureka-server:
condition: service_healthy
ports:
- "8080:8080"
environment:
# Spring Configuration
SPRING_PROFILES_ACTIVE: docker
SERVER_PORT: 8080
# Database Configuration
SPRING_DATASOURCE_URL: jdbc:postgresql://identity-lasitha6646.f.aivencloud.com:23584/defaultdb?sslmode=require
DB_USERNAME: avnadmin
DB_PASSWORD: AVNS_yznanR4csOCgDaLQ0Gk
# Eureka Configuration
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE: http://eureka-server:8761/eureka/
EUREKA_INSTANCE_HOSTNAME: identity-service
# JWT Configuration
JWT_SECRET: ${JWT_SECRET:-f2c6e97c097796d1a76cde99efa8e6383c289000889fad38eb6f93274768a347}
JWT_EXPIRATION: ${JWT_EXPIRATION:-86400000}
JWT_REFRESH_EXPIRATION: ${JWT_REFRESH_EXPIRATION:-604800000}
# OAuth2 Configuration
OAUTH2_ISSUER_URI: ${OAUTH2_ISSUER_URI:-http://identity-service:8080}
OAUTH2_CLIENT_ID: ${OAUTH2_CLIENT_ID:-exhibitflow-client}
OAUTH2_CLIENT_SECRET: ${OAUTH2_CLIENT_SECRET:-exhibitflow-secret}
OAUTH2_REDIRECT_URIS: ${OAUTH2_REDIRECT_URIS:-http://localhost:3000/callback}
OAUTH2_SCOPES: ${OAUTH2_SCOPES:-read,write}
# Flyway Configuration
SPRING_FLYWAY_ENABLED: "true"
SPRING_FLYWAY_BASELINE_ON_MIGRATE: "true"
# Logging
LOGGING_LEVEL_ROOT: INFO
LOGGING_LEVEL_COM_EXHIBITFLOW: DEBUG
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/v1/actuator/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 90s
restart: unless-stopped
# Stall Service (Stall Management)
stall-service:
build:
context: ./Stall-Service
dockerfile: Dockerfile
container_name: stall-service
depends_on:
eureka-server:
condition: service_healthy
kafka:
condition: service_healthy
identity-service:
condition: service_healthy
ports:
- "8081:8081"
environment:
# Spring Configuration
SPRING_PROFILES_ACTIVE: docker
SERVER_PORT: 8081
# Database Configuration
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres-stall:5432/${STALL_DB_NAME:-stalldb}?sslmode=disable
SPRING_DATASOURCE_USERNAME: ${STALL_DB_USER:-stalluser}
SPRING_DATASOURCE_PASSWORD: ${STALL_DB_PASSWORD:-stallpass}
# Kafka Configuration
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
KAFKA_TOPICS_STALL_RESERVED: stall.reserved
KAFKA_TOPICS_STALL_RELEASED: stall.released
# Eureka Configuration
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE: http://eureka-server:8761/eureka/
EUREKA_INSTANCE_HOSTNAME: stall-service
# JWT Configuration (shared secret with Identity Service)
JWT_SECRET: ${JWT_SECRET:-f2c6e97c097796d1a76cde99efa8e6383c289000889fad38eb6f93274768a347}
# Identity Service Integration
IDENTITY_SERVICE_URL: http://identity-service:8080/api/v1
# Flyway Configuration
SPRING_FLYWAY_ENABLED: "true"
SPRING_FLYWAY_BASELINE_ON_MIGRATE: "true"
# Logging
LOGGING_LEVEL_ROOT: INFO
LOGGING_LEVEL_COM_EXHIBITFLOW: DEBUG
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8081/actuator/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 90s
restart: unless-stopped
# Reservation Service
reservation-service:
build:
context: ./reservation-service
dockerfile: Dockerfile
container_name: reservation-service
depends_on:
eureka-server:
condition: service_healthy
kafka:
condition: service_healthy
postgres-reservation:
condition: service_healthy
identity-service:
condition: service_healthy
ports:
- "8084:8084"
environment:
# Spring Configuration
SPRING_PROFILES_ACTIVE: docker
SERVER_PORT: 8084
# Database Configuration
DB_HOST: postgres-reservation
DB_PORT: 5432
RESERVATION_DB_NAME: ${RESERVATION_DB_NAME:-reservation_db}
RESERVATION_DB_USER: ${RESERVATION_DB_USER:-postgres}
RESERVATION_DB_PASSWORD: ${RESERVATION_DB_PASSWORD:-Prami@3990}
# Kafka Configuration
KAFKA_BOOTSTRAP_SERVERS: kafka:29092
# Eureka Configuration
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE: http://eureka-server:8761/eureka/
EUREKA_INSTANCE_HOSTNAME: reservation-service
# Service URLs
USER_SERVICE_URL: http://identity-service:8080
STALL_SERVICE_URL: http://stall-service:8081
# JWT Configuration
JWT_SECRET: ${JWT_SECRET:-f2c6e97c097796d1a76cde99efa8e6383c289000889fad38eb6f93274768a347}
# Feign Auth Token
APP_FEIGN_AUTH_TOKEN: ${APP_FEIGN_AUTH_TOKEN:-eyJhbGciOiJIUzUxMiJ9.eyJwZXJtaXNzaW9ucyI6WyJwZXJtaXNzaW9uOmRlbGV0ZSIsInVzZXI6ZGVsZXRlIiwidXNlcjpyZWFkIiwidXNlcjp3cml0ZSIsInJvbGU6cmVhZCIsInBlcm1pc3Npb246d3JpdGUiLCJyb2xlOmRlbGV0ZSIsInJvbGU6d3JpdGUiLCJwZXJtaXNzaW9uOnJlYWQiXSwicm9sZXMiOlsiQURNSU4iXSwidXNlcklkIjoiNjBhYjViNjgtNmY0MS00OWI3LWE0NjEtZjJjZjg5ZTZjMDk5IiwiZW1haWwiOiJhZG1pbkBleGhpYml0Zmxvdy5jb20iLCJhdXRob3JpdGllcyI6WyJST0xFX0FETUlOIiwicGVybWlzc2lvbjpkZWxldGUiLCJ1c2VyOmRlbGV0ZSIsInVzZXI6cmVhZCIsInVzZXI6d3JpdGUiLCJyb2xlOnJlYWQiLCJwZXJtaXNzaW9uOndyaXRlIiwicm9sZTpkZWxldGUiLCJyb2xlOndyaXRlIiwicGVybWlzc2lvbjpyZWFkIl0sInVzZXJuYW1lIjoiYWRtaW4iLCJzdWIiOiJhZG1pbiIsImlzcyI6Ii9hcGkvdjEiLCJpYXQiOjE3NjQwNTY1MjQsImV4cCI6MTc2NDE0MjkyNH0.roZ5_2FCub7wPhkm2ybnk-GG6ELtI-Wd779vXQ6k2PmLQa3BloFOv6fHmHHSAoWTEW74A0rCf9KYu4bgJb0zGg}
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8084/actuator/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 90s
restart: unless-stopped
# Notification Service
notification-service:
build:
context: ./notification-service
dockerfile: Dockerfile
container_name: notification-service
depends_on:
eureka-server:
condition: service_healthy
kafka:
condition: service_healthy
postgres-notification:
condition: service_healthy
identity-service:
condition: service_healthy
ports:
- "8087:8080"
environment:
# Spring Configuration
SPRING_PROFILES_ACTIVE: docker
# Database Configuration
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres-notification:5432/notificationdb
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
# Kafka Configuration
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:29092
SPRING_KAFKA_TOPIC_STALL_RESERVED: stall.reserved
# Eureka Configuration
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE: http://eureka-server:8761/eureka/
EUREKA_INSTANCE_HOSTNAME: notification-service
# User Service
SERVICES_USER_SERVICE_URL: http://identity-service:8080/api/v1
SERVICES_USER_SERVICE_BEARER_TOKEN: ${APP_FEIGN_AUTH_TOKEN:-eyJhbGciOiJIUzUxMiJ9.eyJwZXJtaXNzaW9ucyI6WyJwZXJtaXNzaW9uOmRlbGV0ZSIsInVzZXI6ZGVsZXRlIiwicGVybWlzc2lvbjp3cml0ZSIsInVzZXI6cmVhZCIsInVzZXI6d3JpdGUiLCJyb2xlOnJlYWQiLCJyb2xlOmRlbGV0ZSIsInJvbGU6d3JpdGUiLCJwZXJtaXNzaW9uOnJlYWQiXSwicm9sZXMiOlsiQURNSU4iXSwidXNlcklkIjoiNjBhYjViNjgtNmY0MS00OWI3LWE0NjEtZjJjZjg5ZTZjMDk5IiwiZW1haWwiOiJhZG1pbkBleGhpYml0Zmxvdy5jb20iLCJhdXRob3JpdGllcyI6WyJST0xFX0FETUlOIiwicGVybWlzc2lvbjpkZWxldGUiLCJ1c2VyOmRlbGV0ZSIsInBlcm1pc3Npb246d3JpdGUiLCJ1c2VyOnJlYWQiLCJ1c2VyOndyaXRlIiwicm9sZTpyZWFkIiwicm9sZTpkZWxldGUiLCJyb2xlOndyaXRlIiwicGVybWlzc2lvbjpyZWFkIl0sInVzZXJuYW1lIjoiYWRtaW4iLCJzdWIiOiJhZG1pbiIsImlzcyI6Ii9hcGkvdjEiLCJpYXQiOjE3NjQwODQ2NTcsImV4cCI6MTc2NDE3MTA1N30.x53j8beOalWNfxD7tWAcvMGLPQb6t0rLjhGCy2qVPnox3lBKjcZiqsSs7nUMXgEj2yH04y7c5pvTcVBdEB2MVA}
# Mail Configuration
SPRING_MAIL_HOST: smtp.gmail.com
SPRING_MAIL_PORT: 587
SPRING_MAIL_USERNAME: tharindutcc12@gmail.com
SPRING_MAIL_PASSWORD: "loix efej fbtb ltaf"
SPRING_MAIL_PROPERTIES_MAIL_SMTP_AUTH: "true"
SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE: "true"
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/actuator/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 90s
restart: unless-stopped
# API Gateway (Entry point for all services)
api-gateway:
build:
context: ./api-gateway-service
dockerfile: Dockerfile
container_name: api-gateway
depends_on:
eureka-server:
condition: service_healthy
redis:
condition: service_healthy
identity-service:
condition: service_healthy
stall-service:
condition: service_healthy
reservation-service:
condition: service_healthy
notification-service:
condition: service_healthy
ports:
- "9090:9090"
environment:
# Spring Configuration
SPRING_PROFILES_ACTIVE: docker
SERVER_PORT: 9090
# Eureka Configuration
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE: http://eureka-server:8761/eureka/
EUREKA_INSTANCE_HOSTNAME: api-gateway
# Redis Configuration (for rate limiting)
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ""
# JWT Configuration
JWT_ISSUER_URI: http://identity-service:8080
JWT_JWK_SET_URI: http://identity-service:8080/.well-known/jwks.json
# CORS Configuration
CORS_ALLOWED_ORIGINS: http://localhost:3000,http://localhost:5173
# Rate Limiting
RATE_LIMIT_ENABLED: "true"
# Logging
LOGGING_LEVEL_ROOT: INFO
LOGGING_LEVEL_COM_EXHIBITFLOW: DEBUG
SECURITY_LOG_LEVEL: INFO
networks:
- exhibitflow-network
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/actuator/health" ]
interval: 30s
timeout: 5s
retries: 5
start_period: 90s
restart: unless-stopped