Files
SluijsensandClaude Sonnet 5.5 142815a3ab Opstart zonder mailconfiguratie getest voor alle hosts, Website__LogLevel zonder punt in de naam
Oorzaak 502 op ASF test: Email__Smtp__Host stond al in de omgeving maar App__PublicBaseUrl nog niet;
de startvalidatie weigert zo'n halve mailconfiguratie. Een host zonder enige mailinstelling start
gewoon: nu voor master, slave, SlpSoftware en ASF getest. Website__LogLevel vervangt de
Logging__LogLevel__SlpModularCms.Website-variabele, waarvan systemd de naam met punt negeert.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 20:40:50 +01:00

7.0 KiB

Infrastructure Design - andreaslop-client (U2, test environment only)

Status of the facts: the Pi details come from the Pi-Main inventory (unverified by this session) and are confirmed against deploy-scp.yaml. Items marked (verify) must be checked on the Pi by Bryan or the Pi-Main session before use. Production is out of scope.

Naming convention (project decision, Bryan, relayed by "CMS & API")

The website/company is Andrea Slop Fotografie. New names in code, config and infrastructure use AndreaSlopFotografie / andreaslopfotografie / andrea-slop-fotografie or the abbreviation ASF / Asf, whichever fits the local convention (env vars and Gitea variables/secrets ASF_..., PascalCase identifiers Asf... or the full name). Never "Andrea" or "AndreaSlop" alone for NEW names. Existing names stay (domain andreaslop.nl, host test.andreaslop.nl, website repo, feature slug andreaslop-site-hosting, DB AndreaSlopFotografieTest, DB user AndreaSlopFotografie).

Final new names: Gitea variables ASF_TEST_DEPLOY_ENABLED, DEPLOY_PATH_ASF_TEST, SERVICE_NAME_ASF_TEST, HEALTH_CHECK_URL_ASF_TEST, VITE_SENTRY_DSN_ASF; jobs publish-asf-test, deploy-asf-test; theme folder frontend/themes/asf/ with VITE_THEME=asf; project SlpModularCms.Api.AndreaSlopFotografie; Pi folder apps/andreaslopfotografie/test; unit andreaslopfotografie-test.service; env file shared/env; security-event label setup_token_rejected (generic, unchanged).

Which Sentry project (Q3 = B)

The DSNs (Observability__SentryDsn and VITE_SENTRY_DSN_ASF) must come from the existing Sentry project of the Andrea Slop Fotografie website, NOT from SlpSoftware's admin project. The Umami origin (analytics.slpsoftware.nl) appears only in the website CSP (StrictSite); the host and admin set up no Umami.

Component mapping

Logical component Infrastructure
Api.AndreaSlopFotografie host One .NET process (linux-arm64, framework-dependent) as systemd user unit andreaslopfotografie-test.service of user gitea-workflow, listening on http://0.0.0.0:5200
Admin SPA (themed) Built in CI, shipped inside the release (wwwroot/admin)
Website files wwwroot/web -> shared/wwwroot-web -> symlink to /mnt/storage1/www/html/andreaslop-test (Q1 = A). The website repo's own deploy keeps writing there; no host restart needed.
Database MariaDB 10.11 on the same Pi: database AndreaSlopFotografieTest, user AndreaSlopFotografie@localhost, rights on that database only (the host runs its own migrations at start)
TLS + public hostname Proxy Pi (192.168.1.102): test.andreaslop.nl -> HTTP/1.0 -> app Pi port 5200; certbot stays on the proxy Pi
Firewall ufw on the app Pi: port 5200/tcp only from 192.168.1.102
Build + deploy Gitea Actions: new jobs publish-asf-test (ubuntu-latest, -r linux-arm64) and deploy-asf-test (reuses deploy-scp.yaml, SSH as gitea-workflow with the existing PI_MAIN_* secrets)
Error reporting Existing website Sentry project (Q3 = B)
Backups Pi-Main adds AndreaSlopFotografieTest to the DB backup script

