From 75ccd4b1c01c8a61e118964ccbcfdb57360b24d4 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 17 Mar 2026 13:30:23 -0400 Subject: [PATCH] Add design doc: deploy artifacts to sites, remove config DB dependency --- ...deploy-artifacts-remove-configdb-design.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/plans/2026-03-17-deploy-artifacts-remove-configdb-design.md diff --git a/docs/plans/2026-03-17-deploy-artifacts-remove-configdb-design.md b/docs/plans/2026-03-17-deploy-artifacts-remove-configdb-design.md new file mode 100644 index 0000000..04959b7 --- /dev/null +++ b/docs/plans/2026-03-17-deploy-artifacts-remove-configdb-design.md @@ -0,0 +1,37 @@ +# 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`.