feat: 운영 안정성과 세션 음성 경험 개선
This commit is contained in:
parent
facc4ad2d9
commit
c788343467
95 changed files with 8431 additions and 1785 deletions
|
|
@ -7,6 +7,7 @@
|
|||
[string]$Cloudflared = "$env:LOCALAPPDATA\Microsoft\WinGet\Links\cloudflared.exe",
|
||||
[string]$CloudflaredConfig = "$env:USERPROFILE\.cloudflared\vignette-config.yml",
|
||||
[switch]$SkipEngineRestart,
|
||||
[switch]$ForceApiRestart,
|
||||
[switch]$SkipWebRestart,
|
||||
[switch]$RouteCloudflareDns,
|
||||
[string]$CloudflareTunnelName = "vignette",
|
||||
|
|
@ -181,17 +182,21 @@ if ($SkipEngineRestart) {
|
|||
-RedirectStandardError $EngineErrLog `
|
||||
-PassThru | Out-Null
|
||||
|
||||
$engineHealth = Wait-JsonHealth `
|
||||
-Uri "http://127.0.0.1:$EnginePort/health" `
|
||||
-IsHealthy { param($health) $health.ok -eq $true } `
|
||||
-TimeoutSec 30
|
||||
try {
|
||||
$engineHealth = Wait-JsonHealth `
|
||||
-Uri "http://127.0.0.1:$EnginePort/health" `
|
||||
-IsHealthy { param($health) $health.ok -eq $true } `
|
||||
-TimeoutSec 30
|
||||
} catch {
|
||||
Write-Warning "Engine gateway is still degraded; continuing admin/auth recovery"
|
||||
$engineHealth = Get-JsonHealth -Uri "http://127.0.0.1:$EnginePort/health"
|
||||
}
|
||||
}
|
||||
|
||||
Stop-UvicornByPort -AppImport "app.main:app" -Port $ApiPort
|
||||
|
||||
$env:ENVIRONMENT = "prod"
|
||||
$env:ENGINE_URL = "http://127.0.0.1:$EnginePort"
|
||||
$env:ENGINE_MODE = "claude_cli"
|
||||
$env:VIGNETTE_LIVE_CLIENT_PROVIDER = "claude_cli"
|
||||
$env:AUTH_DEV_LOGIN_ENABLED = "false"
|
||||
$env:AUTO_SEED_PERSONAS = "false"
|
||||
$env:ALLOW_SEED_PERSONA_FALLBACK = "false"
|
||||
|
|
@ -209,20 +214,29 @@ $env:FRONTEND_ORIGIN_MAP = ConvertTo-CompactJson -Value ([ordered]@{
|
|||
"api-vnet.18ka.net" = "https://vnet.18ka.net"
|
||||
})
|
||||
|
||||
$proc = Start-Process -WindowStyle Hidden -FilePath $Python `
|
||||
-ArgumentList @("-m", "uvicorn", "app.main:app", "--host", "127.0.0.1", "--port", "$ApiPort") `
|
||||
-WorkingDirectory $ApiDir `
|
||||
-RedirectStandardOutput $OutLog `
|
||||
-RedirectStandardError $ErrLog `
|
||||
-PassThru
|
||||
$health = Get-JsonHealth -Uri "http://127.0.0.1:$ApiPort/health"
|
||||
$apiControlPlaneReady = $null -ne $health -and $health.environment -eq "prod" -and $health.db
|
||||
$proc = $null
|
||||
if ($apiControlPlaneReady -and -not $ForceApiRestart) {
|
||||
Write-Output "Admin/auth control plane already healthy; skipping API restart"
|
||||
} else {
|
||||
Stop-UvicornByPort -AppImport "app.main:app" -Port $ApiPort
|
||||
|
||||
Start-Sleep -Seconds 3
|
||||
$health = Wait-JsonHealth `
|
||||
-Uri "http://127.0.0.1:$ApiPort/health" `
|
||||
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db -and $health.engine } `
|
||||
-TimeoutSec 30
|
||||
if ($health.environment -ne "prod" -or -not $health.db -or -not $health.engine) {
|
||||
throw "Public API health is not production-safe: $($health | ConvertTo-Json -Compress)"
|
||||
$proc = Start-Process -WindowStyle Hidden -FilePath $Python `
|
||||
-ArgumentList @("-m", "uvicorn", "app.main:app", "--host", "127.0.0.1", "--port", "$ApiPort") `
|
||||
-WorkingDirectory $ApiDir `
|
||||
-RedirectStandardOutput $OutLog `
|
||||
-RedirectStandardError $ErrLog `
|
||||
-PassThru
|
||||
|
||||
Start-Sleep -Seconds 3
|
||||
$health = Wait-JsonHealth `
|
||||
-Uri "http://127.0.0.1:$ApiPort/health" `
|
||||
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db } `
|
||||
-TimeoutSec 30
|
||||
}
|
||||
if ($health.environment -ne "prod" -or -not $health.db) {
|
||||
throw "Admin/auth control plane is not production-safe: $($health | ConvertTo-Json -Compress)"
|
||||
}
|
||||
|
||||
if (!$SkipWebRestart) {
|
||||
|
|
@ -275,20 +289,30 @@ if (!$SkipCloudflaredRestart) {
|
|||
-ApiPortValue $ApiPort `
|
||||
-WebPortValue $WebPort
|
||||
|
||||
Get-CimInstance Win32_Process |
|
||||
$cloudflaredProcess = Get-CimInstance Win32_Process |
|
||||
Where-Object { $_.Name -eq "cloudflared.exe" -and $_.CommandLine -like "*vignette-config.yml*" } |
|
||||
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
Start-Process -WindowStyle Hidden -FilePath $Cloudflared `
|
||||
-ArgumentList @("tunnel", "--config", $CloudflaredConfig, "run") `
|
||||
-RedirectStandardOutput (Join-Path $Workspace "cloudflared.public.out.log") `
|
||||
-RedirectStandardError (Join-Path $Workspace "cloudflared.public.err.log") `
|
||||
-PassThru | Out-Null
|
||||
Select-Object -First 1
|
||||
if ($null -eq $cloudflaredProcess) {
|
||||
Start-Process -WindowStyle Hidden -FilePath $Cloudflared `
|
||||
-ArgumentList @("tunnel", "--config", $CloudflaredConfig, "run") `
|
||||
-RedirectStandardOutput (Join-Path $Workspace "cloudflared.public.out.log") `
|
||||
-RedirectStandardError (Join-Path $Workspace "cloudflared.public.err.log") `
|
||||
-PassThru | Out-Null
|
||||
} else {
|
||||
Write-Output "Cloudflared already running; skipping tunnel restart"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Engine gateway healthy on http://127.0.0.1:$EnginePort"
|
||||
Write-Output "Public API running on http://127.0.0.1:$ApiPort with PID $($proc.Id)"
|
||||
if ($null -ne $engineHealth -and $engineHealth.ok) {
|
||||
Write-Output "Engine gateway healthy on http://127.0.0.1:$EnginePort"
|
||||
} else {
|
||||
Write-Warning "Engine gateway degraded; admin/auth control plane remains available"
|
||||
}
|
||||
if ($null -ne $proc) {
|
||||
Write-Output "Public API running on http://127.0.0.1:$ApiPort with PID $($proc.Id)"
|
||||
} else {
|
||||
Write-Output "Public API kept running on http://127.0.0.1:$ApiPort"
|
||||
}
|
||||
if (!$SkipWebRestart) {
|
||||
Write-Output "Public vnet web preview running on http://127.0.0.1:$WebPort"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue