feat: 운영 안정성과 세션 음성 경험 개선
This commit is contained in:
parent
facc4ad2d9
commit
c788343467
95 changed files with 8431 additions and 1785 deletions
|
|
@ -1,8 +1,8 @@
|
|||
# boot-public-runtime.ps1
|
||||
# 목적: PC 재부팅/재로그온 후 퍼블릭 런타임을 자동으로 복구한다.
|
||||
# 순서: Docker Desktop 데몬 대기 -> postgres(vignette-dev-db) 기동 ->
|
||||
# API 가 이미 healthy 면 스킵, 아니면 start-public-runtime.ps1(-SkipWebRestart) 로
|
||||
# 엔진 게이트웨이(9099) + API(8001) + cloudflared 터널을 올린다.
|
||||
# 관리자/인증 API 가 이미 healthy 이고 엔진도 healthy 면 스킵, 아니면
|
||||
# start-public-runtime.ps1(-SkipWebRestart) 로 필요한 프로세스만 복구한다.
|
||||
# 멱등: 어느 단계든 이미 살아있으면 건드리지 않는다. 수동으로 여러 번 실행해도 안전.
|
||||
#
|
||||
# 등록(로그온 시 자동 실행, 숨김 창):
|
||||
|
|
@ -46,7 +46,7 @@ function Test-Tcp([string]$Host_, [int]$Port) {
|
|||
} catch { return $false }
|
||||
}
|
||||
|
||||
function Test-ApiHealthy {
|
||||
function Test-ApiControlPlaneHealthy {
|
||||
# HttpWebRequest + Proxy=$null: WININET/시스템 프록시에 영향받지 않는 가장 직결적인 검사.
|
||||
# 비대화형 스케줄러 컨텍스트에서도 127.0.0.1 로 직접 연결한다. 3회 재시도.
|
||||
for ($i = 1; $i -le 3; $i++) {
|
||||
|
|
@ -60,7 +60,7 @@ function Test-ApiHealthy {
|
|||
$body = $reader.ReadToEnd()
|
||||
$reader.Close(); $resp.Close()
|
||||
$h = $body | ConvertFrom-Json
|
||||
if ($h.environment -eq "prod" -and $h.db -eq $true -and $h.engine -eq $true) { return $true }
|
||||
if ($h.environment -eq "prod" -and $h.db -eq $true) { return $true }
|
||||
Write-BootLog (" health probe attempt {0}: not-healthy body={1}" -f $i, $body)
|
||||
return $false
|
||||
} catch {
|
||||
|
|
@ -71,6 +71,15 @@ function Test-ApiHealthy {
|
|||
return $false
|
||||
}
|
||||
|
||||
function Test-EngineHealthy {
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri "http://127.0.0.1:9099/health" -TimeoutSec 10
|
||||
return $response.ok -eq $true
|
||||
} catch {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
Write-BootLog "================ boot start ================"
|
||||
|
||||
# 1) Docker 데몬(내려가 있으면 Docker Desktop 기동 후 대기)
|
||||
|
|
@ -109,8 +118,8 @@ if (-not (Test-Tcp -Host_ "127.0.0.1" -Port $DbPort)) {
|
|||
Write-BootLog "postgres 127.0.0.1:$DbPort up"
|
||||
|
||||
# 3) 엔진/API/cloudflared — 이미 healthy 면 스킵(불필요한 재시작/다운타임 방지)
|
||||
if (Test-ApiHealthy) {
|
||||
Write-BootLog "API already healthy on $ApiPort; skipping engine/api/cloudflared restart"
|
||||
if ((Test-ApiControlPlaneHealthy) -and (Test-EngineHealthy)) {
|
||||
Write-BootLog "control plane and engine already healthy; skipping runtime restart"
|
||||
} else {
|
||||
$pub = Join-Path $Workspace "scripts\start-public-runtime.ps1"
|
||||
if (-not (Test-Path -LiteralPath $pub)) {
|
||||
|
|
@ -127,10 +136,14 @@ if (Test-ApiHealthy) {
|
|||
}
|
||||
|
||||
# 4) 최종 확인
|
||||
if (Test-ApiHealthy) {
|
||||
Write-BootLog "boot OK: API healthy on $ApiPort"
|
||||
if (Test-ApiControlPlaneHealthy) {
|
||||
if (Test-EngineHealthy) {
|
||||
Write-BootLog "boot OK: control plane and engine healthy"
|
||||
} else {
|
||||
Write-BootLog "boot OK: admin/auth control plane healthy; engine remains degraded"
|
||||
}
|
||||
exit 0
|
||||
} else {
|
||||
Write-BootLog "WARN: boot finished but API health check failed — see apps/api/api.public.err.log"
|
||||
Write-BootLog "WARN: boot finished but admin/auth control plane failed — see apps/api/api.public.err.log"
|
||||
exit 2
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue