| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- # Quick Start Script for Spring Cloud Log Demo System (PowerShell)
- Write-Host "================================" -ForegroundColor Cyan
- Write-Host "Spring Cloud Log Demo - Quick Start" -ForegroundColor Cyan
- Write-Host "================================" -ForegroundColor Cyan
- Write-Host ""
- # Check prerequisites
- Write-Host "[1/5] Checking prerequisites..." -ForegroundColor Yellow
- $errorCount = 0
- if (-not (Get-Command java -ErrorAction SilentlyContinue)) {
- Write-Host "ERROR: Java is not installed" -ForegroundColor Red
- $errorCount++
- } else {
- $javaVersion = java -version 2>&1 | Select-Object -First 1
- Write-Host "✓ Java: $javaVersion" -ForegroundColor Green
- }
- if (-not (Get-Command mvn -ErrorAction SilentlyContinue)) {
- Write-Host "ERROR: Maven is not installed" -ForegroundColor Red
- $errorCount++
- } else {
- $mvnVersion = mvn -v 2>&1 | Select-Object -First 1
- Write-Host "✓ Maven: $mvnVersion" -ForegroundColor Green
- }
- if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
- Write-Host "ERROR: Node.js is not installed" -ForegroundColor Red
- $errorCount++
- } else {
- $nodeVersion = node -v
- Write-Host "✓ Node: $nodeVersion" -ForegroundColor Green
- }
- if ($errorCount -gt 0) {
- Write-Host "Please install missing prerequisites" -ForegroundColor Red
- exit 1
- }
- Write-Host ""
- # Build backend
- Write-Host "[2/5] Building backend services..." -ForegroundColor Yellow
- mvn clean install -DskipTests | Out-Null
- Write-Host "✓ Backend build completed" -ForegroundColor Green
- Write-Host ""
- # Start services
- Write-Host "[3/5] Starting backend services..." -ForegroundColor Yellow
- Write-Host " - Gateway (port 8080)" -ForegroundColor White
- Push-Location shop-recycle-gateway
- Start-Process mvn -ArgumentList "spring-boot:run" -WindowStyle Minimized
- Write-Host " Started" -ForegroundColor Green
- Pop-Location
- Start-Sleep -Seconds 3
- Write-Host " - Order Service (port 8081)" -ForegroundColor White
- Push-Location shop-recycle-order-service
- Start-Process mvn -ArgumentList "spring-boot:run" -WindowStyle Minimized
- Write-Host " Started" -ForegroundColor Green
- Pop-Location
- Write-Host " - Payment Service (port 8082)" -ForegroundColor White
- Push-Location shop-recycle-payment-service
- Start-Process mvn -ArgumentList "spring-boot:run" -WindowStyle Minimized
- Write-Host " Started" -ForegroundColor Green
- Pop-Location
- Start-Sleep -Seconds 5
- Write-Host "✓ All backend services started" -ForegroundColor Green
- Write-Host ""
- # Frontend setup
- Write-Host "[4/5] Installing frontend dependencies..." -ForegroundColor Yellow
- Push-Location shop-recycle-web
- npm install | Out-Null
- Write-Host "✓ Frontend dependencies installed" -ForegroundColor Green
- Pop-Location
- Write-Host ""
- Write-Host "[5/5] Starting frontend development server..." -ForegroundColor Yellow
- Push-Location shop-recycle-web
- Write-Host "Frontend will open in a new terminal..." -ForegroundColor Cyan
- Start-Process cmd -ArgumentList "/c npm run dev"
- Pop-Location
- Write-Host ""
- Write-Host "================================" -ForegroundColor Green
- Write-Host "✓ All services are running!" -ForegroundColor Green
- Write-Host "================================" -ForegroundColor Green
- Write-Host ""
- Write-Host "🌐 Frontend: http://localhost:5173" -ForegroundColor Cyan
- Write-Host "🔌 API Gateway: http://localhost:8080" -ForegroundColor Cyan
- Write-Host "📦 Order Service: http://localhost:8081/api" -ForegroundColor Cyan
- Write-Host "💰 Payment Service: http://localhost:8082/api" -ForegroundColor Cyan
- Write-Host ""
- Write-Host "📋 Check logs in the terminal windows that opened" -ForegroundColor Yellow
- Write-Host ""
- Write-Host "💡 Tips:" -ForegroundColor Yellow
- Write-Host " 1. Open http://localhost:5173 in your browser" -ForegroundColor White
- Write-Host " 2. Create an order and complete payment" -ForegroundColor White
- Write-Host " 3. Watch the structured JSON logs in backend terminals" -ForegroundColor White
- Write-Host " 4. Observe traceId, uri_group, event_class, duration fields" -ForegroundColor White
- Write-Host ""
|