-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·151 lines (126 loc) · 3.58 KB
/
setup.sh
File metadata and controls
executable file
·151 lines (126 loc) · 3.58 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
#!/bin/bash
# Algo Cloud IDE - Setup Script
# This script sets up the development environment
set -e
echo "=========================================="
echo " Algo Cloud IDE - Development Setup"
echo "=========================================="
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Function to print colored messages
print_success() {
echo -e "${GREEN}✓ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠ $1${NC}"
}
print_error() {
echo -e "${RED}✗ $1${NC}"
}
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
print_error "Docker is not installed. Please install Docker first."
exit 1
fi
print_success "Docker is installed"
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
print_error "Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
print_success "Docker Compose is installed"
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
print_warning "Node.js is not installed. Some features may not work."
else
NODE_VERSION=$(node -v)
print_success "Node.js $NODE_VERSION is installed"
fi
echo ""
echo "Step 1: Setting up environment variables..."
# Copy .env.example to .env if it doesn't exist
if [ ! -f .env ]; then
cp .env.example .env
print_success "Created .env file from .env.example"
print_warning "Please update .env file with your configuration"
else
print_warning ".env file already exists, skipping..."
fi
echo ""
echo "Step 2: Creating necessary directories..."
# Create directories
mkdir -p backend/logs
mkdir -p frontend/.next
mkdir -p data/git-repos
mkdir -p data/postgres
mkdir -p data/redis
mkdir -p data/mongodb
mkdir -p data/minio
print_success "Directories created"
echo ""
echo "Step 3: Installing dependencies..."
# Install root dependencies
if [ -f package.json ]; then
npm install
print_success "Root dependencies installed"
fi
# Install frontend dependencies
if [ -d frontend ] && [ -f frontend/package.json ]; then
echo "Installing frontend dependencies..."
cd frontend
npm install
cd ..
print_success "Frontend dependencies installed"
fi
# Install backend dependencies
if [ -d backend ] && [ -f backend/package.json ]; then
echo "Installing backend dependencies..."
cd backend
npm install
cd ..
print_success "Backend dependencies installed"
fi
echo ""
echo "Step 4: Starting Docker services..."
# Start Docker Compose services
docker-compose up -d
print_success "Docker services started"
echo ""
echo "Waiting for services to be ready..."
sleep 10
# Check if services are running
if docker-compose ps | grep -q "Up"; then
print_success "Services are running"
else
print_error "Some services failed to start"
echo "Run 'docker-compose logs' to see the error details"
exit 1
fi
echo ""
echo "=========================================="
echo " Setup Complete!"
echo "=========================================="
echo ""
echo "Services are running at:"
echo " Frontend: http://localhost:3000"
echo " Backend API: http://localhost:4000"
echo " MinIO: http://localhost:9001"
echo ""
echo "Database connections:"
echo " PostgreSQL: localhost:5432"
echo " Redis: localhost:6379"
echo " MongoDB: localhost:27017"
echo ""
echo "To start development:"
echo " cd frontend && npm run dev # Start frontend"
echo " cd backend && npm run dev # Start backend"
echo ""
echo "To stop services:"
echo " docker-compose down"
echo ""
echo "For more information, see README.md"
echo ""