chore(docker-env2): seed shared MxGateway data connection on site-x

Mirror docker/seed-sites.sh: create the MxGateway connection (10.100.0.48:5120)
on the env2 site and deploy artifacts so the DCL establishes it.
This commit is contained in:
Joseph Doherty
2026-05-29 08:31:03 -04:00
parent bfd8b25108
commit 666ee95095
+32
View File
@@ -39,6 +39,30 @@ $CLI $URL $AUTH notification create \
--emails "engineer@company.com" \
|| echo " (Engineering Alerts may already exist)"
echo ""
echo "Creating MxGateway data connection (shared gateway) on site-x..."
# Shared MxGateway data connection pointing at the MxAccess Gateway. Data
# connections are site-scoped (the DCL runs on site clusters only), so it is
# created on the env2 site. Config is the typed MxGatewayEndpointConfig JSON
# (camelCase keys), matching MxGatewayEndpointConfigSerializer.
MXGW_ENDPOINT="http://10.100.0.48:5120"
MXGW_APIKEY="mxgw_scadabridgeshared_O193yRm28zftUAcL-HPkTjAuE-vPz86MUtNLFWpcbOY"
MXGW_CONFIG="{\"endpoint\":\"${MXGW_ENDPOINT}\",\"apiKey\":\"${MXGW_APIKEY}\",\"clientName\":\"\",\"writeUserId\":0,\"useTls\":false,\"caFile\":\"\",\"serverName\":\"\",\"readTimeoutMs\":5000}"
SITE_X_ID=$($CLI $URL $AUTH --format json site list \
| python3 -c "import sys,json; print(next((s['id'] for s in json.load(sys.stdin) if s.get('siteIdentifier')=='site-x'), ''))" 2>/dev/null)
if [ -n "$SITE_X_ID" ]; then
echo " site-x (id=$SITE_X_ID): creating 'MxGateway Shared'..."
$CLI $URL $AUTH data-connection create \
--site-id "$SITE_X_ID" \
--name "MxGateway Shared" \
--protocol "MxGateway" \
--primary-config "$MXGW_CONFIG" \
|| echo " (MxGateway connection may already exist on site-x)"
else
echo " (site-x not found — skipping MxGateway connection)"
fi
echo ""
echo "Seeding LDAP group mappings (Design + Deployment)..."
# SecurityConfiguration.HasData declares 4 mappings but the InitialSchema
@@ -58,9 +82,17 @@ IF NOT EXISTS (SELECT 1 FROM LdapGroupMappings WHERE Id = 4)
SET IDENTITY_INSERT LdapGroupMappings OFF;
"
echo ""
echo "Deploying artifacts to all env2 sites (pushes the data connection so the"
echo "site establishes it — the MxGateway DataConnectionActor connects eagerly)..."
$CLI $URL $AUTH deploy artifacts \
|| echo " (artifact deploy reported an issue — check 'deploy status')"
echo ""
echo "=== Env2 site seeding complete ==="
echo ""
echo "Verify with: $CLI $URL $AUTH site list"
echo "Verify connections: $CLI $URL $AUTH data-connection list"
echo "Verify MxGateway is live: docker logs scadabridge-env2-site-x-a 2>&1 | grep -i mxgateway"
echo "Multi-role test user now has Admin + Design + Deployment in env2."
echo "Sign out and back in to refresh session role claims."