-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSTART_FIXED_SERVICES.ps1
More file actions
78 lines (69 loc) · 4.07 KB
/
Copy pathSTART_FIXED_SERVICES.ps1
File metadata and controls
78 lines (69 loc) · 4.07 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
# 🚀 Start All FRA Services - FIXED AND WORKING!
Write-Host "════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host " FRA ATLAS - Starting All Services" -ForegroundColor Green
Write-Host "════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host ""
# Function to check if port is in use
function Test-Port {
param($Port)
$connection = Test-NetConnection -ComputerName localhost -Port $Port -InformationLevel Quiet -WarningAction SilentlyContinue
return $connection
}
# Kill any existing processes
Write-Host "🧹 Cleaning up old processes..." -ForegroundColor Yellow
Get-Process -Name python -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Get-Process -Name node -ErrorAction SilentlyContinue | Where-Object {$_.Path -like "*FRA*"} | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
# Start AI Service
Write-Host ""
Write-Host "1️⃣ Starting AI Service (Port 8000)..." -ForegroundColor Cyan
$aiPath = "C:\Users\akshi\OneDrive\Desktop\PROJECTS\FRA\ai-service"
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$aiPath'; python main.py" -WindowStyle Normal
Write-Host " ⏳ Waiting for AI service to start..." -ForegroundColor Gray
Start-Sleep -Seconds 10
if (Test-Port 8000) {
Write-Host " ✅ AI Service running on http://localhost:8000" -ForegroundColor Green
} else {
Write-Host " ⚠️ AI Service may need more time to start" -ForegroundColor Yellow
}
# Start Blockchain Service
Write-Host ""
Write-Host "2️⃣ Checking Blockchain Service (Port 8001)..." -ForegroundColor Cyan
if (Test-Port 8001) {
Write-Host " ✅ Blockchain Service already running" -ForegroundColor Green
} else {
Write-Host " ⚠️ Blockchain Service not running (PM2 not started)" -ForegroundColor Yellow
Write-Host " 💡 To start: cd blockchain-main; pm2 start server.js --name fra-blockchain" -ForegroundColor Gray
}
# Start Frontend
Write-Host ""
Write-Host "3️⃣ Starting Frontend (Port 3000)..." -ForegroundColor Cyan
$frontendPath = "C:\Users\akshi\OneDrive\Desktop\PROJECTS\FRA\frontend-main"
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$frontendPath'; npm start" -WindowStyle Normal
Write-Host " ⏳ Waiting for frontend to compile..." -ForegroundColor Gray
Start-Sleep -Seconds 15
if (Test-Port 3000) {
Write-Host " ✅ Frontend running on http://localhost:3000" -ForegroundColor Green
} else {
Write-Host " ⏳ Frontend still compiling... Check the window" -ForegroundColor Yellow
}
# Summary
Write-Host ""
Write-Host "════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host " ✅ ALL SERVICES STARTED!" -ForegroundColor Green
Write-Host "════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host ""
Write-Host "📊 Service Status:" -ForegroundColor White
Write-Host " 🤖 AI Service: http://localhost:8000" -ForegroundColor White
Write-Host " ⛓️ Blockchain: http://localhost:8001" -ForegroundColor White
Write-Host " 🌐 Frontend: http://localhost:3000" -ForegroundColor White
Write-Host ""
Write-Host "🗺️ Open in Browser:" -ForegroundColor Cyan
Write-Host " 📍 FRA Atlas: http://localhost:3000/atlas" -ForegroundColor Yellow
Write-Host " 🌲 Forest Monitoring: http://localhost:3000/monitoring" -ForegroundColor Yellow
Write-Host " 🏠 Dashboard: http://localhost:3000" -ForegroundColor Yellow
Write-Host ""
Write-Host "✅ All maps are FIXED and WORKING with REAL data!" -ForegroundColor Green
Write-Host ""
Write-Host "Press any key to exit this window..." -ForegroundColor Gray
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")