16 lines
1.4 KiB
PowerShell
16 lines
1.4 KiB
PowerShell
# ScadaBridge Central NAM cutover on vd03: appsettings.Central.json was pushed over SMB as app\appsettings.Central.json.new.
|
|
# Swap it in, drop the GLAuth password env entry (others unchanged), restart Central only. Rollback = the _ldapcut backups.
|
|
$ErrorActionPreference = 'Stop'
|
|
$app = 'E:\ApiInstall\ScadaBridge\app'; $k = 'HKLM:\SYSTEM\CurrentControlSet\Services\ScadaBridge-Central'
|
|
$before = @((Get-ItemProperty $k).Environment)
|
|
$keep = @($before | Where-Object { $_ -notlike 'ScadaBridge__Security__Ldap__ServiceAccountPassword=*' })
|
|
"env entries $($before.Count) -> $($keep.Count)"
|
|
Copy-Item "$app\appsettings.Central.json" "E:\ApiInstall\_ldapcut-20261119T145640\sb-appsettings.Central.json.pre-cutover" -Force
|
|
Move-Item "$app\appsettings.Central.json.new" "$app\appsettings.Central.json" -Force
|
|
Set-ItemProperty -Path $k -Name Environment -Value ([string[]]$keep) -Type MultiString
|
|
$after = @((Get-ItemProperty $k).Environment); foreach ($e in $keep) { if ($after -notcontains $e) { throw 'env entry changed' } }
|
|
"restarting Central"; Restart-Service 'ScadaBridge-Central' -Force
|
|
$deadline = (Get-Date).AddSeconds(180); $ok = $false
|
|
while ((Get-Date) -lt $deadline) { try { if ((Invoke-WebRequest -UseBasicParsing 'http://localhost:8085/health/ready' -TimeoutSec 5).StatusCode -eq 200) { $ok = $true; break } } catch {}; Start-Sleep 2 }
|
|
"central ready=$ok status=$((Get-Service ScadaBridge-Central).Status)"; if (-not $ok) { exit 1 }
|