deploy(prod): stage the Overview dashboard (QA's 818775b3) on app-vp03/04 with a PROD registry; plan Phase 8a + ports

Registry: ScadaBridge central + site groups, MxAccessGateway x4. install-overview.ps1 (dry/real, NSSM, virtual account).
Preflight probes 5320 and the Overview health paths. SMB only, nothing executed.

Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
This commit is contained in:
Joseph Doherty
2026-11-20 05:52:20 -05:00
parent bfc369062c
commit cf447a8fe6
5 changed files with 155 additions and 8 deletions
+10 -2
View File
@@ -16,6 +16,7 @@ below is run on the box only after the owner's go for its phase.
| `otelcol-contrib_0.162.0_windows_amd64.zip` | `97a675ee…e496a167` | QA vq03 `E:\psrem-stage\otel-54` (scadaproj#54) |
| Secrets CLI 0.6.6 `ZB.MOM.WW.Secrets.Cli.exe` | `36dbd512…` | = QA `E:\ApiInstall\_tools\secret-0.6.6` |
| Secrets CLI 0.6.6 + SqlServer provider (centrals only) | `421f95e9…` | = QA `…\secret-0.6.6-sql` (QA finding 2) |
| `overview-818775b3.zip` (dashboard, self-contained, 411 files; centrals only) | `25178c5c…6a1283df` | QA vq03's running `E:\ApiInstall\Overview\app`, copied file by file (399/399 size-checked) minus `appsettings.QA.json` and `.bak` files; `ProductVersion 1.0.0+818775b3` |
| `nssm.exe` | `eee9c44c…` | = QA `C:\ProgramData\ZB\qa-build\tools\nssm.exe` |
Every staged folder carries a `SHA256SUMS.txt`. Remote sizes were checked file by file over SMB (150/150), and the two
@@ -29,6 +30,7 @@ app zips plus the CLI were pulled back from vp04 and par-vp04 and re-hashed.
| `E:\psrem-stage\mxgw-e74918cc\` | zip, `appsettings.json.prod`, `mxgw.env`, `install-mxgw.ps1`, `Install-`/`Upgrade-MxGatewayService.ps1` | same (install refuses until MXAccess exists, Q3) |
| `E:\psrem-stage\sb-2e0ce81e\` | zip, `appsettings.Central.json.prod-<box>`, `sb-central.env`, `install-sb.ps1`, `sql\` | zip, `appsettings.Site.json.prod-<box>`, `sb-site.env`, `install-sb.ps1` |
| `E:\psrem-stage\otel-54\` | collector zip, `config.yaml`, `Install-OtelCollector.ps1` (PROD tier added), `Test-OtelCollector.ps1` | same |
| `E:\psrem-stage\overview-818775b3\` (added 2026-11-20) | zip, `appsettings.Prod.json`, `install-overview.ps1` | — |
| `E:\ApiInstall\_tools\` | `secret-0.6.6\`, `secret-0.6.6-sql\` | `secret-0.6.6\` |
`E:\ApiInstall` now exists only for `_tools`; there is still no `app` folder and no service, so both install scripts see a
@@ -36,6 +38,10 @@ greenfield box.
## Configs (sources in this folder)
- **Overview** (2026-11-20, owner: "also deploy the dashboard and pre-configure it for the mxgateway and scadabridge
clusters"): `overview/appsettings.Prod.json`, one registry on both centrals: ScadaBridge `central` (vp03/vp04 `:8085`) and
`site` (par-vp03/04 `:8084`), MxAccessGateway ×4 (`:5130`). FQDN BaseUrls, as on QA. No credentials, nothing to seed.
- **mxgw** `mxgw.env`: QA vq03's key set plus the §3A.3 LDAP block. Differences: `ASPNETCORE_ENVIRONMENT=Production` (login
hard-stops on), `_PROD` `GroupToRole`, and the file KEK `C:\ProgramData\ZB\kek\mxgateway.kek`. `appsettings.json.prod` = the
zip's `Server\appsettings.json` minus `Dashboard:GroupToRole` (`GwAdmin`/`GwReader`).
@@ -69,6 +75,7 @@ When a placeholder is resolved, edit the file here, commit, and re-push that one
| `prod-common\preflight-prod.ps1 [-SqlHost] [-GrHost]` | read-only Phase 2 gates: disk, `LmxProxy.dll` + COM registration, NAM 636/389 + rootca + TLS, greenfield paths and ports, DNS, TCP path probes per §4 (open / refused / timeout), staged hashes | write anything |
| `mxgw-e74918cc\install-mxgw.ps1 -Mode dry\|real [-ValuesDir] [-KekFrom]` | MXAccess gate, zip hash, placeholder + `_DEV/_QA` refusal, expand to `app`/`worker`, NAM base config, 32-byte KEK, NSSM service via the patched `Install-MxGatewayService.ps1` | start the service |
| `sb-2e0ce81e\install-sb.ps1 -Role Central\|Site -Mode dry\|real [-ValuesDir] [-KekFrom]` | box/role check, zip hash, this node's config, env from value files, expand `app`/`cli`, `<role>\{data,logs}`, KEK (generated on vp03 only; every other node takes the same file), `sc.exe` service with recovery 5/5/10 s + failureflag | start the service |
| `overview-818775b3\install-overview.ps1 -Mode dry\|real [-Start]` | central boxes only, zip hash, expand to `E:\ApiInstall\Overview\app`, PROD registry, NSSM `ZbOverview` as `NT SERVICE\ZbOverview` (RX tree, Modify logs/data); `-Start` waits for `/health/ready` 200 | run on the PAR boxes |
| `prod-common\seed-secret-prod.ps1 -Target MxAccessGw\|ScadaBridge-Central -ValueFile` | seeds `nam-ldap-svc-password` into a stopped service's store (central: once, vp03, shared SQL store), reads back, deletes the value file | print the value |
`Install-MxGatewayService.ps1` here is mxgw `e74918cc` plus three marked patches: `-WorkerExeName` (the wonder Worker is
@@ -86,10 +93,11 @@ and then runs `Install-MxGatewayService -DryRun` (39 env entries). That is not a
2. Phase 3 (Q1 answered): `sql\scadabridge-schema-2e0ce81e.sql`, `sql\zbsecrets-schema-v1.sql`, `sql\sb-role-mappings-prod.sql`; backup.
3. Phase 4, vp03/vp04 (par later, Q3): `install-mxgw.ps1 -Mode dry`, then `real`; `seed-secret-prod.ps1 -Target MxAccessGw`; start; §3A.5.
4. Phase 5: `install-sb.ps1 -Role Central` on vp03 (KEK generated), vp04 (`-KekFrom` the vp03 file); `seed-secret-prod.ps1 -Target ScadaBridge-Central` on vp03; start vp03, then vp04; §3A.5.
5. Phase 6: `install-sb.ps1 -Role Site` on both PAR boxes (`-KekFrom`, same PSK and LocalDb key); `SB-GRPC-PSK-<siteId>` into central; start both together.
5. Phase 8a (any time after Phase 4): `install-overview.ps1 -Mode dry`, then `real -Start`, on vp03 and vp04.
6. Phase 6: `install-sb.ps1 -Role Site` on both PAR boxes (`-KekFrom`, same PSK and LocalDb key); `SB-GRPC-PSK-<siteId>` into central; start both together.
## Cleanup (if PROD is abandoned)
`winrm smb rm -r <box> 'E$\psrem-stage\prod-common' 'E$\psrem-stage\mxgw-e74918cc' 'E$\psrem-stage\sb-2e0ce81e' 'E$\psrem-stage\otel-54' 'E$\ApiInstall\_tools'`
`winrm smb rm -r <box> 'E$\psrem-stage\prod-common' 'E$\psrem-stage\mxgw-e74918cc' 'E$\psrem-stage\sb-2e0ce81e' 'E$\psrem-stage\otel-54' 'E$\psrem-stage\overview-818775b3' 'E$\ApiInstall\_tools'`
on each box. The push also created the parent folders `E:\psrem-stage` and `E:\ApiInstall`; the earlier 2026-11-19
SMB survey listed neither. Nothing else was created.
@@ -29,9 +29,9 @@ foreach ($h in 'uswap-vdc-nam1.nam.zimmer.com','uswap-vdc-nam2.nam.zimmer.com')
# Local state: greenfield expected
foreach ($d in 'E:\ApiInstall','E:\ApiInstall\MxAccessGateway','E:\ApiInstall\ScadaBridge','C:\ProgramData\ZB\kek') { "path $d exists=$(Test-Path $d)" }
Get-Service | Where-Object { $_.Name -match 'MxAccess|MxGateway|ScadaBridge|ZbOtel|OtOpcUa|Historian' } | ForEach-Object { "service $($_.Name) $($_.Status)" }
$listen = Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | Where-Object { $_.LocalPort -in 4317,5120,5130,8081,8082,8083,8084,8085,8889 }
$listen = Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | Where-Object { $_.LocalPort -in 4317,5120,5130,5320,8081,8082,8083,8084,8085,8889 }
foreach ($l in $listen) { "PORT IN USE $($l.LocalAddress):$($l.LocalPort) pid $($l.OwningProcess) $((Get-Process -Id $l.OwningProcess -ErrorAction SilentlyContinue).ProcessName)" }
if (-not $listen) { 'ports 4317 5120 5130 8081-8085 8889: all free' }
if (-not $listen) { 'ports 4317 5120 5130 5320 8081-8085 8889: all free' }
$fw = Get-NetFirewallProfile -ErrorAction SilentlyContinue | ForEach-Object { "$($_.Name)=$($_.Enabled)" }
"windows firewall profiles: $($fw -join ' ')"
@@ -46,8 +46,8 @@ foreach ($n in 'wonder-app-vp03','wonder-app-vp04','wonder-par-vp03','wonder-par
$f = "$n.zmr.zimmer.com"; try { $a = ([Net.Dns]::GetHostAddresses($f) | Select-Object -First 1).IPAddressToString } catch { $a = 'NXDOMAIN' }
"dns $f -> $a (plan $($ip[$n.ToUpperInvariant()]))" }
$targets = if ($central) {
@(@{h = $ip[($(if ($box -eq 'WONDER-APP-VP03') {'WONDER-APP-VP04'} else {'WONDER-APP-VP03'}))]; p = 8081, 8085, 8083},
@{h = '10.201.75.86'; p = 8083, 5120}, @{h = '10.201.75.87'; p = 8083, 5120})
@(@{h = $ip[($(if ($box -eq 'WONDER-APP-VP03') {'WONDER-APP-VP04'} else {'WONDER-APP-VP03'}))]; p = 8081, 8085, 8083, 5130, 5320},
@{h = '10.201.75.86'; p = 8083, 5120, 8084, 5130}, @{h = '10.201.75.87'; p = 8083, 5120, 8084, 5130})
} else {
@(@{h = $ip[($(if ($box -eq 'WONDER-PAR-VP03') {'WONDER-PAR-VP04'} else {'WONDER-PAR-VP03'}))]; p = 8082, 8083, 5120},
@{h = '10.220.153.205'; p = 8083, 5120}, @{h = '10.220.153.210'; p = 8083, 5120})
@@ -0,0 +1,32 @@
{
"_comment": "PROD fleet registry (ASPNETCORE_ENVIRONMENT=Prod) for the Overview instances on wonder-app-vp03 and wonder-app-vp04, both watching the same registry as on QA. BaseUrl hosts are FQDNs ON PURPOSE (QA rule): the Akka addresses use IPv4 literals, so build 818775b3's fleet-wide host-only leader matching resolves nothing and each leader chip shows the raw address instead of a wrong name. The PAR gateways stay Down until WinPlatform puts MXAccess on those boxes (plan Q3). Probes from the centrals to the PAR boxes cross 10.220.153.x -> 10.201.75.x on 8084 and 5130 (plan section 4).",
"Kestrel": { "Endpoints": { "Http": { "Url": "http://+:5320" } } },
"Serilog": {
"WriteTo": [ {}, { "Args": { "path": "E:\\ApiInstall\\Overview\\logs\\overview-.log" } } ]
},
"Overview": {
"PollIntervalSeconds": 15,
"TimeoutSeconds": 8,
"StaleAfterSeconds": 60,
"Applications": [
{
"Name": "ScadaBridge", "ManagementLabel": "CentralUI",
"Instances": [
{ "Name": "central-a (vp03)", "Group": "central", "BaseUrl": "http://wonder-app-vp03.zmr.zimmer.com:8085", "ManagementUrl": "http://wonder-app-vp03.zmr.zimmer.com:8085/", "HasActiveRole": true },
{ "Name": "central-b (vp04)", "Group": "central", "BaseUrl": "http://wonder-app-vp04.zmr.zimmer.com:8085", "ManagementUrl": "http://wonder-app-vp04.zmr.zimmer.com:8085/", "HasActiveRole": true },
{ "Name": "node-a (par-vp03)", "Group": "site", "BaseUrl": "http://wonder-par-vp03.zmr.zimmer.com:8084", "HasActiveRole": true },
{ "Name": "node-b (par-vp04)", "Group": "site", "BaseUrl": "http://wonder-par-vp04.zmr.zimmer.com:8084", "HasActiveRole": true }
]
},
{
"Name": "MxAccessGateway", "ManagementLabel": "Dashboard",
"Instances": [
{ "Name": "vp03", "BaseUrl": "http://wonder-app-vp03.zmr.zimmer.com:5130", "ManagementUrl": "http://wonder-app-vp03.zmr.zimmer.com:5130/", "HasActiveRole": true },
{ "Name": "vp04", "BaseUrl": "http://wonder-app-vp04.zmr.zimmer.com:5130", "ManagementUrl": "http://wonder-app-vp04.zmr.zimmer.com:5130/", "HasActiveRole": true },
{ "Name": "par-vp03", "BaseUrl": "http://wonder-par-vp03.zmr.zimmer.com:5130", "ManagementUrl": "http://wonder-par-vp03.zmr.zimmer.com:5130/", "HasActiveRole": true },
{ "Name": "par-vp04", "BaseUrl": "http://wonder-par-vp04.zmr.zimmer.com:5130", "ManagementUrl": "http://wonder-par-vp04.zmr.zimmer.com:5130/", "HasActiveRole": true }
]
}
]
}
}
@@ -0,0 +1,83 @@
# PROD Overview dashboard first install on wonder-app-vp03 / vp04 (plan Phase 8a). Run ON the box after the owner's go.
# Build = QA's running 818775b3 (byte-identical copy of vq03 E:\ApiInstall\Overview\app minus the QA overlay and .bak files).
# -Mode dry : verify zip + overlay, expand into .\dry\, print the service definition. Creates nothing outside this folder.
# -Mode real : expand into E:\ApiInstall\Overview\app, add appsettings.Prod.json, create logs\ + data\, create the NSSM
# service ZbOverview (virtual account NT SERVICE\ZbOverview, RX on the tree, Modify on logs\ + data\,
# ASPNETCORE_ENVIRONMENT=Prod, auto start, restart on exit). -Start starts it and checks /health/ready.
# Overview is anonymous and read-only and holds no credentials, so there is no secret to seed.
param(
[Parameter(Mandatory)][ValidateSet('dry','real')][string]$Mode,
[switch]$Start
)
$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'
$stage = $PSScriptRoot
$zip = Join-Path $stage 'overview-818775b3.zip'
$zipSha = '25178C5C4B9516A53595E5D83491AB40095A73DEB2862009C0E312376A1283DF'
$root = 'E:\ApiInstall\Overview'
$svc = 'ZbOverview'
$acct = "NT SERVICE\$svc"
$nssm = 'E:\psrem-stage\prod-common\nssm.exe'
function Say($m) { "[{0:HH:mm:ss}] {1}" -f (Get-Date), $m }
function Fail($m) { throw "ABORT: $m" }
if ($env:COMPUTERNAME -notin 'WONDER-APP-VP03','WONDER-APP-VP04') { Fail "Overview goes on the central boxes only, not $env:COMPUTERNAME" }
Say "install-overview mode=$Mode box=$env:COMPUTERNAME"
$h = (Get-FileHash $zip -Algorithm SHA256).Hash
if ($h -ne $zipSha) { Fail "zip sha256 $h != $zipSha" }
$ovl = Join-Path $stage 'appsettings.Prod.json'
$reg = ([IO.File]::ReadAllText($ovl) | ConvertFrom-Json).Overview.Applications
Say "zip ok; registry: $(($reg | ForEach-Object { "$($_.Name)=$(@($_.Instances).Count)" }) -join ', ')"
if (-not (Test-Path $nssm)) { Fail "nssm not staged at $nssm" }
$base = if ($Mode -eq 'dry') { Join-Path $stage 'dry' } else { $root }
$app = Join-Path $base 'app'
if ($Mode -eq 'real') {
if (Test-Path $app) { Fail "$app already exists - first-install script only" }
if (Get-Service $svc -ErrorAction SilentlyContinue) { Fail "service $svc already exists" }
$busy = Get-NetTCPConnection -State Listen -LocalPort 5320 -ErrorAction SilentlyContinue
if ($busy) { Fail 'port 5320 is already in use' }
} elseif (Test-Path $base) { Remove-Item $base -Recurse -Force }
New-Item -ItemType Directory -Force $app, (Join-Path $base 'logs'), (Join-Path $base 'data') | Out-Null
Expand-Archive -LiteralPath $zip -DestinationPath $app
Copy-Item $ovl (Join-Path $app 'appsettings.Prod.json')
$exe = Join-Path $app 'ZB.MOM.WW.Overview.exe'
Say "expanded $(@(Get-ChildItem $app -Recurse -File).Count) files; $(Split-Path $exe -Leaf) $((Get-Item $exe).VersionInfo.ProductVersion)"
$set = @(
@('AppDirectory', "$root\app"),
@('DisplayName', 'ZB Overview dashboard'),
@('Description', 'ZB.MOM.WW.Overview 818775b3 - read-only family health dashboard on :5320 (PROD registry)'),
@('Start', 'SERVICE_AUTO_START'),
@('AppStdout', "$root\logs\service-stdout.log"), @('AppStderr', "$root\logs\service-stderr.log"),
@('AppRotateFiles', '1'), @('AppRotateOnline', '1'), @('AppRotateBytes', '10485760'),
@('AppExit', 'Default', 'Restart'), @('AppRestartDelay', '5000'))
$envx = @('ASPNETCORE_ENVIRONMENT=Prod')
if ($Mode -eq 'dry') {
Say "[DRYRUN] nssm install $svc `"$root\app\ZB.MOM.WW.Overview.exe`""
foreach ($a in $set) { Say "[DRYRUN] nssm set $svc $($a -join ' ')" }
Say "[DRYRUN] AppEnvironmentExtra = $($envx -join '; ')"
Say "[DRYRUN] sc.exe config $svc obj= $acct; icacls: Users removed, $acct RX on $root, Modify on logs + data"
Say 'DONE mode=dry'; return
}
& $nssm install $svc "$root\app\ZB.MOM.WW.Overview.exe" | Out-Null
if ($LASTEXITCODE -ne 0) { Fail "nssm install exited $LASTEXITCODE" }
foreach ($a in $set) { & $nssm set $svc @a | Out-Null; if ($LASTEXITCODE -ne 0) { Fail "nssm set $($a[0]) failed" } }
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\$svc\Parameters" -Name AppEnvironmentExtra -Type MultiString -Value $envx
& sc.exe config $svc obj= $acct | Out-Null
if ($LASTEXITCODE -ne 0) { Fail "sc config obj exited $LASTEXITCODE" }
& icacls $root /inheritance:d | Out-Null
& icacls $root /remove:g 'BUILTIN\Users' /T /C /Q | Out-Null
& icacls $root /grant "${acct}:(OI)(CI)(RX)" /Q | Out-Null
foreach ($d in 'logs','data') { & icacls (Join-Path $root $d) /grant "${acct}:(OI)(CI)(M)" /Q | Out-Null }
Say "service $svc created STOPPED, account $((Get-CimInstance Win32_Service -Filter "Name='$svc'").StartName)"
if ($Start) {
Start-Service $svc
$ok = $false
for ($i = 0; $i -lt 30 -and -not $ok; $i++) {
Start-Sleep 2
try { $ok = (Invoke-WebRequest -UseBasicParsing -TimeoutSec 3 'http://127.0.0.1:5320/health/ready').StatusCode -eq 200 } catch {}
}
Say "service $((Get-Service $svc).Status); /health/ready 200=$ok"
if (-not $ok) { Get-Content "$root\logs\service-stderr.log" -Tail 30 -ErrorAction SilentlyContinue; Fail 'Overview not ready' }
}
Say "DONE mode=$Mode"