forked from rapidaai/voice-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
494 lines (390 loc) · 13.8 KB
/
Copy pathMakefile
File metadata and controls
494 lines (390 loc) · 13.8 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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
.PHONY: help up down build rebuild logs clean restart ps shell db-shell \
up-all up-web up-integration up-endpoint up-db up-redis up-opensearch \
down-all down-web down-integration down-endpoint down-db down-redis down-opensearch \
build-all build-web build-integration build-endpoint \
rebuild-all rebuild-web rebuild-integration rebuild-endpoint \
logs-all logs-web logs-integration logs-endpoint logs-db logs-redis logs-opensearch \
restart-all restart-web restart-integration restart-endpoint \
ps-all shell-web shell-integration shell-endpoint db-shell
COMPOSE := docker compose -f docker-compose.yml
help:
@echo ""
@echo "╔════════════════════════════════════════════════════════════════╗"
@echo "║ Docker Compose Service Management ║"
@echo "╚════════════════════════════════════════════════════════════════╝"
@echo ""
@echo "STARTUP COMMANDS:"
@echo " make up-all - Start all services"
@echo " make up-web - Start web-api only"
@echo " make up-integration - Start integration-api only"
@echo " make up-endpoint - Start endpoint-api only"
@echo " make up-db - Start PostgreSQL only"
@echo " make up-redis - Start Redis only"
@echo " make up-opensearch - Start OpenSearch only"
@echo " make up-nginx - Start nginx only"
@echo ""
@echo "SHUTDOWN COMMANDS:"
@echo " make down-all - Stop all services"
@echo " make down-web - Stop web-api only"
@echo " make down-integration - Stop integration-api only"
@echo " make down-endpoint - Stop endpoint-api only"
@echo " make down-db - Stop PostgreSQL only"
@echo " make down-redis - Stop Redis only"
@echo " make down-opensearch - Stop OpenSearch only"
@echo " make down-nginx - Stop nginx only"
@echo ""
@echo "BUILD COMMANDS:"
@echo " make build-all - Build all services"
@echo " make build-web - Build web-api image"
@echo " make build-integration - Build integration-api image"
@echo " make build-endpoint - Build endpoint-api image"
@echo " make rebuild-all - Rebuild all (no cache)"
@echo " make rebuild-web - Rebuild web-api (no cache)"
@echo " make rebuild-integration - Rebuild integration-api (no cache)"
@echo " make rebuild-endpoint - Rebuild endpoint-api (no cache)"
@echo ""
@echo "MONITORING COMMANDS:"
@echo " make logs-all - View all service logs"
@echo " make logs-web - View web-api logs"
@echo " make logs-integration - View integration-api logs"
@echo " make logs-endpoint - View endpoint-api logs"
@echo " make logs-db - View PostgreSQL logs"
@echo " make logs-redis - View Redis logs"
@echo " make logs-opensearch - View OpenSearch logs"
@echo " make ps-all - Show all running containers"
@echo ""
@echo "RESTART COMMANDS:"
@echo " make restart-all - Restart all services"
@echo " make restart-web - Restart web-api"
@echo " make restart-integration - Restart integration-api"
@echo " make restart-endpoint - Restart endpoint-api"
@echo ""
@echo "SHELL COMMANDS:"
@echo " make shell-web - Open web-api container shell"
@echo " make shell-integration - Open integration-api container shell"
@echo " make shell-endpoint - Open endpoint-api container shell"
@echo " make shell-db - Open PostgreSQL shell"
@echo ""
@echo "MAINTENANCE:"
@echo " make clean - Stop and remove containers, volumes, images"
@echo " make clean-volumes - Remove only volumes"
@echo " make status - Show container status and ports"
@echo ""
# ============================================================================
# STARTUP TARGETS - Individual Services
# ============================================================================
up-all:
@echo "Starting all services..."
$(COMPOSE) up -d
@echo "✓ All services started"
@$(MAKE) status
up-ui:
@echo "Starting ui..."
$(COMPOSE) up -d ui
@echo "✓ ui started on port 3000"
up-document:
@echo "Starting document-api..."
$(COMPOSE) up -d document-api
@echo "✓ web-api started on port 9010"
up-web:
@echo "Starting web-api..."
$(COMPOSE) up -d web-api
@echo "✓ web-api started on port 9001"
up-integration:
@echo "Starting integration-api..."
$(COMPOSE) up -d integration-api
@echo "✓ integration-api started on port 9004"
up-endpoint:
@echo "Starting endpoint-api..."
$(COMPOSE) up -d endpoint-api
@echo "✓ endpoint-api started on port 9005"
up-assistant:
@echo "Starting assistant-api..."
$(COMPOSE) up -d assistant-api
@echo "✓ assistant-api started on port 9007"
up-db:
@echo "Starting PostgreSQL..."
$(COMPOSE) up -d postgres
@echo "✓ PostgreSQL started on port 5432"
up-nginx:
@echo "Starting nginx..."
$(COMPOSE) up -d nginx
@echo "✓ nginx started on port 6379"
up-redis:
@echo "Starting Redis..."
$(COMPOSE) up -d redis
@echo "✓ Redis started on port 6379"
up-opensearch:
@echo "Starting OpenSearch..."
$(COMPOSE) up -d opensearch
@echo "✓ OpenSearch started on port 9200"
# Legacy aliases
up: up-all
# ============================================================================
# SHUTDOWN TARGETS - Individual Services
# ============================================================================
down-all:
@echo "Stopping all services..."
$(COMPOSE) down
@echo "✓ All services stopped"
down-ui:
@echo "Stopping ui..."
$(COMPOSE) stop ui
@echo "✓ ui stopped"
down-web:
@echo "Stopping web-api..."
$(COMPOSE) stop web-api
@echo "✓ web-api stopped"
down-document:
@echo "Stopping document-api..."
$(COMPOSE) stop document-api
@echo "✓ document-api stopped"
down-assistant:
@echo "Stopping assistant-api..."
$(COMPOSE) stop assistant-api
@echo "✓ assistant-api stopped"
down-integration:
@echo "Stopping integration-api..."
$(COMPOSE) stop integration-api
@echo "✓ integration-api stopped"
down-endpoint:
@echo "Stopping endpoint-api..."
$(COMPOSE) stop endpoint-api
@echo "✓ endpoint-api stopped"
down-db:
@echo "Stopping PostgreSQL..."
$(COMPOSE) stop postgres
@echo "✓ PostgreSQL stopped"
down-redis:
@echo "Stopping Redis..."
$(COMPOSE) stop redis
@echo "✓ Redis stopped"
down-nginx:
@echo "Stopping nginx..."
$(COMPOSE) stop nginx
@echo "✓ nginx stopped"
down-opensearch:
@echo "Stopping OpenSearch..."
$(COMPOSE) stop opensearch
@echo "✓ OpenSearch stopped"
# Legacy alias
down: down-all
# ============================================================================
# BUILD TARGETS
# ============================================================================
build-all:
@echo "Building all services..."
$(COMPOSE) build ui web-api integration-api endpoint-api document-api assistant-api
@echo "✓ All services built"
build-ui:
@echo "Building ui..."
$(COMPOSE) build ui
@echo "✓ ui built"
build-web:
@echo "Building web-api..."
$(COMPOSE) build web-api
@echo "✓ web-api built"
build-document:
@echo "Building document-api..."
$(COMPOSE) build document-api
@echo "✓ document-api built"
build-assistant:
@echo "Building assistant-api..."
$(COMPOSE) build assistant-api
@echo "✓ assistant-api built"
build-integration:
@echo "Building integration-api..."
$(COMPOSE) build integration-api
@echo "✓ integration-api built"
build-endpoint:
@echo "Building endpoint-api..."
$(COMPOSE) build endpoint-api
@echo "✓ endpoint-api built"
rebuild-all:
@echo "Rebuilding all services (no cache)..."
$(COMPOSE) build --no-cache ui web-api integration-api endpoint-api document-api assistant-api
@echo "✓ All services rebuilt"
rebuild-web:
@echo "Rebuilding web-api (no cache)..."
$(COMPOSE) build --no-cache web-api
@echo "✓ web-api rebuilt"
rebuild-nginx:
@echo "Rebuilding nginx (no cache)..."
$(COMPOSE) build --no-cache nginx
@echo "✓ nginx rebuilt"
rebuild-document:
@echo "Rebuilding document-api (no cache)..."
$(COMPOSE) build --no-cache document-api
@echo "✓ document-api rebuilt"
rebuild-assistant:
@echo "Rebuilding assistant-api (no cache)..."
$(COMPOSE) build --no-cache assistant-api
@echo "✓ assistant-api rebuilt"
rebuild-ui:
@echo "Rebuilding ui (no cache)..."
$(COMPOSE) build --no-cache ui
@echo "✓ ui rebuilt"
rebuild-integration:
@echo "Rebuilding integration-api (no cache)..."
$(COMPOSE) build --no-cache integration-api
@echo "✓ integration-api rebuilt"
rebuild-endpoint:
@echo "Rebuilding endpoint-api (no cache)..."
$(COMPOSE) build --no-cache endpoint-api
@echo "✓ endpoint-api rebuilt"
# Legacy aliases
build: build-web
rebuild: rebuild-web
# ============================================================================
# LOGGING TARGETS
# ============================================================================
logs-all:
$(COMPOSE) logs -f
logs-ui:
$(COMPOSE) logs -f ui
logs-web:
$(COMPOSE) logs -f web-api
logs-document:
$(COMPOSE) logs -f document-api
logs-assistant:
$(COMPOSE) logs -f assistant-api
logs-integration:
$(COMPOSE) logs -f integration-api
logs-endpoint:
$(COMPOSE) logs -f endpoint-api
logs-db:
$(COMPOSE) logs -f postgres
logs-redis:
$(COMPOSE) logs -f redis
logs-opensearch:
$(COMPOSE) logs -f opensearch
# Legacy alias
logs: logs-all
# ============================================================================
# RESTART TARGETS
# ============================================================================
restart-all:
@echo "Restarting all services..."
$(COMPOSE) restart
@echo "✓ All services restarted"
restart-nginx:
@echo "Restarting nginx..."
$(COMPOSE) restart nginx
@echo "✓ nginx restarted"
restart-ui:
@echo "Restarting ui..."
$(COMPOSE) restart ui
@echo "✓ ui restarted"
restart-web:
@echo "Restarting web-api..."
$(COMPOSE) restart web-api
@echo "✓ web-api restarted"
restart-document:
@echo "Restarting document-api..."
$(COMPOSE) restart document-api
@echo "✓ document-api restarted"
restart-assistant:
@echo "Restarting assistant-api..."
$(COMPOSE) restart assistant-api
@echo "✓ assistant-api restarted"
restart-integration:
@echo "Restarting integration-api..."
$(COMPOSE) restart integration-api
@echo "✓ integration-api restarted"
restart-endpoint:
@echo "Restarting endpoint-api..."
$(COMPOSE) restart endpoint-api
@echo "✓ endpoint-api restarted"
# Legacy alias
restart: restart-all
# ============================================================================
# STATUS TARGETS
# ============================================================================
ps-all:
@echo ""
@echo "Running Containers:"
@echo "==================="
$(COMPOSE) ps
@echo ""
status: ps-all
@echo "Service Ports:"
@echo "=============="
@echo " UI: http://localhost:3000"
@echo " Web-API: http://localhost:9001"
@echo " Integration-API: http://localhost:9004"
@echo " Endpoint-API: http://localhost:9005"
@echo " PostgreSQL: localhost:5432"
@echo " Redis: localhost:6379"
@echo " OpenSearch: https://localhost:9200"
@echo ""
ps: ps-all
# ============================================================================
# SHELL/ACCESS TARGETS
# ============================================================================
shell-ui:
$(COMPOSE) exec ui sh
shell-nginx:
$(COMPOSE) exec nginx sh
shell-assistant:
$(COMPOSE) exec assistant-api sh
shell-document:
$(COMPOSE) exec document-api sh
shell-web:
$(COMPOSE) exec web-api sh
shell-integration:
$(COMPOSE) exec integration-api sh
shell-endpoint:
$(COMPOSE) exec endpoint-api sh
shell-db:
$(COMPOSE) exec postgres psql -U rapida_user -d web_db
# Legacy alias
shell: shell-web
# ============================================================================
# MAINTENANCE TARGETS
# ============================================================================
clean-volumes:
@echo "Removing volumes..."
$(COMPOSE) down -v
@echo "✓ Volumes removed"
clean:
@echo "Cleaning up Docker resources..."
$(COMPOSE) down -v
@echo "Removing built images..."
docker rmi $$(docker images | grep -E '(web-api|integration-api|endpoint-api)' | awk '{print $$3}') 2>/dev/null || true
@echo "✓ Cleanup complete"
# ============================================================================
# QUICK DEVELOPMENT COMMANDS
# ============================================================================
# Start all dependencies (db, redis, opensearch) without APIs
deps:
@echo "Starting dependencies only..."
$(COMPOSE) up -d postgres redis opensearch
@echo "✓ Dependencies started"
# Start full stack with UI
full: build-all up-all
# Development mode - start with rebuild
dev: rebuild-all up-all logs-all
# ============================================================================
# RUN WITHOUT DOCKER TARGETS
# ============================================================================
run-document:
@echo "Running document-api without Docker..."
PYTHONPATH=api/document-api uvicorn app.main:app --host 0.0.0.0 --port 9010
run-assistant:
@echo "Running assistant-api without Docker..."
go run cmd/assistant/assistant.go
run-web:
@echo "Running web-api without Docker..."
go run cmd/web/web.go
run-endpoint:
@echo "Running endpoint-api without Docker..."
go run cmd/endpoint/endpoint.go
run-integration:
@echo "Running integration-api without Docker..."
go run cmd/integration/integration.go
run-ui:
@echo "Running UI with yarn start in ui folder..."
cd ui && yarn start
# Add appropriate aliases for clarity
run-{service-name}:
@echo "Please specify a valid service name: document-api, assistant, web, endpoint, or integration."