Skip to content

Merge Web and API into unified deployment for simplified operations - #56

Draft
robgrame with Copilot wants to merge 27 commits into
mainfrom
copilot/merge-web-app-and-api
Draft

Merge Web and API into unified deployment for simplified operations#56
robgrame with Copilot wants to merge 27 commits into
mainfrom
copilot/merge-web-app-and-api

Conversation

Copilot AI commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Consolidates SecureBootDashboard.Web and SecureBootDashboard.Api into single application to reduce deployment complexity and infrastructure costs in small-to-medium environments (1-1000 devices).

Architecture

Before: Separate Web (7001) and API (5001) applications requiring independent deployment and configuration.

After: Unified application on port 7001 serving both UI and REST endpoints. Razor Pages call API controllers via localhost HTTP.

┌─────────────────────────────────┐
│  SecureBootDashboard.Web (7001) │
│                                 │
│  Razor Pages ──localhost──► API │
│  (Dashboard)              (REST)│
│       └──────┬──────────────┘   │
│         Shared Services         │
└─────────────────────────────────┘

Implementation

Merged Components

  • Controllers: 14 API controllers → Web project
  • Services: 13 business logic services → Web project
  • Data: DbContext, entities, 15 migrations → Web project
  • Infrastructure: SignalR hub, background services, storage → Web project
  • Configuration: Consolidated into single appsettings.json

Program.cs

Unified startup (888 LOC) combines:

  • API: Controllers, Swagger, SignalR, EF Core, background services, rate limiting, caching, compression
  • Web: Razor Pages, authentication (EntraId/Windows/Anonymous)
  • Middleware ordered: compression → CORS → routing → auth → endpoints

HTTP Client Configuration

Web pages access API via loopback:

builder.Services.AddHttpClient<ISecureBootApiClient, SecureBootApiClient>()
    .ConfigurePrimaryHttpMessageHandler(/* localhost SSL bypass for dev */);

builder.Services.Configure<ApiSettings>(options => 
    options.BaseUrl = "https://localhost:7001");

Existing Razor Pages unchanged - continue using ISecureBootApiClient abstraction.

Endpoints

Path Function
/ Dashboard UI
/api/Devices REST API
/api/SecureBootReports Client submissions
/swagger API docs (dev only)
/dashboardHub SignalR
/health Health check

Trade-offs

Gains: Single deployment, 50% lower hosting costs, simplified config/logs/monitoring

Constraints: Shared resource pool (CPU/memory), cannot scale Web/API independently

Separate deployment remains available for >1000 devices or specialized scaling requirements.

