-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (94 loc) · 3.45 KB
/
Makefile
File metadata and controls
108 lines (94 loc) · 3.45 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
# GuPT Makefile
# Cross-platform setup for GuPT RAG System
.PHONY: help install setup clean test run docker-build docker-run docker-stop docker-clean docker-logs docker-restart docker-shell
# Default target
help:
@echo "GuPT - Gothenburg University RAG System"
@echo "========================================"
@echo ""
@echo "🐳 Docker Commands (Recommended - Simple & Universal):"
@echo " make docker-build - Build Docker image"
@echo " make docker-run - Run with Docker Compose"
@echo " make docker-stop - Stop Docker containers"
@echo " make docker-clean - Remove Docker containers and images"
@echo " make docker-logs - View application logs"
@echo ""
@echo "📦 Conda Commands (Development Environment):"
@echo " make install - Create conda environment and install dependencies"
@echo " make setup - Complete setup (environment + .env file)"
@echo " make clean - Remove conda environment"
@echo " make test - Test the installation"
@echo " make run - Run the application"
@echo ""
# Install dependencies
install:
@echo "📦 Creating conda environment..."
conda env create -f environment.yml
@echo "✅ Environment created! Activate with: conda activate gupt"
# Complete setup
setup: install
@echo "📝 Setting up environment file..."
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "✅ .env file created from .env.example"; \
echo "⚠️ Please edit .env and add your OpenAI API key"; \
else \
echo "⚠️ .env file already exists"; \
fi
@echo ""
@echo "🎯 Setup complete! Next steps:"
@echo "1. conda activate gupt"
@echo "2. Edit .env file with your API keys"
@echo "3. make run"
# Clean up
clean:
@echo "🧹 Removing conda environment..."
conda env remove -n gupt
@echo "✅ Environment removed"
# Test installation
test:
@echo "🧪 Testing installation..."
@echo "⚠️ Make sure to run: conda activate gupt"
@echo "Then manually test with: python -c \"import langchain, openai, gradio, chromadb, posthog; print('✅ All packages imported successfully')\""
@echo "✅ Test instructions provided!"
# Run the application
run:
@echo "🚀 Starting GuPT..."
@echo "⚠️ Make sure to run: conda activate gupt"
@echo "Then run: python src/main.py"
# Docker commands
docker-build:
@echo "🐳 Building Docker image..."
docker build -t gupt:latest .
@echo "✅ Docker image built successfully!"
docker-run:
@echo "🚀 Starting GuPT with Docker Compose..."
@if [ ! -f .env ]; then \
echo "⚠️ .env file not found. Creating from template..."; \
cp .env.example .env; \
echo "🔧 Please edit .env file with your OpenAI API key"; \
echo "Then run 'make docker-run' again"; \
exit 1; \
fi
docker compose up -d
@echo "✅ GuPT is running at http://localhost:7860"
docker-stop:
@echo "🛑 Stopping Docker containers..."
docker compose down
docker-clean:
@echo "🧹 Cleaning up Docker containers and images..."
docker compose down --rmi all --volumes --remove-orphans
@echo "🗑️ Removing GuPT images..."
-docker rmi gupt:latest gupt-app:latest 2>/dev/null || true
@echo "🧹 Cleaning up unused Docker resources..."
docker system prune -f
@echo "✅ Docker cleanup completed!"
docker-logs:
@echo "📋 Viewing application logs..."
docker compose logs -f gupt
docker-restart:
@echo "🔄 Restarting Docker containers..."
docker compose restart
docker-shell:
@echo "🐚 Opening shell in Docker container..."
docker compose exec gupt bash