-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
141 lines (112 loc) · 3.26 KB
/
Copy pathsetup.sh
File metadata and controls
141 lines (112 loc) · 3.26 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
#!/bin/bash
# CodeForge AI - Automated Setup Script
# This script sets up the complete development environment
set -e # Exit on any error
echo "🚀 CodeForge AI - Automated Setup"
echo "=================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo -e "${RED}Please do not run this script as root${NC}"
exit 1
fi
echo "🔍 Checking prerequisites..."
# Check Python
if ! command -v python3 &> /dev/null; then
echo -e "${RED}❌ Python 3 is not installed${NC}"
exit 1
fi
echo -e "${GREEN}✓ Python 3 found${NC}"
# Check Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js is not installed${NC}"
exit 1
fi
echo -e "${GREEN}✓ Node.js found${NC}"
# Check PostgreSQL
if ! command -v psql &> /dev/null; then
echo -e "${YELLOW}⚠ PostgreSQL not found. Installing...${NC}"
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
fi
echo -e "${GREEN}✓ PostgreSQL found${NC}"
echo ""
echo "📦 Setting up database..."
# Start PostgreSQL if not running
sudo systemctl start postgresql
# Create database and user
echo "Creating database and user..."
sudo -u postgres psql -f database/init.sql || echo "Database may already exist"
echo -e "${GREEN}✓ Database setup complete${NC}"
echo ""
echo "🐍 Setting up Python backend..."
cd backend
# Create virtual environment
if [ ! -d "venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Upgrade pip
pip install --upgrade pip
# Install dependencies
echo "Installing Python dependencies..."
pip install -r requirements.txt
# Create .env if doesn't exist
if [ ! -f ".env" ]; then
echo "Creating .env file..."
cp .env.example .env
echo -e "${YELLOW}⚠ Please edit backend/.env with your API credentials${NC}"
fi
echo -e "${GREEN}✓ Backend setup complete${NC}"
cd ..
echo ""
echo "⚛️ Setting up React frontend..."
cd frontend
# Install dependencies
echo "Installing Node.js dependencies..."
npm install
# Create .env.local if doesn't exist
if [ ! -f ".env.local" ]; then
echo "Creating .env.local file..."
cp .env.local.example .env.local
fi
echo -e "${GREEN}✓ Frontend setup complete${NC}"
cd ..
echo ""
echo -e "${GREEN}✓✓✓ Setup complete! ✓✓✓${NC}"
echo ""
echo "=================================="
echo "📝 Next Steps:"
echo "=================================="
echo ""
echo "1. Configure API credentials:"
echo " ${YELLOW}nano backend/.env${NC}"
echo ""
echo " Required:"
echo " - VENICE_API_KEY"
echo " - VENICE_API_SECRET"
echo " - GITHUB_PERSONAL_ACCESS_TOKEN"
echo " - GITHUB_USERNAME"
echo ""
echo "2. Start the backend server:"
echo " ${GREEN}cd backend${NC}"
echo " ${GREEN}source venv/bin/activate${NC}"
echo " ${GREEN}python main.py${NC}"
echo ""
echo "3. In a new terminal, start the frontend:"
echo " ${GREEN}cd frontend${NC}"
echo " ${GREEN}npm run dev${NC}"
echo ""
echo "4. Open your browser:"
echo " ${GREEN}http://localhost:3000${NC}"
echo ""
echo "=================================="
echo "🚀 Happy coding with CodeForge AI!"
echo "=================================="