# Infrastructure Design Plan - andreaslop-client (U2) ## Steps - [x] Analyse design artifacts (NFR requirements/design, `pi-inventory-notes.md`, `deploy-scp.yaml`, `continuous_integration.yaml`) - [x] Collect answers to the questions below - [x] Generate `infrastructure-design/infrastructure-design.md` (components, Pi layout, env variables, Gitea variables/secrets) - [x] Generate `infrastructure-design/deployment-architecture.md` (diagrams, deploy sequence) - [x] Generate `infrastructure-design/manual-steps-for-bryan.md` (complete ordered list, both web-delivery variants) - [x] Tell "CMS & API" the list is complete so Pi-Main can draft the commands ## Category evaluation - Deployment environment: on-premise Pis, test only (decided). Pattern copied from SlpSoftware test. - Compute: one .NET process (~250-300 MB), systemd user unit, port 5200; sizing fits the Pi 4 (decided). - Storage: MariaDB 10.11 `AndreaSlopFotografieTest` / `AndreaSlopFotografie@localhost` (decided); website files either in the release tree or on `/mnt/storage1` (Question 1). - Messaging: not applicable. - Networking: proxy Pi (TLS, certbot) forwards HTTP/1.0 to 192.168.1.102 -> app port 5200; ufw only from the proxy Pi; the proxy block must pass `X-Forwarded-For`/`-Proto` (decided by option B); first-deploy sequence (Question 2). - Monitoring: `/health`, logs via journald, Sentry (Question 3). - Shared infrastructure: runner (arm64 label for builds is NOT needed: publish runs on ubuntu-latest with `-r linux-arm64` exactly like SlpSoftware), the SSH deploy secrets `PI_MAIN_*`, the DB backup script (Pi-Main adds the new DB). ## Question 1: How does the website reach `wwwroot/web` on the test host? Both variants work without restart (U1 looks pages up per request). Which one do we document as THE path? - A) Symlink: `shared/wwwroot-web` points to `/mnt/storage1/www/html/andreaslop-test`, the folder the existing web deploy already writes to, so the current website pipeline keeps working unchanged (recommended: no change in the website repo; files live on the big disk, not on the SD card) - B) Direct: the website CI copies its build into `shared/wwwroot-web` on the SD card (needs a change in the website pipeline and its target path) - X) Other (please describe after [Answer]: tag below) [Answer]: A (relayed via CMS and API, Bryan): symlink shared/wwwroot-web to /mnt/storage1/www/html/andreaslop-test; website repo deploy unchanged. ## Question 2: Health check and the first deploy The deploy workflow checks `/health` on the PUBLIC test URL after switching the release. That URL (`test.andreaslop.nl`) still points at the old nginx fallback until you switch the proxy-Pi route, so a first deploy before the switch fails its health check (the new release is then already live on port 5200, only the job is red). - A) Switch the proxy-Pi route to port 5200 first, then run the first deploy; the test site is down only for the minutes between the switch and the first successful deploy (recommended: simplest, test environment) - B) Deploy first with the health-check variable pointing to a temporary URL that already reaches port 5200 (extra hostname + certificate work for you), then switch the route - C) Deploy first, accept one red health check, verify manually on port 5200 from the proxy Pi, then switch the route - X) Other (please describe after [Answer]: tag below) [Answer]: A (relayed via CMS and API, Bryan): switch the proxy-Pi route to port 5200 first, then run the first deploy; short downtime accepted; order and nginx fallback revert explicit in the manual steps. ## Question 3: Sentry for the new host and its admin - A) A new, separate Sentry project for the CMS host and admin, DSNs supplied through `shared/env` (backend `Observability__SentryDsn`) and the Gitea variable `VITE_SENTRY_DSN_ASF` (frontend) (recommended: keeps the website's own Sentry project clean) - B) Reuse the website's existing Sentry project (same DSN) for host and admin - C) No Sentry for now (empty DSN is a supported state); add later - X) Other (please describe after [Answer]: tag below) [Answer]: B (relayed via CMS and API, Bryan): reuse the website existing Sentry project (same DSN) for host and admin.