-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
127 lines (109 loc) · 3.24 KB
/
setup.sh
File metadata and controls
127 lines (109 loc) · 3.24 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
#!/bin/bash
# Web Compiler Quick Start Script
# This script sets up and starts the development environment
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}"
echo "=========================================="
echo " Web Compiler - Quick Start Setup"
echo "=========================================="
echo -e "${NC}"
# Check prerequisites
echo -e "${YELLOW}Checking prerequisites...${NC}"
# Check Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js is not installed${NC}"
echo "Install from: https://nodejs.org/en/"
exit 1
fi
NODE_VERSION=$(node --version)
echo -e "${GREEN}✓ Node.js ${NODE_VERSION}${NC}"
# Check npm
if ! command -v npm &> /dev/null; then
echo -e "${RED}❌ npm is not installed${NC}"
exit 1
fi
NPM_VERSION=$(npm --version)
echo -e "${GREEN}✓ npm ${NPM_VERSION}${NC}"
# Check Docker
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Docker is not installed${NC}"
echo "Install from: https://www.docker.com/products/docker-desktop"
exit 1
fi
DOCKER_VERSION=$(docker --version)
echo -e "${GREEN}✓ ${DOCKER_VERSION}${NC}"
# Check Docker daemon
if ! docker ps &> /dev/null; then
echo -e "${RED}❌ Docker daemon is not running${NC}"
echo "Please start Docker and try again"
exit 1
fi
echo -e "${GREEN}✓ Docker daemon is running${NC}"
# Setup backend
echo -e "\n${YELLOW}Setting up backend...${NC}"
cd backend
if [ ! -d "node_modules" ]; then
echo "Installing backend dependencies..."
npm install
echo -e "${GREEN}✓ Backend dependencies installed${NC}"
else
echo -e "${GREEN}✓ Backend dependencies already installed${NC}"
fi
if [ ! -f ".env" ]; then
cp .env.example .env
echo -e "${GREEN}✓ Created .env from template${NC}"
fi
cd ..
# Setup frontend
echo -e "\n${YELLOW}Setting up frontend...${NC}"
cd frontend
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
echo -e "${GREEN}✓ Frontend dependencies installed${NC}"
else
echo -e "${GREEN}✓ Frontend dependencies already installed${NC}"
fi
cd ..
# Pull Docker images
echo -e "\n${YELLOW}Pulling required Docker images...${NC}"
IMAGES=(
"python:3.11-slim"
"node:18-slim"
"gcc:11-bullseye"
"eclipse-temurin:17-jdk-alpine"
"mcr.microsoft.com/dotnet/sdk:6.0-alpine"
"rust:1.70-slim"
"golang:1.20-alpine"
"mileschou/lua:5.1-alpine"
"rocker/r-base:latest"
)
for image in "${IMAGES[@]}"; do
echo "Pulling $image..."
docker pull "$image" > /dev/null 2>&1 || echo " ⚠ Failed to pull $image (may already exist)"
done
echo -e "${GREEN}✓ Docker images ready${NC}"
# Summary and next steps
echo -e "\n${GREEN}=========================================="
echo " Setup Complete! 🎉"
echo "==========================================${NC}"
echo ""
echo "To start the development servers, run:"
echo ""
echo -e "${BLUE}Terminal 1 (Backend):${NC}"
echo " cd backend && npm run dev"
echo ""
echo -e "${BLUE}Terminal 2 (Frontend):${NC}"
echo " cd frontend && npm run dev"
echo ""
echo "Then open http://localhost:3000 in your browser"
echo ""
echo -e "${YELLOW}For Docker Compose deployment:${NC}"
echo " docker-compose up --build"
echo ""