Script the NSSM deploy/upgrade and new-box service install (runbook exists, no script) #220
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#207 delivered a manual runbook (docs/runbooks/DeployUpgradeNssmService.md); the original R21-O31/TST-10 ask was also a script. The repo has no deploy/upgrade script and no NSSM service-install script (incl. recovery/restart settings and the env block) for a new box. Script both, driven from the Mac via the winrm skill (deployment-only scope), with the runbook's preflight/backup/rollback steps. Also document the Worker output folder and build-vs-publish (the runbook marks it [UNVERIFIED]).
Scripts added on main
477fa559: scripts/deploy/Upgrade-MxGatewayService.ps1 (PS 5.1; preflight incl. env-block/master-key/store-path/SHA/disk/second-gateway refusals and a pre-start no-Server/no-Worker check for the OrphanWorkerTerminator trap; STOP_PENDING kill path; rename-in-place swap so NSSM paths never change; DBs copied never moved; never callsnssm set AppEnvironmentExtra— saves the block ACL-restricted and compares entry count; verify /health/ready + /healthz + ProductVersion SHA + stability window; auto-rollback unless -NoAutoRollback; manual -Rollback/-RestoreStores; -DryRun/-WhatIf) and Install-MxGatewayService.ps1 (new box: auto start, restart-on-exit, 20 s stop grace, log rotation, sc failure actions, one-shot env block; refuses existing service / running gateway / missing master key or pepper / bad store paths; masks secrets; leaves stopped unless -Start). Runbook gains a Scripts section + winrm-from-Mac flow. Evidence: pwsh 7.5.4 dry runs on the Mac against a fake nssm + directory layout — full plan, -WhatIf no-op, rollback with store restore (a would-delete-live-DB bug caught and fixed pre-commit), each refusal path exercised; both parse clean, PSScriptAnalyzer no errors. Untested on a real Windows/NSSM box (banner in the runbook) — first real use should be dry-run on the next deploy, and compare install defaults against annssm dumpfrom vd03/vq03.