-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dev.sh
More file actions
executable file
·97 lines (78 loc) · 2.57 KB
/
start-dev.sh
File metadata and controls
executable file
·97 lines (78 loc) · 2.57 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
#!/bin/bash
# Development startup script for Data Workflow Platform
echo "🚀 Starting Data Workflow Platform Development Environment"
echo "=========================================================="
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker first."
exit 1
fi
# Start Docker services
echo ""
echo "📦 Starting Docker services (PostgreSQL, Redis, MinIO)..."
docker-compose up -d postgres redis minio
echo "⏳ Waiting for services to be ready..."
sleep 10
# Check if backend virtual environment exists
if [ ! -d "backend/.venv" ]; then
echo "❌ Backend virtual environment not found."
echo "Please run: cd backend && python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt"
exit 1
fi
# Start backend in background
echo ""
echo "🐍 Starting Backend (FastAPI)..."
cd backend
source .venv/bin/activate
# Set environment variables
export DATABASE_URL="postgresql://workflow_user:workflow_pass@localhost:5432/workflow_db"
export SECRET_KEY="dev-secret-key-change-in-production-min-32-chars"
export ENVIRONMENT="development"
# Run migrations
echo "📊 Running database migrations..."
alembic upgrade head
# Start backend server in background
echo "🌐 Starting FastAPI server on http://localhost:8000"
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 > ../backend.log 2>&1 &
BACKEND_PID=$!
echo "Backend PID: $BACKEND_PID"
cd ..
# Wait for backend to start
echo "⏳ Waiting for backend to start..."
sleep 5
# Start frontend
echo ""
echo "⚛️ Starting Frontend (React + Vite)..."
cd frontend
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo "📦 Installing frontend dependencies..."
npm install
fi
# Create .env if it doesn't exist
if [ ! -f ".env" ]; then
echo "📝 Creating frontend .env file..."
echo "VITE_API_BASE_URL=http://localhost:8000/api/v1" > .env
fi
echo "🌐 Starting Vite dev server on http://localhost:5173"
npm run dev > ../frontend.log 2>&1 &
FRONTEND_PID=$!
echo "Frontend PID: $FRONTEND_PID"
cd ..
# Save PIDs for cleanup
echo "$BACKEND_PID" > .backend.pid
echo "$FRONTEND_PID" > .frontend.pid
echo ""
echo "✅ Development environment started successfully!"
echo ""
echo "📍 Services:"
echo " - Frontend: http://localhost:5173"
echo " - Backend: http://localhost:8000"
echo " - API Docs: http://localhost:8000/docs"
echo ""
echo "📝 Logs:"
echo " - Backend: tail -f backend.log"
echo " - Frontend: tail -f frontend.log"
echo ""
echo "🛑 To stop all services, run: ./stop-dev.sh"
echo ""