-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (87 loc) · 3.81 KB
/
Makefile
File metadata and controls
100 lines (87 loc) · 3.81 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
.PHONY: deploy_presentation_app setup_volumes setup_network start_services start_main stop clean help
# Default target
help:
@echo "Available targets:"
@echo " make deploy_presentation_app - Deploy the complete presentation application"
@echo " make setup_volumes - Create required Docker volumes if they don't exist"
@echo " make setup_network - Create required Docker network if it doesn't exist"
@echo " make start_services - Start supporting services (postgres, pgadmin, langfuse)"
@echo " make start_main - Start main bot API service"
@echo " make stop - Stop all services"
@echo " make clean - Stop services and remove containers"
@echo " make logs - Show logs from all services"
# Main deployment target
deploy_presentation_app: setup_network setup_volumes start_services start_main
@echo "✅ Presentation app deployment complete!"
@echo ""
@echo "Services are now running:"
@echo " - Bot API Service: http://localhost:8084"
@echo " - PostgreSQL: localhost:5432"
@echo " - PgAdmin: http://localhost:8021"
@echo " - Langfuse: http://localhost:3002"
@echo ""
@echo "ℹ️ Database migrations run automatically on container startup"
# Setup Docker volumes (only if they don't exist)
setup_volumes:
@echo "📦 Checking and creating required Docker volumes..."
@docker volume inspect postgres_data >/dev/null 2>&1 || \
(echo "Creating volume: postgres_data" && docker volume create postgres_data)
@docker volume inspect pgadmin_data >/dev/null 2>&1 || \
(echo "Creating volume: pgadmin_data" && docker volume create pgadmin_data)
@echo "✅ Volumes ready"
# Setup Docker network (only if it doesn't exist)
setup_network:
@echo "🌐 Checking and creating required Docker network..."
@docker network inspect llm-network >/dev/null 2>&1 || \
(echo "Creating network: llm-network" && docker network create llm-network)
@echo "✅ Network ready"
# Start supporting services (postgres, pgadmin, langfuse)
start_services:
@echo "🚀 Starting supporting services..."
docker compose -f docker-compose-services.yml up -d
@echo "✅ Supporting services started"
# Start main bot API service
start_main:
@echo "🛑 Stopping existing main service if running..."
-docker compose -f docker-compose-main.yml down
@echo "🧹 Cleaning Docker build cache (older than 10 days)..."
-docker builder prune -f --filter until=240h
-docker buildx prune -f --filter until=240h
-docker image prune -a -f --filter until=240h
@echo "🚀 Building and starting main bot API service..."
docker compose -f docker-compose-main.yml up --build -d
@echo "⏳ Waiting for service to be healthy..."
@sleep 5
@echo "✅ Main service started"
# Stop all services
stop:
@echo "🛑 Stopping all services..."
-docker compose -f docker-compose-main.yml down
-docker compose -f docker-compose-services.yml down
@echo "✅ All services stopped"
# Clean up (stop and remove containers)
clean: stop
@echo "🧹 Cleaning up Docker resources..."
@docker compose -f docker-compose-main.yml down -v
@docker compose -f docker-compose-services.yml down
@echo "✅ Cleanup complete"
# Show logs from all services
logs:
@echo "📋 Showing logs (Ctrl+C to exit)..."
docker compose -f docker-compose-services.yml logs -f &
docker compose -f docker-compose-main.yml logs -f
# Restart the entire application
restart: stop deploy_presentation_app
# Check status of services
status:
@echo "📊 Service Status:"
@echo ""
@docker compose -f docker-compose-services.yml ps
@echo ""
@docker compose -f docker-compose-main.yml ps
# Rebuild and redeploy main service only
redeploy_main:
@echo "🔄 Redeploying main service..."
docker compose -f docker-compose-main.yml down
docker compose -f docker-compose-main.yml up --build -d
@echo "✅ Main service redeployed"