55 lines
3.2 KiB
Markdown
55 lines
3.2 KiB
Markdown
# Services: cms-api-foundation
|
|
|
|
The solution has no new domain services: step 0 adds hosting behaviour (middleware and policy) and build/deploy automation. This document defines the orchestration points.
|
|
|
|
## S1. Host composition (`CmsHost`)
|
|
|
|
- **Responsibility**: single place where a client host's services and pipeline are composed. `ConfigureServices` and `ConfigurePipeline` keep their signatures; the new behaviour enters through `CmsHostOptions`.
|
|
- **Orchestration (pipeline order, with the reason)**:
|
|
1. `MigrateCoreDatabase` (unchanged).
|
|
2. Exception handler, then security headers, then rate limiter (unchanged). Security headers must stay before static content: static files short-circuit the pipeline, and the website's HTML is almost all the host serves.
|
|
3. HTTPS redirection (unchanged).
|
|
4. **Static content**: admin mount first (unchanged). The website mount is either the existing static mount plus SPA fallback (`SpaFallback`) or the prerendered-site middleware (`PrerenderedPages`). Response compression sits before both.
|
|
5. CORS, modules, authentication, authorization, controllers, health, Sentry tunnel (unchanged).
|
|
6. The website fallback (`NotFound` -> `404.html`) is the last step, after the API routes, so an unknown API path stays an API 404.
|
|
- **Invariant**: reserved prefixes `/admin`, `/api/v1`, `/health` are never resolved by the website middleware.
|
|
|
|
## S2. Security header resolution (existing `PathPolicyResolver` + `CspPolicyCatalog`)
|
|
|
|
- **Responsibility**: path -> policy name (configuration) -> header values (code).
|
|
- **Change**: the catalog knows `StrictSite`. Andrea's client sets `DefaultPolicy = StrictSite`; the three reserved prefixes stay `Strict`. Startup validation rejects unknown names (unchanged), so a typo cannot produce a weaker policy.
|
|
|
|
## S3. Build and deploy service chain (CI)
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
box rgba(246,224,94,0.4) CMS repo
|
|
participant CC as CMS CI
|
|
end
|
|
box rgba(99,179,237,0.4) Web repo
|
|
participant WC as Web CI
|
|
end
|
|
box rgba(154,230,180,0.4) Test host
|
|
participant H as Andrea CMS host
|
|
end
|
|
CC->>CC: build admin with VITE_THEME andreaslop
|
|
CC->>CC: publish Api.AndreaSlopFotografie
|
|
CC->>H: deploy release, atomic switch
|
|
WC->>WC: build prerendered site
|
|
WC->>H: deliver files to wwwroot/web
|
|
WC->>H: verify headers, redirects, 404, CSP
|
|
H-->>WC: results
|
|
```
|
|
|
|
Text alternative: the CMS CI builds and deploys the host with its themed admin; the web CI builds the site, delivers it into the host's website folder and then verifies the host's behaviour.
|
|
|
|
- **Ordering rules**: the CMS release switch never touches `wwwroot/web/`; the web delivery is idempotent and can run without a CMS deploy; the old static test site stays up until verification passes.
|
|
|
|
## S4. Verification service (`verify-deployment.sh`)
|
|
|
|
- **Responsibility**: the contract test between the repositories. It runs from the web repo against the live host and is the CSP drift guard (design decision Q3).
|
|
|
|
## S5. Hand-off service (process)
|
|
|
|
- **Responsibility**: brief out, hand-back in; see C9. The CMS session's AIDLC outputs (its design summary and its hand-back note) are copied or linked under `construction/cms-host/` in this feature.
|