Pi layout (under the home of gitea-workflow, (verify) the absolute path)

apps/andreaslopfotografie/test/
  releases/<yyyymmddHHMMSS>/      written by the deploy
  current -> releases/<latest>    switched atomically by the deploy
  shared/
    env                           mode 600, secrets, read by the unit
    wwwroot-web -> /mnt/storage1/www/html/andreaslop-test
    modules/                      created by the deploy (empty)

Environment file shared/env (names only; values are created by Bryan, never committed)

Variable Value / source
ASPNETCORE_ENVIRONMENT Production
ASPNETCORE_URLS http://0.0.0.0:5200
ConnectionStrings__DefaultConnection Server=localhost;Port=3306;Database=AndreaSlopFotografieTest;Uid=AndreaSlopFotografie;Pwd=<db password>
JwtSettings__Secret random, at least 64 characters
Identity__Setup__Token random, at least 32 characters; remove after the first administrator exists
Observability__SentryDsn the website's existing Sentry DSN (backend; the admin reports through the same-origin /sentry-tunnel)
Observability__Environment test
ForwardedHeaders__KnownProxies__0 192.168.1.102
Website__LogLevel Information (test only). Replaces Logging__LogLevel__SlpModularCms.Website: a variable name containing a dot is ignored by a systemd EnvironmentFile. (The committed default log level is already Information, so the website logs 301/404 at that level without it.)

Committed defaults (in the client's appsettings.json, no secrets): SecurityHeaders with DefaultPolicy=StrictSite, the site's Umami and Sentry origins, Website:NoIndex=true (secure default; a later production setup must set it to false explicitly), JWT issuer/audience, rate limiting values.

Gitea (repository SlpModularCms) variables and secrets

Name Kind Value
DEPLOY_PATH_ASF_TEST variable absolute path of apps/andreaslopfotografie/test (verify)
SERVICE_NAME_ASF_TEST variable andreaslopfotografie-test (check whether the existing SlpSoftware variable includes .service; use the same form)
HEALTH_CHECK_URL_ASF_TEST variable https://test.andreaslop.nl/health
VITE_SENTRY_DSN_ASF variable the website's Sentry DSN (a public DSN, same value as backend)
ASF_TEST_DEPLOY_ENABLED variable true ONLY when everything else is ready (the on/off switch)
PI_MAIN_USERNAME, PI_MAIN_PASSWORD, PI_MAIN_PORT, PI_MAIN_ADDRESS secrets already exist and are reused; they must point at the same Pi and user (gitea-workflow, SSH port 2224)

Fixed in the workflow (not variables): VITE_THEME=asf, VITE_DEFAULT_LANGUAGE=nl, VITE_APP_ENV=test, VITE_APP_TITLE. No Umami for the admin.

Sentry and CSP check (answer to the question from the website side)

The admin sends browser errors to the same-origin path /sentry-tunnel (tunnel option), and the host forwards them to the destination derived from Observability__SentryDsn. The admin policy Strict (connect-src 'self') therefore needs no Sentry ingest origin; the website's own StrictSite list keeps its direct ingest host for the website's browser code. Variable names: backend Observability__SentryDsn (in shared/env), frontend build VITE_SENTRY_DSN_ASF (Gitea variable, passed to the build as VITE_SENTRY_DSN). Events from admin, host and website share one project; the environment tag (test) and the release/URL tell them apart.

Existing hosts touched by the shared change (option B)

Api, Api.SlpSoftware, Api.Slave get the new opt-in forwarded-headers code and per-client limiters. Until ForwardedHeaders__KnownProxies__0 is set in their environment and their proxy block passes X-Forwarded-For/-Proto, they behave as before (all callers share the proxy's address, same as today's global bucket). Enabling it for SlpSoftware test/production is an optional separate step in the manual list.