| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #!/bin/bash
- # Quick Start Script for Spring Cloud Log Demo System
- set -e
- echo "================================"
- echo "Spring Cloud Log Demo - Quick Start"
- echo "================================"
- echo ""
- # Check prerequisites
- echo "[1/5] Checking prerequisites..."
- if ! command -v java &> /dev/null; then
- echo "ERROR: Java is not installed"
- exit 1
- fi
- if ! command -v mvn &> /dev/null; then
- echo "ERROR: Maven is not installed"
- exit 1
- fi
- if ! command -v node &> /dev/null; then
- echo "ERROR: Node.js is not installed"
- exit 1
- fi
- echo "✓ Java version: $(java -version 2>&1 | head -1)"
- echo "✓ Maven version: $(mvn -v | head -1)"
- echo "✓ Node version: $(node -v)"
- echo ""
- # Build backend
- echo "[2/5] Building backend services..."
- mvn clean install -DskipTests > /dev/null
- echo "✓ Backend build completed"
- echo ""
- # Start services in background
- echo "[3/5] Starting backend services..."
- echo " - Gateway (port 8080)"
- cd shop-recycle-gateway
- mvn spring-boot:run > /tmp/gateway.log 2>&1 &
- GATEWAY_PID=$!
- echo " Started with PID $GATEWAY_PID"
- sleep 3
- echo " - Order Service (port 8081)"
- cd ../shop-recycle-order-service
- mvn spring-boot:run > /tmp/order.log 2>&1 &
- ORDER_PID=$!
- echo " Started with PID $ORDER_PID"
- echo " - Payment Service (port 8082)"
- cd ../shop-recycle-payment-service
- mvn spring-boot:run > /tmp/payment.log 2>&1 &
- PAYMENT_PID=$!
- echo " Started with PID $PAYMENT_PID"
- sleep 5
- echo "✓ All backend services started"
- echo ""
- # Start frontend
- echo "[4/5] Installing frontend dependencies..."
- cd ../shop-recycle-web
- npm install > /dev/null 2>&1
- echo "✓ Frontend dependencies installed"
- echo ""
- echo "[5/5] Starting frontend development server..."
- npm run dev &
- FRONTEND_PID=$!
- echo "✓ Frontend started with PID $FRONTEND_PID"
- echo ""
- echo "================================"
- echo "✓ All services are running!"
- echo "================================"
- echo ""
- echo "🌐 Frontend: http://localhost:5173"
- echo "🔌 API Gateway: http://localhost:8080"
- echo "📦 Order Service: http://localhost:8081/api"
- echo "💰 Payment Service: http://localhost:8082/api"
- echo ""
- echo "📋 Backend logs:"
- echo " - Gateway: tail -f /tmp/gateway.log"
- echo " - Order: tail -f /tmp/order.log"
- echo " - Payment: tail -f /tmp/payment.log"
- echo ""
- echo "🛑 To stop all services, run: pkill -f maven; kill $FRONTEND_PID"
- echo ""
|