현재 작업 상태 저장

This commit is contained in:
Yun Chan 2026-06-27 11:20:24 +09:00
parent 07cc67761e
commit 6bd91b0d5e
674 changed files with 8726 additions and 298 deletions

View file

@ -1,11 +1,13 @@
param(
param(
[string]$Workspace = "D:\workspace\vignette",
[int]$ApiPort = 8001,
[int]$WebPort = 5174,
[int]$EnginePort = 9099,
[string]$Python = "$env:LOCALAPPDATA\Programs\Python\Python311\python.exe",
[string]$Cloudflared = "$env:LOCALAPPDATA\Microsoft\WinGet\Links\cloudflared.exe",
[string]$CloudflaredConfig = "$env:USERPROFILE\.cloudflared\vignette-config.yml",
[string]$PublicHealthUrl = "https://api-vignette.chanpaca.net/health",
[string[]]$AdditionalPublicHealthUrls = @("https://api-vnet.18ka.net/health"),
[string]$LogPath = "",
[switch]$CheckOnly,
[switch]$SkipPublicHealth,
@ -91,6 +93,10 @@ $checks = @(
-Name "api" `
-Uri "http://127.0.0.1:$ApiPort/health" `
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db -and $health.engine }),
(Test-JsonHealth `
-Name "web-preview" `
-Uri "http://127.0.0.1:$WebPort/" `
-IsHealthy { param($body) $true }),
(Test-CloudflaredProcess)
)
@ -100,6 +106,13 @@ if (!$SkipPublicHealth) {
-Uri $PublicHealthUrl `
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db -and $health.engine } `
-TimeoutSec 20
foreach ($url in $AdditionalPublicHealthUrls) {
$checks += Test-JsonHealth `
-Name "public-api:$url" `
-Uri $url `
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db -and $health.engine } `
-TimeoutSec 20
}
}
$failed = @($checks | Where-Object { -not $_.Ok })
@ -116,6 +129,7 @@ if ($CheckOnly) {
$startArgs = @{
Workspace = $Workspace
ApiPort = $ApiPort
WebPort = $WebPort
EnginePort = $EnginePort
Python = $Python
Cloudflared = $Cloudflared
@ -143,6 +157,15 @@ if (!$apiAfter.Ok) {
throw "Public API still unhealthy after restart: $($apiAfter.Detail)"
}
$webAfter = Test-JsonHealth `
-Name "web-preview" `
-Uri "http://127.0.0.1:$WebPort/" `
-IsHealthy { param($body) $true } `
-TimeoutSec 20
if (!$webAfter.Ok) {
throw "Public web preview still unhealthy after restart: $($webAfter.Detail)"
}
if (!$SkipPublicHealth) {
$publicAfter = Test-JsonHealth `
-Name "public-api" `
@ -152,6 +175,16 @@ if (!$SkipPublicHealth) {
if (!$publicAfter.Ok) {
throw "Public API tunnel still unhealthy after restart: $($publicAfter.Detail)"
}
foreach ($url in $AdditionalPublicHealthUrls) {
$publicExtraAfter = Test-JsonHealth `
-Name "public-api:$url" `
-Uri $url `
-IsHealthy { param($health) $health.environment -eq "prod" -and $health.db -and $health.engine } `
-TimeoutSec 20
if (!$publicExtraAfter.Ok) {
throw "Public API tunnel still unhealthy after restart: $($publicExtraAfter.Detail)"
}
}
}
Write-WatchdogLog "restart verified"