35 lines
1.6 KiB
PowerShell
35 lines
1.6 KiB
PowerShell
param (
|
|
[string]$Port = "3000"
|
|
)
|
|
$HealthUrl = "http://127.0.0.1:$Port/ping"
|
|
$UiUrl = "http://127.0.0.1:$Port/?t=$(Get-Random)"
|
|
$ExpectedContent = "open-color" # Basic sanity check that we are serving the updated UI
|
|
|
|
Write-Host "Verifying server HEALTH at http://127.0.0.1:$Port/health..." -ForegroundColor Cyan
|
|
|
|
for ($i = 1; $i -le 40; $i++) {
|
|
try {
|
|
$healthResponse = Invoke-RestMethod -Uri "http://127.0.0.1:$Port/health" -UseBasicParsing -ErrorAction Stop
|
|
if ($healthResponse.status -eq "ok") {
|
|
$ver = $healthResponse.version
|
|
Write-Host "✅ Server /health is UP! Status: $($healthResponse.status.ToUpper()) (Attempt $i)" -ForegroundColor Green
|
|
Write-Host " Running Build Version: $($ver.app_version) [$($ver.target_os)/$($ver.target_arch)]" -ForegroundColor Green
|
|
|
|
Write-Host "Verifying UI payload at $UiUrl..." -ForegroundColor Cyan
|
|
$uiResponse = Invoke-WebRequest -Uri $UiUrl -UseBasicParsing -ErrorAction Stop
|
|
if ($uiResponse.Content -match $ExpectedContent) {
|
|
Write-Host "✅ Server is serving the correct UI payload!" -ForegroundColor Green
|
|
exit 0
|
|
} else {
|
|
Write-Host "⚠️ Server is healthy but UI serving old cached content. Retrying..." -ForegroundColor Yellow
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Host "⏳ Server /health not responding yet... (Attempt $i)" -ForegroundColor Yellow
|
|
}
|
|
Start-Sleep -Seconds 1
|
|
}
|
|
|
|
Write-Error "❌ Deployment verification failed! /ping endpoint unreachable after 40 seconds."
|
|
exit 1
|