-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
316 lines (296 loc) · 12.5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
316 lines (296 loc) · 12.5 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
services:
#--------------------------------------------------------------------------
# Frontend Service (React Client)
#--------------------------------------------------------------------------
client:
build:
context: ./services/client # Path to the client directory from the project root
dockerfile: Dockerfile
container_name: lecturebot-client-app
ports:
- "3000:3000" # Maps host port 3000 to container port 3000 (from your Dockerfile EXPOSE)
networks:
- lecturebot-net
restart: unless-stopped
depends_on:
api-gateway:
condition: service_healthy
user-course-microservice:
condition: service_healthy
environment:
- PUBLIC_API_URL=http://api-gateway:8080/api/v1/
#--------------------------------------------------------------------------
# Backend Service (Spring Boot Server)
#--------------------------------------------------------------------------
# ---- OLD VERSION---------
api-gateway:
build:
context: ./services/backend/api-gateway
dockerfile: Dockerfile
container_name: lecturebot-api-gateway
ports:
- "8080:8080"
networks:
- lecturebot-net
restart: unless-stopped
environment:
- SERVER_PORT=8080
- EUREKA_URI=http://eureka-user:eureka-password@discovery-service:8761/eureka
- LECTUREBOT_CLIENT_ORIGIN=${LECTUREBOT_CLIENT_ORIGIN:-http://localhost:3000}
- APP_JWT_SECRET=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
- APP_JWT_EXPIRATION_IN_MS=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_INSTANCE_HOSTNAME=api-gateway
#- app.jwtSecret=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
#- app.jwtExpirationInMs=${APP_JWT_EXPIRATION_IN_MS:-86400000}
depends_on:
discovery-service:
condition: service_healthy
user-course-microservice:
condition: service_healthy
document-microservice:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s # Wait for the backend to be ready before checking
user-course-microservice:
build:
context: ./services/backend/user-course-microservice
dockerfile: Dockerfile
container_name: lecturebot-user-course-microservice
init: true
ports:
- "8081:8081"
networks:
- lecturebot-net
restart: unless-stopped
environment:
- SERVER_PORT=8081
- JAVA_OPTS=-Xmx512m -Xms256m
- SPRING_DATASOURCE_URL=jdbc:postgresql://lecturebot-db:5432/${DB_NAME:-lecturebot_db}
- SPRING_DATASOURCE_USERNAME=${DB_USER:-lecturebot_user}
- SPRING_JPA_HIBERNATE_DDL_AUTO=${SPRING_JPA_HIBERNATE_DDL_AUTO:-update}
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD:-mysecretpassword} # Ensure this matches POSTGRES_PASSWORD below
- GENAI_SERVICE_BASE_URL=http://genai-service:8011/api/v1/query
- LECTUREBOT_CLIENT_ORIGIN=${LECTUREBOT_CLIENT_ORIGIN:-http://localhost:3000} # For CORS
- APP_JWT_SECRET=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
- APP_JWT_EXPIRATION_IN_MS=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_INSTANCE_HOSTNAME=user-course-microservice
#- app.jwtSecret=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
#- app.jwtExpirationInMs=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_URI=http://eureka-user:eureka-password@discovery-service:8761/eureka
depends_on:
lecturebot-db:
condition: service_healthy
discovery-service:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/actuator/health"] #"http://localhost:8081/api/v1/actuator/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
genai-backend-microservice:
build:
context: ./services/backend/genai-backend-microservice
dockerfile: Dockerfile
container_name: lecturebot-genai-backend-microservice
init: true
ports:
- "8082:8082"
networks:
- lecturebot-net
restart: unless-stopped
environment:
- SERVER_PORT=8082
- SPRING_JPA_HIBERNATE_DDL_AUTO=${SPRING_JPA_HIBERNATE_DDL_AUTO:-update}
- SPRING_DATASOURCE_URL=jdbc:postgresql://genai-backend-db:5432/${GENAI_DB_NAME:-genai_db}
- SPRING_DATASOURCE_USERNAME=${GENAI_DB_USER:-genai_user}
- SPRING_DATASOURCE_PASSWORD=${GENAI_DB_PASSWORD:-mysecretpassword} # Ensure this matches POSTGRES_PASSWORD below
- GENAI_SERVICE_BASE_URL=http://genai-service:8011/api/v1
- APP_JWT_SECRET=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
- APP_JWT_EXPIRATION_IN_MS=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_INSTANCE_HOSTNAME=genai-backend-microservice
#- app.jwtSecret=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
#- app.jwtExpirationInMs=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_URI=http://eureka-user:eureka-password@discovery-service:8761/eureka
depends_on:
discovery-service:
condition: service_healthy
genai-backend-db:
condition: service_healthy
genai-service:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8082/actuator/health"] #"http://localhost:8082/api/v1/actuator/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
discovery-service:
build:
context: ./services/backend/discovery-service
dockerfile: Dockerfile
container_name: lecturebot-discovery-service
networks:
lecturebot-net:
aliases:
- discovery-service
ports:
- "8761:8761"
environment:
- APP_JWT_SECRET=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
- APP_JWT_EXPIRATION_IN_MS=${APP_JWT_EXPIRATION_IN_MS:-86400000}
#- app.jwtSecret=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
#- app.jwtExpirationInMs=${APP_JWT_EXPIRATION_IN_MS:-86400000}
healthcheck:
test: ["CMD", "curl", "-f", "-u", "${EUREKA_USER:-eureka-user}:${EUREKA_PASSWORD:-eureka-password}", "http://discovery-service:8761/actuator/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
#--------------------------------------------------------------------------
# GenAI Service
#--------------------------------------------------------------------------
genai-service:
build:
context: ./services/genai # Path to the genai directory
dockerfile: Dockerfile
container_name: lecturebot-genai-service
ports:
- "8011:8011"
environment:
- LLM_PROVIDER=${LLM_PROVIDER:-tum_aet} # Default to openai
- OLLAMA_MODEL_NAME=${OLLAMA_MODEL_NAME:-llama3:8b-instruct-q4_K_M} # Ensure this matches the model pulled by ollama-setup
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434} # For externally run Ollama
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME:-gpt-4o-mini}
- TUM_AET_LLM_API_BASE=${TUM_AET_LLM_API_BASE:-https://gpu.aet.cit.tum.de/api}
- TUM_AET_LLM_API_KEY=${TUM_AET_LLM_API_KEY}
- TUM_AET_LLM_MODEL_NAME=${TUM_AET_LLM_MODEL_NAME:-llama3.3:latest}
- WEAVIATE_URL=http://weaviate:8080 # Connect to weaviate service
- TOKENIZERS_PARALLELISM=false # Recommended for some environments
networks:
- lecturebot-net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8011/health"]
interval: 10s
timeout: 10s
retries: 5
start_period: 90s # Give the service time to load models before checking
depends_on:
weaviate: { condition: service_started } # Weaviate doesn't have a simple built-in healthcheck for compose v1 style
#--------------------------------------------------------------------------
# Weaviate Service
#--------------------------------------------------------------------------
weaviate:
image: semitechnologies/weaviate:latest
container_name: lecturebot-weaviate-db
ports:
- "8089:8080" # Changed host port for Weaviate REST to 8089 to avoid conflict with server
- "50051:50051" # gRPC
volumes:
- weaviate_data:/var/lib/weaviate
environment:
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
DEFAULT_VECTORIZER_MODULE: 'none' # As per your command
ENABLE_MODULES: '' # As per your command
CLUSTER_HOSTNAME: 'node1' # Recommended for Weaviate
networks:
- lecturebot-net
restart: unless-stopped
#--------------------------------------------------------------------------
# Ollama Service
# Ollama will be run externally. See README.md for instructions.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Database Service (PostgreSQL)
#--------------------------------------------------------------------------
lecturebot-db:
image: postgres:16
container_name: lecturebot-postgres-db
environment:
POSTGRES_DB: ${DB_NAME:-lecturebot_db}
POSTGRES_USER: ${DB_USER:-lecturebot_user}
POSTGRES_PASSWORD: ${DB_PASSWORD:-mysecretpassword} # This now consistently uses the same variable as the server
ports:
- "5432:5432"
volumes:
- lecturebot_db_data:/var/lib/postgresql/data
- ./services/backend/user-course-microservice/db-init/:/docker-entrypoint-initdb.d/
networks:
- lecturebot-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lecturebot_user -d lecturebot_db"]
interval: 10s
timeout: 5s
retries: 5
genai-backend-db:
image: postgres:16
container_name: lecturebot-genai-postgres-db
environment:
POSTGRES_DB: ${GENAI_DB_NAME:-genai_db}
POSTGRES_USER: ${GENAI_DB_USER:-genai_user}
POSTGRES_PASSWORD: ${GENAI_DB_PASSWORD:-mysecretpassword} # This now consistently uses the same variable as the server
ports:
- "5433:5432"
volumes:
- genai_db_data:/var/lib/postgresql/data
- ./services/backend/genai-backend-microservice/db-init:/docker-entrypoint-initdb.d # Mount init scripts from server/db-init
networks:
- lecturebot-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U genai_user -d genai_db"]
interval: 10s
timeout: 5s
retries: 5
#--------------------------------------------------------------------------
# Document Service (Spring Boot)
#--------------------------------------------------------------------------
document-microservice:
build:
context: ./services/backend/document-microservice
dockerfile: Dockerfile
container_name: lecturebot-document-microservice
ports:
- "8083:8083" # Expose on a different host port to avoid conflict
environment:
- SERVER_PORT=8083
- SPRING_DATASOURCE_URL=jdbc:postgresql://lecturebot-db:5432/lecturebot_db
- SPRING_DATASOURCE_USERNAME=${DB_USER:-lecturebot_user}
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD:-mysecretpassword}
- SPRING_JPA_HIBERNATE_DDL_AUTO=${SPRING_JPA_HIBERNATE_DDL_AUTO:-none}
- APP_JWT_SECRET=${APP_JWT_SECRET:-c29tZXRoaW5nLXNlY3JldC1mb3ItbGVjdHVyZS1ib3QtYXBwbGljYXRpb24tMjAyNC1kZXZvcHM=}
- APP_JWT_EXPIRATION_IN_MS=${APP_JWT_EXPIRATION_IN_MS:-86400000}
- EUREKA_URI=http://eureka-user:eureka-password@discovery-service:8761/eureka # <-- ADD THIS LINE
- EUREKA_INSTANCE_HOSTNAME=document-microservice
depends_on:
lecturebot-db:
condition: service_healthy
discovery-service:
condition: service_healthy
genai-backend-microservice:
condition: service_healthy
networks:
- lecturebot-net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8083/actuator/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
volumes:
lecturebot_db_data: {}
genai_db_data: {} #For genai backend microservices
weaviate_data: {} # Named volume for Weaviate data
# ollama_data: {} # Ollama data managed externally
networks:
lecturebot-net:
driver: bridge