70 lines
2.8 KiB
PowerShell
70 lines
2.8 KiB
PowerShell
|
|
# Health check script for FRP Manager (PowerShell)
|
|||
|
|
# This script checks if all services are running correctly
|
|||
|
|
|
|||
|
|
Write-Host "🔍 FRP Manager Health Check" -ForegroundColor Cyan
|
|||
|
|
Write-Host "==========================" -ForegroundColor Cyan
|
|||
|
|
|
|||
|
|
# Check if main application is running
|
|||
|
|
Write-Host "📡 Checking main application..." -ForegroundColor Yellow
|
|||
|
|
try {
|
|||
|
|
$response = Invoke-WebRequest -Uri "http://localhost:3000/health" -UseBasicParsing -TimeoutSec 5
|
|||
|
|
if ($response.StatusCode -eq 200) {
|
|||
|
|
Write-Host "✅ Main application is running" -ForegroundColor Green
|
|||
|
|
} else {
|
|||
|
|
Write-Host "❌ Main application returned status code: $($response.StatusCode)" -ForegroundColor Red
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
} catch {
|
|||
|
|
Write-Host "❌ Main application is not accessible: $($_.Exception.Message)" -ForegroundColor Red
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Check if API is responding
|
|||
|
|
Write-Host "🔌 Checking API endpoints..." -ForegroundColor Yellow
|
|||
|
|
try {
|
|||
|
|
$response = Invoke-WebRequest -Uri "http://localhost:3000/api/tunnels" -UseBasicParsing -TimeoutSec 5
|
|||
|
|
if ($response.StatusCode -eq 200) {
|
|||
|
|
Write-Host "✅ API is responding" -ForegroundColor Green
|
|||
|
|
} else {
|
|||
|
|
Write-Host "❌ API returned status code: $($response.StatusCode)" -ForegroundColor Red
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
} catch {
|
|||
|
|
Write-Host "❌ API is not responding: $($_.Exception.Message)" -ForegroundColor Red
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Check if FRPC container is running (if Docker is available)
|
|||
|
|
if (Get-Command docker -ErrorAction SilentlyContinue) {
|
|||
|
|
Write-Host "🐳 Checking FRPC container..." -ForegroundColor Yellow
|
|||
|
|
$dockerPs = docker ps 2>$null
|
|||
|
|
if ($dockerPs -and ($dockerPs | Select-String "frpc")) {
|
|||
|
|
Write-Host "✅ FRPC container is running" -ForegroundColor Green
|
|||
|
|
} else {
|
|||
|
|
Write-Host "⚠️ FRPC container is not running (this is expected in development)" -ForegroundColor Yellow
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
Write-Host "⚠️ Docker is not available, skipping FRPC container check" -ForegroundColor Yellow
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Check if database is accessible
|
|||
|
|
Write-Host "🗄️ Checking database..." -ForegroundColor Yellow
|
|||
|
|
if (Test-Path "./data/tunnels.db") {
|
|||
|
|
Write-Host "✅ Database file exists" -ForegroundColor Green
|
|||
|
|
} else {
|
|||
|
|
Write-Host "ℹ️ Database file doesn't exist yet (will be created on first use)" -ForegroundColor Blue
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Check if configuration directory exists
|
|||
|
|
Write-Host "📁 Checking configuration directory..." -ForegroundColor Yellow
|
|||
|
|
if (Test-Path "./data") {
|
|||
|
|
Write-Host "✅ Configuration directory exists" -ForegroundColor Green
|
|||
|
|
} else {
|
|||
|
|
Write-Host "❌ Configuration directory is missing" -ForegroundColor Red
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "🎉 Health check completed successfully!" -ForegroundColor Green
|
|||
|
|
Write-Host "👉 Open http://localhost:3000 to access the FRP Manager" -ForegroundColor Cyan
|