재부팅 뒤 워치독이 5분마다 콘솔 창에 실패만 뿌리던 문제의 원인 세 가지를 고친다. - 워치독이 DB 다운을 감지하고 직접 복구한다. postgres(vignette-dev-db) 기동은 boot 담당이라 start-public-runtime.ps1 재호출로는 절대 복구되지 않았고, 그 결과 워치독은 고칠 수 없는 대상에 start를 무한 재시도하며 실패만 기록했다. db를 health check 항목에 넣고, 재시작 전에 컨테이너를 되살리며, 복구 실패 시에는 runtime 재시작을 시도하지 않고 종료한다. - 작업 액션을 wscript 런처(watch-public-runtime-task.vbs) 경유로 등록한다. powershell.exe를 직접 등록하면 -WindowStyle Hidden이어도 conhost 창이 매 실행 번쩍이고, 5분 주기에서는 그것이 곧 화면을 가리는 창이 된다. 런처는 pin 인자를 해석하지 않고 전달만 하며 provenance 검증은 기존대로 watchdog이 수행한다. - boot이 web preview 상태를 보고 -SkipWebRestart를 조건부로 붙인다. 무조건 스킵하면 재부팅 직후처럼 vite가 죽은 상태에서 boot 경로로는 web이 영영 복구되지 않았다. hidden trigger는 액션이 wscript 런처를 거치는지 함께 검증하도록 맞췄다.
38 lines
2.3 KiB
Text
38 lines
2.3 KiB
Text
Option Explicit
|
|
|
|
If WScript.Arguments.Count > 0 Then
|
|
If LCase(WScript.Arguments(0)) = "syntax-only" Then
|
|
WScript.Quit 0
|
|
End If
|
|
End If
|
|
|
|
Dim objShell
|
|
Dim command
|
|
Dim exitCode
|
|
|
|
Set objShell = CreateObject("WScript.Shell")
|
|
command = "$ErrorActionPreference='Stop';" & _
|
|
"$task=Get-ScheduledTask -TaskName 'VignettePublicRuntimeWatchdog' -ErrorAction Stop;" & _
|
|
"$action=@($task.Actions)[0];" & _
|
|
"if([IO.Path]::GetFileName($action.Execute) -ne 'wscript.exe'){throw 'Pinned watchdog task must execute wscript.exe'};" & _
|
|
"$root=$action.WorkingDirectory;if([string]::IsNullOrWhiteSpace($root)){throw 'Pinned watchdog working directory is missing'};" & _
|
|
"$quote=[char]34;$expectedScript=Join-Path $root 'scripts\watch-public-runtime.ps1';" & _
|
|
"$expectedLauncher=Join-Path $root 'scripts\watch-public-runtime-task.vbs';" & _
|
|
"if($action.Arguments.IndexOf($quote+$expectedLauncher+$quote,[StringComparison]::OrdinalIgnoreCase) -lt 0){throw 'Pinned watchdog launcher does not match its working directory'};" & _
|
|
"$expectedFileArg='-File '+$quote+$expectedScript+$quote;$expectedRootArg='-StableSourceRoot '+$quote+$root+$quote;" & _
|
|
"if($action.Arguments.IndexOf($expectedFileArg,[StringComparison]::OrdinalIgnoreCase) -lt 0){throw 'Pinned watchdog script path does not match its working directory'};" & _
|
|
"if($action.Arguments.IndexOf($expectedRootArg,[StringComparison]::OrdinalIgnoreCase) -lt 0){throw 'Pinned watchdog source root does not match its working directory'};" & _
|
|
"$required=@('-StableSourceRoot','-ExpectedSourceCommit','-ExpectedSourceTree','-ExpectedWatchdogSha256','-ExpectedStartScriptSha256');" & _
|
|
"foreach($marker in $required){if($action.Arguments.IndexOf($marker,[StringComparison]::Ordinal) -lt 0){throw ('Unpinned watchdog task action: missing '+$marker)}};" & _
|
|
"if($action.Arguments -match '(?i)(?:^|\s)-Workspace(?:\s|$)'){throw 'Legacy shared-worktree watchdog action is forbidden'};" & _
|
|
"Start-ScheduledTask -TaskName 'VignettePublicRuntimeWatchdog'"
|
|
command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -Command """ & _
|
|
Replace(command, """", """""") & """"
|
|
If WScript.Arguments.Count > 0 Then
|
|
If LCase(WScript.Arguments(0)) = "print-command" Then
|
|
WScript.Echo command
|
|
WScript.Quit 0
|
|
End If
|
|
End If
|
|
exitCode = objShell.Run(command, 0, True)
|
|
WScript.Quit exitCode
|