Files
scadalink-design/docs/plans/2026-03-17-deploy-artifacts-remove-configdb-design.md

38 lines
1.8 KiB
Markdown

# Design: Deploy Artifacts to Sites — Remove Config DB Dependency
**Date:** 2026-03-17
**Status:** Approved
## Problem
`ExternalSystemClient`, `DatabaseGateway`, and `NotificationDeliveryService` query the central config DB at runtime from site servers. The data is already deployed to local SQLite via `DeployArtifactsCommand` but never read back. Sites should be fully self-contained after artifact deployment.
## Changes
### 1. Site-local repository implementations
Create `SiteExternalSystemRepository` and `SiteNotificationRepository` that read from `SiteStorageService` (SQLite) instead of EF Core config DB repositories. Implement `IExternalSystemRepository` and `INotificationRepository` interfaces backed by SQLite queries.
### 2. Remove AddConfigurationDatabase from Site role
Replace `AddConfigurationDatabase` in Program.cs Site role with site-local repository registrations. Site no longer needs a SQL Server connection string.
### 3. Add "Deploy Artifacts" button to Admin UI
On the Sites page, add a "Deploy Artifacts" button per site that:
- Collects all external systems, database connections, notification lists + recipients, SMTP configs from config DB
- Sends `DeployArtifactsCommand` to the site via `CommunicationService`
- Shows success/failure toast
### 4. Include data connections in artifact deployment
Extend `DeployArtifactsCommand` to include data connection definitions (OPC UA endpoints, etc). Add `StoreDataConnectionDefinitionAsync` to `SiteStorageService`.
### 5. No change to FlattenedConfiguration
The DCL already reads connection config from `FlattenedConfiguration.Connections` dict, populated during flattening from config DB. This stays as-is.
## Outcome
After artifact deployment, sites operate without any config DB access. The config DB connection string is removed from `appsettings.Site.json`.