-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
74 lines (60 loc) · 1.92 KB
/
setup.sh
File metadata and controls
74 lines (60 loc) · 1.92 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
#!/bin/bash
echo "========================================"
echo "AI Knowledge Copilot - Setup Script"
echo "========================================"
echo ""
echo "[1/4] Setting up backend..."
cd backend
echo "Creating Python virtual environment..."
python3 -m venv venv
if [ $? -ne 0 ]; then
echo "Error: Failed to create virtual environment"
exit 1
fi
echo "Activating virtual environment..."
source venv/bin/activate
echo "Installing backend dependencies..."
pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "Error: Failed to install backend dependencies"
exit 1
fi
echo "Creating .env file from example..."
if [ ! -f .env ]; then
cp .env.example .env
echo "Please edit backend/.env with your configuration"
fi
echo "Creating data directory..."
mkdir -p data
cd ..
echo ""
echo "[2/4] Setting up frontend..."
cd frontend
echo "Installing frontend dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "Error: Failed to install frontend dependencies"
exit 1
fi
echo "Creating .env.local file from example..."
if [ ! -f .env.local ]; then
cp .env.local.example .env.local
fi
cd ..
echo ""
echo "[3/4] Generating encryption key..."
python3 -c "from cryptography.fernet import Fernet; print('ENCRYPTION_KEY=' + Fernet.generate_key().decode())" > encryption_key.txt
echo "Encryption key saved to encryption_key.txt"
echo "Please add this to your backend/.env file"
echo ""
echo "[4/4] Setup complete!"
echo ""
echo "========================================"
echo "Next Steps:"
echo "========================================"
echo "1. Edit backend/.env with your configuration"
echo "2. Add the encryption key from encryption_key.txt to backend/.env"
echo "3. Start backend: cd backend && source venv/bin/activate && uvicorn src.main:app --reload"
echo "4. Start frontend: cd frontend && npm run dev"
echo "5. Open http://localhost:3000 in your browser"
echo "========================================"