Backward Compatibility

  • PowerShell clients: No changes required (API endpoints preserved at /api/*)
  • Database: No schema changes
  • Authentication: Same providers supported
  • Configuration: Superset of previous settings

Documentation

  • QUICKSTART_v1.14.md: Azure/IIS/Docker deployment
  • docs/UNIFIED_DEPLOYMENT.md: Architecture, performance, migration
Original prompt

Implementiamo una soluzione che collassa l'applicazione web ve il servizio API sulla stessa web app evitando di fare il deployment di due applicazioni. Mi rendo conto che diventa meno scalable ma è più gestibile in ambienti meno esigenti


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 27, 2026 03:19
…rogram.cs

Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
…ttings

Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement solution to collapse web app and API services Merge Web and API into unified deployment for simplified operations Jan 27, 2026
Copilot AI requested a review from robgrame January 27, 2026 03:31
Copilot AI and others added 18 commits January 27, 2026 03:35
… client

Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
…ient

Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
… prefix

Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
Co-authored-by: robgrame <12012136+robgrame@users.noreply.github.com>
…b-app-and-api

Remove Azure Queue support completely while maintaining all other features:

- Removed AzureQueueReportSink from .NET client

- Removed QueueProcessorService from API

- Removed Azure Queue configuration options

- Removed Queue health monitoring endpoints

- Removed Azure.Storage.Queues dependencies

- Updated PowerShell client to remove Azure Queue references

- Maintained sink validation functionality for PowerShell client

- Maintained AzureFunction, WebApi, and FileShare sink support

This merge simplifies the architecture by removing the intermediate queue layer.
…b project

Complete the Azure Queue removal by updating the Web project's ClientSinkConfigController to match the API project changes. Remove EnableAzureQueue and AzureQueue sink options from MapToSinkOptions method.
Add complete local deployment guide (Italian):

- DEPLOYMENT_GUIDE_LOCAL.md: 700+ lines comprehensive guide

- Deploy-LocalServer.ps1: Automated deployment script

- QUICKSTART_LOCAL.md: 15-minute quick start guide

Features:

- Step-by-step IIS, SQL Server, and .NET setup

- Database configuration with automated scripts

- IIS application pool and website creation

- Client PowerShell configuration

- Scheduled task creation for automated collection

- Comprehensive troubleshooting section

- Maintenance and backup procedures

- Security hardening best practices

Automation script includes:

- Prerequisites validation and installation

- Automated database setup

- IIS configuration with HTTPS

- Client deployment and scheduled task creation

- Post-deployment verification
Add README_DEPLOYMENT.md as central documentation hub:

- Links to all deployment guides (Quick Start, Complete Guide)

- Deployment scenarios (Test, Production, Enterprise)

- Pre-deployment checklist

- Architecture diagram (ASCII art)

- Quick commands reference

- Monitoring and health check commands

- Security checklist

- Common issues troubleshooting table

- Support resources
Add Test-Deployment.ps1 for post-deployment validation:

- Automated verification of all deployment components

- 50+ checks covering prerequisites, IIS, SQL, API, client

- Color-coded pass/fail/warning output

- Detailed and summary modes

- Functional tests (API POST, database writes)

- Security validation (HTTPS, SQL auth, permissions)

- Logging verification

- Overall health status with exit codes

- Actionable recommendations for failures
Critical fix: Update all deployment documentation and scripts

Changes:

- Update DEPLOYMENT_GUIDE_LOCAL.md to reference SecureBootDashboard.Web

- Update build command from SecureBootDashboard.Api to SecureBootDashboard.Web

- Update web.config to reference SecureBootDashboard.Web.dll

- Update migration instructions with better guidance

- Update Deploy-LocalServer.ps1 script with correct project

- Update Test-Deployment.ps1 to check for Web.dll

- Update QUICKSTART_LOCAL.md with correct project reference

- Update README_DEPLOYMENT.md with architecture clarification

- Add important note explaining unified architecture

Reason:

The unified application is in SecureBootDashboard.Web, not Api.

SecureBootDashboard.Web contains:

  - Razor Pages (Web UI)

  - API Controllers (REST endpoints)

  - SignalR Hubs (real-time)

  - Database layer (EF Core)

  - All services and business logic
Fix 10 compilation warnings (CS8602, CS8603, CS8601, SYSLIB0057)

Null Reference Warnings (CS8602/CS8603/CS8601):

- SecureBootReportsController: Use null-conditional operators for report.Device

- EfCoreReportStore: Add null-coalescing for UefiCa2023Status

- DeviceConfigurationController: Add null-conditional for Servicing property

- ExportService: Add null-conditional for RangeUsed() calls

- OfficeVersionsApiClient: Add explicit null checks for Data property

Obsolete API Warnings (SYSLIB0057):

- CertificateValidationService: Replace X509Certificate2 constructors

  with X509CertificateLoader.LoadCertificate()

- QueueProcessorService: Replace with X509CertificateLoader methods

  (LoadCertificateFromFile and LoadPkcs12FromFile)

Result: 0 warnings, clean build
Implement comprehensive event parsing based on Microsoft documentation

Changes:

- Expand SecureBootEventRecord with 15 structured fields:

  * UpdateType, BucketConfidenceLevel, BucketId, HResult

  * Device attributes (firmware, OEM, OS architecture)

  * UpdatesAvailable, ErrorCode, RebootRequired

  * AdditionalData dictionary for extensibility

- Create SecureBootEventParser class:

  * Parse event 1808 (boot manager signed with CA 2023)

  * Extract UpdateType (0 or 0x5944 for High Confidence)

  * Extract BucketConfidenceLevel deployment status

  * Parse device attributes from all relevant events

  * Handle events 1032-1045, 1795-1808

  * Use regex patterns for reliable text extraction

  * Parse XML EventData for additional fields

- Integrate parser into EventLogReader:

  * Call parser for every event collected

  * Populate all structured fields in SecureBootEventRecord

  * Maintain backward compatibility (Message, RawXml)

- Add comprehensive documentation:

  * SECURE_BOOT_EVENT_IDS.md with complete event reference

  * Document all event types, fields, and values

  * Explain correlation with deployment states

  * Include best practices for monitoring

Benefits:

- Enable definitive verification of CA 2023 boot manager signature

- Provide detailed deployment progress tracking

- Support advanced analytics and troubleshooting

- Follow official Microsoft event documentation

Reference: https://support.microsoft.com/en-us/topic/37e47cf8-608b-4a87-8175-bdead630eb69
- Add Get-SecureBootUpdateEvents to collect and summarize Secure Boot DB/DBX/KEK update events from Windows Event Logs, including Microsoft CA 2023 rollout status.
- Improve logging in Send-LogAnalyticsData with detailed request/response info and error diagnostics.
- Update Build-SecureBootReport to include event summaries and details in the report.
- Expand script output to show event breakdowns, last update times, failure warnings, and CA 2023 certificate update status.
- Bump script version to 1.8.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants