fix(scripts): update justfile and verify_deployment script to check /health version

This commit is contained in:
Riz Ashraf committed 2026-10-05 09:59:30 +01:00
1 parent cb39f94584
commit 9f10984c18
2 files changed
+8 -6

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ stop port="3000":
# Start the server in the background (nohup equivalent) # Start the server in the background (nohup equivalent)
start port="3000": start port="3000":
@if (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue) { Write-Host '⚠️ Server is already running on port {{port}}. Skipping start.' -ForegroundColor Yellow; exit 0 }; Write-Host 'Starting MCP server in background on port {{port}}...' -ForegroundColor Cyan; $env:MCP_PORT='{{port}}'; $env:MCP_UDP_PORT1=$([int]{{port}} + 1); $env:MCP_UDP_PORT2=$([int]{{port}} + 2); .\start_server.ps1 -Port {{port}}; Write-Host 'Waiting up to 40 seconds for /ping endpoint...' -ForegroundColor Cyan; for ($i = 1; $i -le 40; $i++) { try { $res = Invoke-RestMethod -Uri 'http://127.0.0.1:{{port}}/ping' -ErrorAction Stop; Write-Host '✅ Server is UP!' -ForegroundColor Green; exit 0 } catch { Start-Sleep -Seconds 1 } }; Write-Error '❌ Server failed to start on port {{port}} within 40 seconds.'; exit 1 @if (Get-NetTCPConnection -LocalPort {{port}} -State Listen -ErrorAction SilentlyContinue) { Write-Host '⚠️ Server is already running on port {{port}}. Skipping start.' -ForegroundColor Yellow; exit 0 }; Write-Host 'Starting MCP server in background on port {{port}}...' -ForegroundColor Cyan; $env:MCP_PORT='{{port}}'; $env:MCP_UDP_PORT1=$([int]{{port}} + 1); $env:MCP_UDP_PORT2=$([int]{{port}} + 2); .\start_server.ps1 -Port {{port}}; Write-Host 'Waiting up to 40 seconds for /health endpoint...' -ForegroundColor Cyan; for ($i = 1; $i -le 40; $i++) { try { $h = Invoke-RestMethod -Uri 'http://127.0.0.1:{{port}}/health' -ErrorAction Stop; Write-Host "✅ Server is UP! Running Version: $($h.version.app_version) [$($h.version.target_os)/$($h.version.target_arch)]" -ForegroundColor Green; exit 0 } catch { Start-Sleep -Seconds 1 } }; Write-Error '❌ Server failed to start on port {{port}} within 40 seconds.'; exit 1
# Verify the deployment is healthy and serving correct content # Verify the deployment is healthy and serving correct content
verify port="3000": verify port="3000":
+7 -5
View File
@@ -5,13 +5,15 @@ $HealthUrl = "http://127.0.0.1:$Port/ping"
$UiUrl = "http://127.0.0.1:$Port/?t=$(Get-Random)" $UiUrl = "http://127.0.0.1:$Port/?t=$(Get-Random)"
$ExpectedContent = "open-color" # Basic sanity check that we are serving the updated UI $ExpectedContent = "open-color" # Basic sanity check that we are serving the updated UI
Write-Host "Verifying server HEALTH at $HealthUrl..." -ForegroundColor Cyan Write-Host "Verifying server HEALTH at http://127.0.0.1:$Port/health..." -ForegroundColor Cyan
for ($i = 1; $i -le 40; $i++) { for ($i = 1; $i -le 40; $i++) {
try { try {
$healthResponse = Invoke-WebRequest -Uri $HealthUrl -UseBasicParsing -ErrorAction Stop $healthResponse = Invoke-RestMethod -Uri "http://127.0.0.1:$Port/health" -UseBasicParsing -ErrorAction Stop
if ($healthResponse.StatusCode -eq 200) { if ($healthResponse.status -eq "ok") {
Write-Host "✅ Server /ping is UP! (Attempt $i)" -ForegroundColor Green $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 Write-Host "Verifying UI payload at $UiUrl..." -ForegroundColor Cyan
$uiResponse = Invoke-WebRequest -Uri $UiUrl -UseBasicParsing -ErrorAction Stop $uiResponse = Invoke-WebRequest -Uri $UiUrl -UseBasicParsing -ErrorAction Stop
@@ -23,7 +25,7 @@ for ($i = 1; $i -le 40; $i++) {
} }
} }
} catch { } catch {
Write-Host "⏳ Server /ping not responding yet... (Attempt $i)" -ForegroundColor Yellow Write-Host "⏳ Server /health not responding yet... (Attempt $i)" -ForegroundColor Yellow
} }
Start-Sleep -Seconds 1 Start-Sleep -Seconds 1
} }