-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
70 lines (63 loc) · 2.75 KB
/
start.ps1
File metadata and controls
70 lines (63 loc) · 2.75 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
# Smart FAQ Assistant - Quick Start Script
# This script helps you start all services quickly
Write-Host "🚀 Smart FAQ Assistant - Quick Start" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
# Check if Docker is running
Write-Host "1️⃣ Checking Docker..." -ForegroundColor Yellow
try {
docker ps | Out-Null
Write-Host "✅ Docker is running" -ForegroundColor Green
} catch {
Write-Host "❌ Docker is not running. Please start Docker Desktop first." -ForegroundColor Red
exit 1
}
# Check if Cosdata container exists
Write-Host ""
Write-Host "2️⃣ Checking Cosdata..." -ForegroundColor Yellow
$cosdataRunning = docker ps --filter "name=cosdata-server" --format "{{.Names}}"
if ($cosdataRunning -eq "cosdata-server") {
Write-Host "✅ Cosdata is already running" -ForegroundColor Green
} else {
$cosdataExists = docker ps -a --filter "name=cosdata-server" --format "{{.Names}}"
if ($cosdataExists -eq "cosdata-server") {
Write-Host "⚠️ Cosdata container exists but is stopped. Starting..." -ForegroundColor Yellow
docker start cosdata-server
Start-Sleep -Seconds 3
Write-Host "✅ Cosdata started" -ForegroundColor Green
} else {
Write-Host "📦 Creating Cosdata container..." -ForegroundColor Yellow
docker run -d --name cosdata-server -p 8443:8443 -p 50051:50051 cosdataio/cosdata:latest
Start-Sleep -Seconds 5
Write-Host "✅ Cosdata created and started" -ForegroundColor Green
}
}
# Test Cosdata health
Write-Host ""
Write-Host "3️⃣ Testing Cosdata health..." -ForegroundColor Yellow
Start-Sleep -Seconds 2
try {
$health = Invoke-RestMethod -Uri "http://localhost:8443/health" -ErrorAction Stop
Write-Host "✅ Cosdata is healthy" -ForegroundColor Green
} catch {
Write-Host "⚠️ Cosdata may still be starting up. Give it a few seconds..." -ForegroundColor Yellow
}
# Instructions
Write-Host ""
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host "✅ All services ready!" -ForegroundColor Green
Write-Host ""
Write-Host "📝 Next Steps:" -ForegroundColor Cyan
Write-Host ""
Write-Host "Terminal 1 - Start Backend:" -ForegroundColor Yellow
Write-Host " cd backend" -ForegroundColor White
Write-Host " npm run dev" -ForegroundColor White
Write-Host ""
Write-Host "Terminal 2 - Start Frontend:" -ForegroundColor Yellow
Write-Host " cd frontend" -ForegroundColor White
Write-Host " npm run dev" -ForegroundColor White
Write-Host ""
Write-Host "Then open: http://localhost:5173" -ForegroundColor Green
Write-Host ""
Write-Host "🛑 To stop Cosdata: docker stop cosdata-server" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan