Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b47b587c6a | ||
|
|
f3eadb3eb9 | ||
|
|
88832cb677 | ||
|
|
0d08d1524b |
@@ -84,23 +84,13 @@ jobs:
|
||||
run: pnpm test
|
||||
|
||||
# Sentry toont bij elke fout uit welke commit de build komt
|
||||
# Dit artefact (dist) is ook wat naar productie gaat: met de gecommitte
|
||||
# pakketlijst (snapshot), zonder testadres en met dicht formulier. De
|
||||
# CMS-host schrijft de actuele gegevens bij elk verzoek in de HTML.
|
||||
# Dit artefact (dist) is ook wat naar productie gaat: bewust zonder
|
||||
# OFFERINGS_URL, dus met de gecommitte pakketlijst. De testbuild met de
|
||||
# pakketten uit het CMS is job build-test.
|
||||
- name: Build
|
||||
run: |
|
||||
# Zonder deze waarden meet de site stilletjes niets: liever een rode build
|
||||
for name in VITE_SENTRY_DSN VITE_UMAMI_SCRIPT_URL VITE_UMAMI_WEBSITE_ID; do
|
||||
[ -n "${!name}" ] || { echo "$name ontbreekt: stel de Gitea-variabele PROD_${name#VITE_} in"; exit 1; }
|
||||
done
|
||||
pnpm build
|
||||
run: pnpm build
|
||||
env:
|
||||
VITE_RELEASE: ${{ github.sha }}
|
||||
# Monitoring van de productiesite (src/monitoring/config.ts)
|
||||
VITE_APP_ENV: production
|
||||
VITE_SENTRY_DSN: ${{ vars.PROD_SENTRY_DSN }}
|
||||
VITE_UMAMI_SCRIPT_URL: ${{ vars.PROD_UMAMI_SCRIPT_URL }}
|
||||
VITE_UMAMI_WEBSITE_ID: ${{ vars.PROD_UMAMI_WEBSITE_ID }}
|
||||
|
||||
- name: Audit (productiepakketten, blokkerend)
|
||||
run: pnpm audit:deps
|
||||
@@ -115,10 +105,10 @@ jobs:
|
||||
path: web/dist/client/
|
||||
retention-days: 7
|
||||
|
||||
# De build voor de testsite: zelfde code als dist, maar met het eigen adres
|
||||
# van de testsite en het formulier open. De pakketten komen niet meer uit
|
||||
# het CMS bij de build: de CMS-host injecteert ze bij elk verzoek.
|
||||
# Productie krijgt dit artefact nooit.
|
||||
# De build voor de testsite: zelfde code als dist, maar met de pakketten uit
|
||||
# het CMS van de testomgeving (OFFERINGS_URL uit de repo-variabele
|
||||
# ASF_OFFERINGS_URL_TEST). Productie krijgt dit artefact nooit: die blijft op
|
||||
# dist met de gecommitte lijst tot er een productie-CMS is.
|
||||
build-test:
|
||||
needs: check
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
@@ -147,20 +137,11 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build (testomgeving)
|
||||
run: |
|
||||
# Zonder deze waarden meet de site stilletjes niets: liever een rode build
|
||||
for name in VITE_SENTRY_DSN VITE_UMAMI_SCRIPT_URL VITE_UMAMI_WEBSITE_ID; do
|
||||
[ -n "${!name}" ] || { echo "$name ontbreekt: stel de Gitea-variabele TEST_${name#VITE_} in"; exit 1; }
|
||||
done
|
||||
pnpm build
|
||||
- name: Build (testomgeving, pakketten uit het CMS)
|
||||
run: pnpm build
|
||||
env:
|
||||
VITE_RELEASE: ${{ github.sha }}
|
||||
# Monitoring van de testsite (src/monitoring/config.ts)
|
||||
VITE_APP_ENV: test
|
||||
VITE_SENTRY_DSN: ${{ vars.TEST_SENTRY_DSN }}
|
||||
VITE_UMAMI_SCRIPT_URL: ${{ vars.TEST_UMAMI_SCRIPT_URL }}
|
||||
VITE_UMAMI_WEBSITE_ID: ${{ vars.TEST_UMAMI_WEBSITE_ID }}
|
||||
OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL_TEST }}
|
||||
# De testsite staat op zichzelf: canonical, og:url, og:image,
|
||||
# JSON-LD en sitemap wijzen naar het eigen adres, zodat een gedeelde
|
||||
# link (WhatsApp, Discord) ook zijn eigen plaatje toont. Alleen in
|
||||
@@ -216,10 +197,10 @@ jobs:
|
||||
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
|
||||
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
|
||||
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||
DEPLOY_PATH: ${{ vars.TEST_DEPLOY_PATH }}
|
||||
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
run: |
|
||||
case "$DEPLOY_PATH" in
|
||||
''|'/'|*' '*) echo "TEST_DEPLOY_PATH ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;;
|
||||
''|'/'|*' '*) echo "DEPLOY_PATH_TEST ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;;
|
||||
esac
|
||||
sudo apt-get update && sudo apt-get install -y sshpass
|
||||
SSH="sshpass -e ssh -p $SSH_PORT -o StrictHostKeyChecking=accept-new $SSH_USER@$SSH_HOST"
|
||||
@@ -242,17 +223,18 @@ jobs:
|
||||
# dus staan voor de deploy (zie pi-install-instructions.md).
|
||||
- name: Controle na deploy
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.TEST_HEALTH_URL }}
|
||||
# De CSP komt uit dezelfde bron als de build (Umami en Sentry)
|
||||
VITE_APP_ENV: test
|
||||
VITE_SENTRY_DSN: ${{ vars.TEST_SENTRY_DSN }}
|
||||
VITE_UMAMI_SCRIPT_URL: ${{ vars.TEST_UMAMI_SCRIPT_URL }}
|
||||
VITE_UMAMI_WEBSITE_ID: ${{ vars.TEST_UMAMI_WEBSITE_ID }}
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
# 'true' zodra test.andreaslop.nl door de CMS-host (Api.AndreaSlopFotografie)
|
||||
# wordt bediend in plaats van nginx: dan controleert het script ook de
|
||||
# exacte CSP en de CMS-routes. Zet hem om samen met de proxy-route.
|
||||
SERVED_BY_CMS: ${{ vars.ASF_TEST_SERVED_BY_CMS }}
|
||||
run: |
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen TEST_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi
|
||||
# test.andreaslop.nl wordt door de CMS-host bediend: het script
|
||||
# controleert ook de exacte CSP en de CMS-routes
|
||||
EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi
|
||||
if [ "$SERVED_BY_CMS" = "true" ]; then
|
||||
EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms
|
||||
else
|
||||
bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test
|
||||
fi
|
||||
echo "Test bereikbaar en gelijk aan de build"
|
||||
|
||||
# Lighthouse tegen de gebouwde site (mobiel en desktop)
|
||||
@@ -368,10 +350,10 @@ jobs:
|
||||
# Deze job kan pas draaien als er een webhost is.
|
||||
- name: Upload naar productie (FTPS)
|
||||
env:
|
||||
FTP_HOST: ${{ secrets.PROD_HOST_ADDRESS }}
|
||||
FTP_USER: ${{ secrets.PROD_HOST_USERNAME }}
|
||||
LFTP_PASSWORD: ${{ secrets.PROD_HOST_PASSWORD }}
|
||||
FTP_DIR: ${{ vars.PROD_DEPLOY_PATH || 'wwwroot' }}
|
||||
FTP_HOST: ${{ secrets.FTP_HOST }}
|
||||
FTP_USER: ${{ secrets.FTP_USERNAME }}
|
||||
LFTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
||||
FTP_DIR: ${{ vars.FTP_REMOTE_DIR || 'wwwroot' }}
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y lftp
|
||||
bash deploy/upload-production.sh dist "$FTP_DIR"
|
||||
@@ -379,8 +361,8 @@ jobs:
|
||||
|
||||
- name: Controle na deploy
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.PROD_HEALTH_URL }}
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }}
|
||||
run: |
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen PROD_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_PRODUCTION ingesteld; overgeslagen"; exit 0; fi
|
||||
bash deploy/verify-deployment.sh "$HEALTH_URL" dist
|
||||
echo "Productie bereikbaar en gelijk aan de build"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# AI-DLC state: asf-production-iis
|
||||
|
||||
- Feature: ASF production on IIS and the production pipeline (plus the privacy statement as JSON)
|
||||
- Branch: feature/asf-production-iis (from origin/master, 2026-11-18)
|
||||
- Lane: Feature
|
||||
- Stage: Inception, plan written ([plan.md](plan.md)); nothing executed
|
||||
- Language: documentation in Dutch for this plan (instruction of the owner via SLP Software - SLS - Main); conversation in Dutch
|
||||
- Extensions: none enabled for this plan
|
||||
- Origin: written by SLP Software - SLS - Main while "Andrea Slop Fotografie - ASF - Main" was offline and the owner away; the ASF session can continue from this
|
||||
- Open: questions V1-V10 and assumptions A1-A8 in plan.md
|
||||
@@ -0,0 +1,5 @@
|
||||
# Audit: asf-production-iis
|
||||
|
||||
## 2026-11-18 Plan written
|
||||
**User Input** (relayed): "ASF productie op IIS en de pipeline fixen; privacyverklaring en JSON meenemen; Bryan is niet bij de computer; stel een plan op."
|
||||
**AI Response**: Read the CI workflow, deploy docs, go-live and joint-release checklists, the contact-form and frontend-shell operations records, the CMS workflow and the media-library production rollout. Recorded what is wrong with the production path (static FTPS design from before the host-as-single-entry decision, missing FTP secrets, no ASF production path in the CMS pipeline) in plan.md with assumptions and questions. No workflow file changed, nothing deployed.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Oude WordPress-URL's van andreaslop.nl en de redirects
|
||||
|
||||
Vastgesteld op 2026-11-18 door de publieke site te lezen (alleen GET, geen formulieren, geen login). Bron: `/wp-sitemap.xml` (doorverwezen naar `/sitemap_index.xml`, Yoast SEO), `/wp-json/wp/v2/pages`, `/feed` en steekproeven per groep.
|
||||
|
||||
## Wat er nu op andreaslop.nl staat
|
||||
|
||||
Op 2026-11-18 draait daar nog de **oude WordPress-site** (Elementor, thema Solene van Qode, Yoast SEO, nginx). Dus de DNS wijst nog niet naar de Pi of de nieuwe site. De pagina's staan als `index, follow` en zijn dus geïndexeerd. Het zijn vijf echte pagina's; de rest is thema-demo-inhoud (o.a. `og:image` van `solene.qodeinteractive.com`, een "Test Masonry Gallery").
|
||||
|
||||
`/wp-json/wp/v2/posts` is leeg (`[]`): er zijn geen blogberichten.
|
||||
|
||||
## Tabel
|
||||
|
||||
Alle oude URL's eindigen op een `/`; de nieuwe site gebruikt het pad zonder slash en de host verwijst canoniek door (te controleren in stap 2, zie `plan.md`). Redirects zijn 301 tenzij anders vermeld.
|
||||
|
||||
| Oude URL (pad) | Nieuwe pagina | Soort | Opmerking |
|
||||
| --- | --- | --- | --- |
|
||||
| `/` | `/` | geen redirect nodig | Zelfde pad. |
|
||||
| `/over-mij/` | `/over-mij` | 301 (slash) | Zelfde slug. |
|
||||
| `/portfolio/` | `/portfolio` | 301 (slash) | Zelfde slug. |
|
||||
| `/soorten-fotoshoots/` | `/soorten-fotoshoots` | 301 (slash) | Zelfde slug; de nieuwe site heeft er subpagina's bij (newborn, zwangerschap, gezin, loveshoot, portret), die op WordPress niet bestonden. |
|
||||
| `/contact/` | `/contact` | 301 (slash) | Zelfde slug. |
|
||||
| `/?page_id=17`, `1253`, `2511`, `3443`, `7667` | `/`, `/over-mij`, `/portfolio`, `/soorten-fotoshoots`, `/contact` | 301 | Korte-linkvorm van WordPress; `?p=17` ook naar `/`. Alleen als IIS/de host query-strings kan matchen; anders weglaten (zie vragen). |
|
||||
| `/portfolio-item/` en `/portfolio-item/<naam>/` (15 stuks: decoration, wedding-dress, best-girls, mm-1, wedding-cake, mm2, cake-smash-1, hairstyles, 360, 366, 353, homepage-foto, getting-ready, m1, f1) | `/portfolio` | 301 | Dit zijn losse galerij-items van het thema met titels als "M3"; ze zijn wel geïndexeerd. De nieuwe site heeft geen losse itempagina's, dus alles naar `/portfolio`. |
|
||||
| `/portfolio-tag/*` (homepage, portfolio-gallerij, simple) | `/portfolio` | 301 | Zelfde reden; of 410, zie vragen. |
|
||||
| `/masonry-gallery-category/*` | geen equivalent | 410 (of 404) | Thema-demo ("Test Masonry Gallery"). |
|
||||
| `/testimonials-category/*` | `/` | 301 | Alleen een archief van het thema; de ervaringen staan op de homepage. |
|
||||
| `/category/*`, `/tag/*`, `/author/*` | geen equivalent | 404 | Geen blogberichten. |
|
||||
| `/feed/`, `/comments/feed/` | geen equivalent | 410 | Geen berichten; de nieuwe site heeft geen feed. |
|
||||
| `/sitemap_index.xml`, `/wp-sitemap.xml`, `/page-sitemap.xml`, `/portfolio-item-sitemap.xml`, enz. | `/sitemap.xml` | 301 | Zodat zoekmachines de nieuwe sitemap vinden. |
|
||||
| `/wp-admin/*`, `/wp-login.php`, `/xmlrpc.php`, `/wp-json/*`, `/wp-content/plugins/*`, `/wp-content/themes/*` | geen equivalent | 404 | Niet doorverwijzen; scanners komen hier. `/wp-json` kan op de nieuwe host niet bestaan; 404 is correct. |
|
||||
| `/wp-content/uploads/*` | geen equivalent | 404 (of 410) | Oude afbeeldingen staan niet meer op de nieuwe site; verwijzen naar `/` is misleidend. Beperk het verlies door de beste afbeeldingspagina's (home, over mij, portfolio) te laten staan. |
|
||||
| `/?s=...` (zoeken) | geen equivalent | 404 | De nieuwe site heeft geen zoekfunctie; op WordPress al `noindex`. |
|
||||
| `/robots.txt` | `/robots.txt` | n.v.t. | Op de oude site een 404 van nginx. Check dat de nieuwe site er een heeft. |
|
||||
|
||||
## Voorstel voor de implementatie
|
||||
|
||||
- Alleen de vijf echte pagina's en de sitemap-URL's krijgen een 301 naar een echte nieuwe pagina; de rest is 404/410. Dat is het minimum dat zoekverkeer behoudt zonder de nieuwe site met WordPress-restanten te belasten.
|
||||
- Waar: `web/config/serverConfig.ts` (gegenereerd `web.config`; nooit met de hand) of de CMS-host, afhankelijk van wat stap 2 van `plan.md` besluit. Een test die het gegenereerde bestand vergelijkt met de gecommitte versie blijft gelden.
|
||||
- Voeg een test toe die elke `301`-regel voor een van de vijf pagina's op de bijbehorende nieuwe pagina controleert.
|
||||
|
||||
## Wat niet te verifiëren was
|
||||
|
||||
- Of er extra oude URL's bestaan die niet in de sitemap staan (bijvoorbeeld door Google geïndexeerde bijlage-pagina's `/?attachment_id=` of oudere permalinkstructuren). Zoek in Google Search Console naar geïndexeerde pagina's voordat de oude site uitgaat.
|
||||
- Of externe sites (Instagram-bio, Google Bedrijfsprofiel, visitekaartjes) naar andere URL's verwijzen dan de vijf pagina's. Controleer dat bij Andrea.
|
||||
- De redirectsoort voor `portfolio-tag` en voor `/wp-content/uploads` (301 naar `/portfolio` of 404/410) is een keuze, geen vaststaand feit.
|
||||
- De publieke site wees op 2026-11-18 naar nginx-servers (twee versies in de antwoorden). Ik heb niet vastgesteld waar de site precies draait.
|
||||
|
||||
## Vragen voor Bryan
|
||||
|
||||
1. Kan de host/IIS query-strings matchen (`?page_id=`), of laten we die redirects weg? (Weinig gebruikt.)
|
||||
2. Zet Andrea de oude sitemap in Google Search Console en zijn er bekende externe links (Instagram, Google Bedrijfsprofiel)?
|
||||
3. Redirect `portfolio-item` naar `/portfolio`, of liever 410 omdat het thema-demo is?
|
||||
@@ -0,0 +1,189 @@
|
||||
# Plan: ASF in productie op IIS en de productiepipeline
|
||||
|
||||
Status (2026-11-18): **alleen een plan**. Niets uitgevoerd, niets naar productie, geen release-branch, geen workflow-bestand gewijzigd. Opgesteld door SLP Software - SLS - Main omdat de ASF-sessie offline was en Bryan niet bij de computer; de ASF-sessie kan hierop doorbouwen. Alles wat onbekend is staat als **aanname, te controleren** (A1, A2, ...), de vragen voor Bryan staan onderaan (V1, V2, ...).
|
||||
|
||||
Uitgangspunten (Bryan): de pipeline-fix gebeurt in een feature-branch (`feature/asf-production-iis`), nooit in een release-branch tenzij Bryan dat vraagt. Productie alleen op zijn expliciete go. De CMS-host is het enige ingangspunt van de website (besluit 2026-11-15, `docs/cms-integration.md`, "Hosting").
|
||||
|
||||
## 1. Wat er nu staat (met bewijs)
|
||||
|
||||
| Onderdeel | Stand | Bewijs |
|
||||
| --- | --- | --- |
|
||||
| ASF-test | Werkt: master-push bouwt `dist-test`, uploadt naar de Pi (scp), controleert na deploy. De CMS-host op de Pi bedient site, `/admin` en `/api/v1`. | Laatste runs 782 t/m 789 op master/dispatch zijn groen. Run 761 faalde één keer op `lighthouse` (performance op de Pi, daarna groen). |
|
||||
| ASF-productie (ASF-repo) | Job `deploy-production` bestaat: handmatig, alleen vanaf `release/*`, upload van `dist` met **FTPS** (`web/deploy/upload-production.sh`) en een gegenereerde `web/deploy/iis/web.config` die **zelf statische bestanden serveert**. | `.gitea/workflows/continuous_integration.yaml` (job `deploy-production`), `web/deploy/iis/web.config` (rewrite naar `{R:1}.html`, 404.html, geen doorgeven aan de host). |
|
||||
| Strijdig met het besluit | Dat ontwerp is van vóór 2026-11-15: de host moet álle verzoeken krijgen (pagina's, `/admin`, `/api/v1`), IIS doet alleen redirects en pass-through. Zonder dat toont productie de ingebakken snapshot en geeft elke pageview een 404 voor de API. | `docs/cms-integration.md` ("Production: not in place yet"), `docs/go-live-checklist.md` ("Packages and banners"). |
|
||||
| Geheimen/variabelen | Aanwezig: secrets `PI_MAIN_*`; variabelen `DEPLOY_PATH_TEST`, `HEALTH_CHECK_URL_TEST`, `HEALTH_CHECK_URL_PRODUCTION`, `FTP_REMOTE_DIR`, `ASF_OFFERINGS_URL_TEST`. **Ontbreekt:** `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD`. De productiejob kan dus niet draaien. | Gitea API-lijst van secrets en variabelen (alleen namen). |
|
||||
| CMS-pipeline (CMS-repo) | Inputs `deploy_sls_test`, `deploy_sls_production`, `deploy_asf_test`. Er is **geen** `deploy_asf_production`: "Test only: there is no production path for ASF". Publiceren is `linux-arm64`, `--self-contained false`; uitrollen is `deploy-scp.yaml` (SSH, `releases/`, symlink `current`, systemd user-unit). Voor IIS is geen van drie bruikbaar. | CMS `master`, `.gitea/workflows/continuous_integration.yaml` (`PUBLISH_RID: linux-arm64`, `publish-asf-test`, `deploy-asf-test`). |
|
||||
| Twee repo's, twee pipelines | De ASF-repo bouwt de site (`dist`), de CMS-repo bouwt de host. Op test regelt de ASF-pipeline dat `dist-test` in de prerendered-map van de host landt. Voor productie is niet beschreven hoe en in welke volgorde beide op de IIS-host komen. | `joint-release-checklist.md` (SLS `aidlc-docs/_shared`): "ASF IIS publish pipeline exists (own feature: self-contained win-x64 publish, FTP upload, web.config, the CMS host as the single entry)". |
|
||||
| Productie-artefact | `dist` uit job `check`: zonder `OFFERINGS_URL` (snapshot), zonder `VITE_SITE_URL`, formulier dicht. Bewust zo. | `docs/deploy-and-ci.md`. |
|
||||
|
||||
Samengevat: de testpijplijn is gezond; wat ontbreekt of verkeerd is, is het hele productiepad (ontwerp, repo-overstijgende volgorde, secrets, CMS-kant, verificatie).
|
||||
|
||||
## 2. Doelarchitectuur op IIS (MijnHostingPartner)
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
B[Bezoeker] -->|HTTPS| I[IIS, redirects www en HTTPS]
|
||||
I -->|alle verzoeken| H[CMS-host Api.AndreaSlopFotografie]
|
||||
H --> P[prerendered dist, host injecteert pakketten, banners, hero]
|
||||
H --> A["/admin en /api/v1"]
|
||||
H --> D[(Database)]
|
||||
H --> M[Mediamap]
|
||||
H --> S[SMTP, captcha uit]
|
||||
classDef edge fill:#f6e05e,stroke:#c05621,color:#000;
|
||||
classDef host fill:#63b3ed,stroke:#2b6cb0,color:#000;
|
||||
classDef data fill:#9ae6b4,stroke:#2f855a,color:#000;
|
||||
class I edge;
|
||||
class H,P,A host;
|
||||
class D,M,S data;
|
||||
```
|
||||
|
||||
Tekstalternatief: de bezoeker komt bij IIS, dat alleen redirects doet en alles doorgeeft aan de CMS-host; de host serveert de pagina's, de admin en de API en gebruikt database, mediamap en mail.
|
||||
|
||||
- **Host publiceren:** self-contained `win-x64` (de host hoeft dan geen runtime geïnstalleerd te hebben) met `web.config` voor de ASP.NET Core Module. In-process of out-of-process hangt af van wat het pakket biedt (A1).
|
||||
- **Site (`dist`)** gaat naar de prerendered-map van de host (op test `wwwroot-web`; op IIS een map naast de app, A2). De host injecteert de live data (cache 60 s); een inhoudswijziging vraagt geen rebuild.
|
||||
- **IIS-`web.config`:** nog steeds gegenereerd door `web/config/serverConfig.ts` (nooit met de hand), maar nieuw: alleen redirect www -> apex, HTTP -> HTTPS, en doorgeven aan de host. De bestaande canonieke redirects (`index`, hoofdletters, slash) doet de host op test ook; de eerste stap is te controleren welke de host al doet en wat IIS moet blijven doen. Beveiligingsheaders komen van de host, zoals op test.
|
||||
- **Geheimen:** als environment-variabelen, niet in de repo. Op IIS is dat `web.config` of het hostingpaneel; wie FTP-toegang heeft ziet ze (risico R3). Aanname A3: het paneel ondersteunt dat.
|
||||
- **Database:** de CMS-host gebruikt MariaDB/MySQL. Aanname A4: het hostingpakket levert een MariaDB/MySQL-database en een back-upmogelijkheid. Is dat niet zo, dan is dit een blokkade en komt er een alternatief (V3).
|
||||
- **Mediamap:** schrijfbare map buiten de gedeployde release, zodat een deploy foto's niet wist (zoals `shared/` op de Pi). Hier is een persistent pad nodig (A2).
|
||||
- **Mail:** SMTP van MijnHostingPartner, afzender in `Email:AllowedFromAddresses`, ontvanger via de omgeving, SPF/DKIM controleren met een echte mail (go-live-checklist).
|
||||
- **Captcha:** blijft **uit** bij go-live tot er een betaald Friendly Captcha-plan is; het formulier blijft dicht (`VITE_CONTACT_FORM_ENABLED` niet gezet) tot Bryans go.
|
||||
- **HTTPS:** certificaat via het hostingpakket, HSTS pas na een geslaagde proefperiode (A5).
|
||||
- **Client-IP/ratelimit:** `ForwardedHeaders:KnownProxies` en `ClientPartitionKey` voor de IIS-situatie (bestaande eis uit `contact-api-contract.md`).
|
||||
|
||||
## 3. Pipeline-wijzigingen stap voor stap
|
||||
|
||||
Alles in feature-branches, geen release-branch. Elke stap die iets op productie raakt wacht op Bryans go.
|
||||
|
||||
**Stap 0 - hostingfeiten vaststellen (geen code).** Beantwoord A1 t/m A6 en V1 t/m V4 door het pakket te bekijken of een proef-upload te doen. De joint-release-checklist zegt: "open hosting questions are answered by trying it with ASF". Een proef op een tijdelijk subdomein (bijvoorbeeld `staging.andreaslop.nl`) is de veiligste manier (V2).
|
||||
|
||||
**Stap 1 - CMS-repo (SMC, eigen feature-branch).**
|
||||
1. Publiceer-job `publish-asf-production`: `dotnet publish -r win-x64 --self-contained true`, adminbouw met `VITE_APP_ENV=production`, `VITE_THEME=asf`, `VITE_DEFAULT_LANGUAGE=nl`.
|
||||
2. Deploy-job voor IIS: FTPS-upload in rondes (zoals `upload-production.sh`), met `app_offline.htm` tijdens het vervangen van de host-bestanden en een kopie van de vorige release voor terugdraaien.
|
||||
3. Nieuwe input `deploy_asf_production`, gate zoals SLS-productie (V5: `release/*` of vervangen door een goedkeuringsstap).
|
||||
4. `scripts/smoke-site.sh` uitbreiden met een `asf-production`-modus.
|
||||
5. Voorlopig uit via een variabele (zoals `ASF_TEST_DEPLOY_ENABLED`) zodat niets verandert tot alles klaar is.
|
||||
|
||||
**Stap 2 - ASF-repo (deze branch, `feature/asf-production-iis`).**
|
||||
1. `serverConfig.ts` en de gegenereerde `web/deploy/iis/web.config` omzetten naar "redirects + pass-through"; de test die gegenereerd en gecommit vergelijkt blijft gelden.
|
||||
2. Job `deploy-production` herschrijven: `dist` via FTPS naar de prerendered-map van de host (assets eerst, HTML als laatste, daarna opruimen; bestaand idee van `upload-production.sh`, nieuw doelpad en géén `web.config`-kopie), daarna `verify-deployment.sh ... --cms` tegen de productie-URL (genormaliseerd vergelijken zoals op test).
|
||||
3. Secrets/variabelen laten aanmaken door Bryan of SLS (feature-sessies wijzigen repo-variabelen niet): `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD`, `FTP_REMOTE_DIR`, `HEALTH_CHECK_URL_PRODUCTION`.
|
||||
4. Docs bijwerken in dezelfde wijziging (`docs/deploy-and-ci.md`, `docs/go-live-checklist.md`, `docs/cms-integration.md`), zoals `AGENTS.md` eist.
|
||||
5. Lighthouse op de Pi is flaky (run 761). Voorstel: performance blijft "melden" zoals nu; de overige categorieën blokkeren.
|
||||
|
||||
**Stap 3 - repetitie op de proefomgeving (zonder productie).**
|
||||
1. Beide pipelines draaien naar de proefomgeving (A6) met testwaarden (testpakketten, `noindex`).
|
||||
2. Controleren: `/health`, `/admin`, een echte pagina, injectie van pakketten/banners/hero, headers (CSP), redirects, een upload (ook HEIC op win-x64, R4), een mail.
|
||||
3. Terugdraaien oefenen (sectie 6).
|
||||
|
||||
**Stap 4 - go-live (alleen met Bryans go, in de gezamenlijke release).** Volgorde uit de `joint-release-checklist.md`: SLS-CMS-productie, daarna de SLS-website, daarna ASF. Zie sectie 7.
|
||||
|
||||
## 4. Hoe de mediabibliotheek-uitrol erin past
|
||||
|
||||
- CMS PR #29 (gemerged op master van het CMS, op test gedeployed): bij de start doet de host de kopie `HeroImages -> MediaAssets`, controleert streng en dropt pas daarna; bij een weigering start de app niet (Critical-regel). Productie van SLS gaat dus in één release (`production-rollout.md` in de CMS-repo).
|
||||
- **ASF-productie begint zonder database (A7):** er is nog geen ASF-productie-CMS met hero-foto's. De migraties lopen op een lege database en `HeroImages` is leeg; de guard laat een lege tabel door. Voor ASF is er dus **geen** kopie en geen drop met data. Het "verse herstelpunt" uit `production-rollout.md` geldt voor **SLS-productie**; voor ASF is een database-back-up vóór de eerste echte beheerdersdata genoeg, maar de back-upprocedure moet er wel zijn (V3).
|
||||
- **Seeden:** daarna eerst beheerder aanmaken (setup-token, verwijderen na gebruik), echte pakketten invoeren, hero seeden en `offerings.snapshot.json` vullen met de echte pakketten (go-live-checklist).
|
||||
- **Volgorde:** de productie-CMS moet de echte pakketten hebben vóór er verkeer komt; het productie-artefact bevat de testprijzen nooit.
|
||||
|
||||
## 5. Privacyverklaring en JSON
|
||||
|
||||
- **Tekst:** het goedgekeurde concept van 17-11-2026 staat in `aidlc-docs/_shared/privacyverklaring-asf-concept-2026-11-17.txt` (SLS-repo). Andrea controleert het nog; het is de basis voor livegang (Bryan, 2026-11-17).
|
||||
- **Code:** op `master` is `/privacyverklaring` nog een placeholder. De opzet (`privacyContent.ts`, `PrivacyNote`, tests) staat op `feature/privacy-statement` (2 commits voor, 59 achter op master). Stap: die wijzigingen op master laten aansluiten en overnemen in deze branch.
|
||||
- **JSON:** `privacyContent.ts` wordt een JSON-bestand (bijvoorbeeld `web/src/content/privacy.nl.json`), samen met de definitieve tekst. Behouden: de `PLACEHOLDER_MARK`-controle (`unresolvedPlaceholders()`), de captcha-sectie (`onlyWithCaptcha`, verborgen zolang captcha uit staat) en hun tests; plus een vormtest voor het JSON-bestand. Privacy blijft een eigen bestand en komt niet in `nl.json`, omdat het juridische tekst met een eigen reviewproces is (A8).
|
||||
- **Voorwaarden voor livegang** (go-live-checklist): Bryan en Andrea keuren de tekst goed; MijnHostingPartner is vastgelegd als verwerker met verwerkersovereenkomst en verwerking in Nederland; de reactietermijn is bevestigd (het concept zegt "binnen vier weken"); de captcha-alinea klopt met de captchabeslissing; geen `[OPEN:`-markers; de bewaartermijnen kloppen met de server (1 jaar, 30 dagen spam).
|
||||
- **KvK-nummer:** staat niet in het concept en moet zichtbaar zijn op de site (V6).
|
||||
|
||||
## 6. Terugdraaien
|
||||
|
||||
| Wat | Hoe |
|
||||
| --- | --- |
|
||||
| Site (`dist`) | Vorige `dist` terugzetten (artefacten blijven 7 dagen in Gitea; hoe lang we ze apart bewaren: V7). HTML wordt als laatste geüpload, dus een mislukte asset-ronde laat de oude site intact. |
|
||||
| Host-app | Vorige release terugzetten (kopie van de vorige map) en `app_offline.htm` weghalen. Migraties zijn additief; voor terugdraaien van migraties geldt het databaseherstelpunt. |
|
||||
| Database | Back-up vóór de eerste uitrol met data; terugzetten met de functie van de hoster (A4). |
|
||||
| Formulier | `VITE_CONTACT_FORM_ENABLED` weglaten en opnieuw deployen, of `Contact:Enabled` uit op de server. |
|
||||
| DNS/cutover | Zie V8: oude site bewaren tot de nieuwe site verifieerbaar werkt. |
|
||||
|
||||
## 7. Open punten (uit de go-live- en gezamenlijke releasechecklist)
|
||||
|
||||
- Echte HEIC-test (upload en verwerking op win-x64, R4).
|
||||
- Captcha-provider kiezen (Gitea-issue #14 in de CMS-repo); tot dan uit.
|
||||
- Gezamenlijke release: SLS-CMS -> SLS-site -> ASF, elke stap met go; daarna Sentry, smoke-tests, deelafbeelding, sitemap, een echt formulierbericht (alleen als het formulier open staat), cookies/statistiek zoals in de privacyverklaring.
|
||||
- KvK-nummer zichtbaar op de site.
|
||||
- Verwerkersovereenkomst met MijnHostingPartner.
|
||||
- Eerste ASF-beheerder aanmaken en het setup-token verwijderen.
|
||||
- `offerings.snapshot.json` met echte pakketten; testprijzen nooit in het productie-artefact.
|
||||
- Productie-CMS bevat de echte hero (zonder seed toont productie de ingebakken hero uit `heroContent.ts`).
|
||||
|
||||
## 8. Risico's
|
||||
|
||||
| # | Risico | Maatregel |
|
||||
| --- | --- | --- |
|
||||
| R1 | Het hostingpakket kan de .NET-host niet draaien (A1). | Stap 0 vóór alle bouwwerk; alternatief: host elders (bijvoorbeeld de Pi, zoals SLS) en IIS alleen als reverse proxy. |
|
||||
| R2 | Twee losse uploads (host en site) lopen even uit de pas. | Volgorde: host eerst met `app_offline.htm`, dan site, dan `app_offline` weg; smoke-test erna. |
|
||||
| R3 | Geheimen leesbaar voor wie FTP-toegang heeft. | Environment-variabelen via het paneel indien mogelijk; geen geheimen in repo of logs. |
|
||||
| R4 | HEIC-verwerking werkt anders op Windows (native bibliotheken). | Echte HEIC-test op de proefomgeving vóór go-live. |
|
||||
| R5 | Lighthouse-performance op de Pi is wisselend en blokkeert productie. | Performance blijft "melden"; andere categorieën blokkeren. |
|
||||
| R6 | SEO-verlies bij de overstap van de oude site. | Redirectlijst van oude URL's (V8). |
|
||||
| R7 | Een foute deploy raakt de testsites (zelfde CMS-pipeline). | Productiestappen achter een variabele en een eigen input; test blijft ongewijzigd. |
|
||||
|
||||
## 9. Aannames (te controleren)
|
||||
|
||||
- **A1** MijnHostingPartner draait ASP.NET Core 10 (self-contained) achter IIS met de ASP.NET Core Module. Onbekend: `cms-api-foundation/requirements.md` zegt "whether the production host runs .NET is unknown".
|
||||
- **A2** Er is een persistent, schrijfbaar pad buiten de release voor media en een map voor de prerendered pages.
|
||||
- **A3** Omgevingsvariabelen zijn instelbaar via het paneel of de `web.config` van de host.
|
||||
- **A4** Het pakket bevat een MariaDB/MySQL-database met back-up en terugzetten.
|
||||
- **A5** Certificaat en HSTS regelt de hoster.
|
||||
- **A6** Een tijdelijk subdomein voor een proef is mogelijk.
|
||||
- **A7** Er bestaat nog geen ASF-productie-CMS met gegevens.
|
||||
- **A8** Privacytekst blijft een eigen JSON-bestand (niet in `nl.json`).
|
||||
|
||||
## 10. Vragen voor Bryan
|
||||
|
||||
1. **V1** Wat is het hostingpakket precies (Windows/IIS, .NET 10 en de ASP.NET Core Module, FTP/FTPS, SSH)? Is er een paneel of documentatie die ik moet zien?
|
||||
2. **V2** Mag er een tijdelijk subdomein (bijvoorbeeld `staging.andreaslop.nl`) voor een proef-uitrol, en mag dat kosten?
|
||||
3. **V3** Welke database en welke back-upprocedure heeft het pakket; kunnen we daar een herstelpunt maken zoals op de Pi?
|
||||
4. **V4** Welke SMTP-gegevens en welk afzenderadres voor het formulier?
|
||||
5. **V5** Productie-gate: houden we `release/*` (zoals SLS) of vervangen we dat door een handmatige goedkeuringsstap op master? Je wilde de pipeline in een feature-branch; een `release/*`-branch zou dan alleen op jouw verzoek voor de uitvoering bestaan.
|
||||
6. **V6** Welk KvK-nummer en waar op de site (footer of contact)?
|
||||
7. **V7** Hoe lang bewaren we `dist`-artefacten van productieruns buiten Gitea (voor terugdraaien)?
|
||||
8. **V8** Wat draait er nu op andreaslop.nl (WordPress, waar?), en wanneer en hoe schakelen we DNS om? Is er een redirectlijst van oude URL's nodig?
|
||||
9. **V9** Controleert Andrea de privacytekst voordat de definitieve tekst en JSON klaar zijn, en wie levert de verwerkersovereenkomst?
|
||||
10. **V10** Captcha: laten we het uit bij go-live (formulier dicht), of eerst Friendly Captcha betaald?
|
||||
|
||||
## 11. Besluiten en antwoorden van Bryan (2026-11-18)
|
||||
|
||||
| Onderwerp | Besluit / antwoord | Gevolg voor het plan |
|
||||
| --- | --- | --- |
|
||||
| A1 .NET 10 | Bevestigd: ASP.NET-optie "No managed code", ASP.NET Core Module, .NET 10 ondersteund. | A1 is vastgesteld. In-process of out-of-process blijft in stap 0 uit te zoeken; self-contained `win-x64` blijft het uitgangspunt. |
|
||||
| V2/A6 staging-subdomein | Nee: het pakket heeft ruimte voor één website. De testomgeving staat daarom op de Pi. | Stap 3 (repetitie op een subdomein) vervalt. Zie "Repetitie" hieronder. |
|
||||
| V4 SMTP | Gegevens staan in de kennisbank van MijnHostingPartner (host-adressen voor e-mail). | Hostadressen overnemen in de configuratie (nog invullen). |
|
||||
| V5 gate | `release/*` blijft de productiepoort; een goedkeuringsstap in de pipeline is later mogelijk. | Geen wijziging t.o.v. SLS. |
|
||||
| V6 KvK | Nog niet bekend; komt in de footer. Besluit: live zonder KvK-nummer. | Geen blokkade voor go-live. De footer toont het nummer pas zodra het bekend is; geen plaatsaanduiding op de live site. Privacytekst: geen `[OPEN:]`-markers in het live artefact. |
|
||||
| V8 WordPress | Op het productiepakket draait een WordPress-site. De nieuwe site staat nu op de Pi. Vóór het uitschakelen een back-up van de laatste staat. | Back-up van WordPress (bestanden + database) wordt een verplichte stap vóór go-live. |
|
||||
| Redirects | Korte lijst van belangrijkste oude URL's naar de nieuwe pagina's. | ASF-sessie brengt de WordPress-URL's in kaart (home, over mij, contact, portfolio, enz.) en legt de redirects vast in `serverConfig.ts`. |
|
||||
| V9 privacy | Bryan heeft de eerste controle gedaan; Andrea controleert nog. Verwerkersovereenkomst: geen apart document van ons; hoster biedt meestal een standaard aan (art. 28 AVG). | Controleren of MijnHostingPartner een standaardverwerkersovereenkomst heeft; Andrea legt dat vast. |
|
||||
| V10 captcha | Blijft uit bij go-live; formulier dicht. | Geen wijziging. |
|
||||
|
||||
**Repetitie (vervangt stap 3).** Besluit: direct live na back-up. Mogelijk wijst Bryan de domeinnaam tijdelijk naar de Pi; in die tijd wordt de nieuwe site op het pakket gezet. Daarna gaat de DNS naar het pakket en wordt getest of rechten, hostinstellingen, mail, uploads (HEIC) en media werken. Terugdraaien = DNS terug naar de Pi (of WordPress terugzetten uit de back-up).
|
||||
|
||||
**Certificaat.** Een tweede Let's Encrypt-certificaat voor hetzelfde domein via de hoster is toegestaan; certificaten zijn onafhankelijk en er geldt een ruime limiet. Voor de HTTP-01-controle moet het domein naar de aanvragende server wijzen: aanvragen bij de hoster kan dus pas ná de DNS-omzetting (of via DNS-01). Overbrugging: certificaat en sleutel van de Pi hergebruiken indien het pakket een eigen certificaat accepteert, of de omzetting plannen met een korte periode zonder HTTPS-certificaat (te vermijden). Nog uit te zoeken in stap 0.
|
||||
|
||||
Nog open: A2 (schrijfbaar pad), A3 (omgevingsvariabelen), A4 (MariaDB/MySQL met back-up), A5 (certificaat/HSTS door de hoster), V7 (bewaren artefacten).
|
||||
|
||||
### Hostingfeiten van Bryan (2026-11-18, na de eerste antwoorden)
|
||||
|
||||
| Aanname | Antwoord / stand | Terugvaloptie |
|
||||
| --- | --- | --- |
|
||||
| A2 schrijfbaar pad voor media | Bryan kan schrijfrechten instellen. Of een pad **buiten** `wwwroot` kan, weet hij niet; nog uit te zoeken. | Map binnen `wwwroot` met een `web.config` die directe toegang tot de mapstructuur beperkt, of een niet-publiek pad via de hosterinstellingen. |
|
||||
| A3 omgevingsvariabelen | Bryan moet nog controleren of het paneel ze ondersteunt. | `appsettings.Production.json` of de `web.config` van de host (geen geheimen in de repo). |
|
||||
| A4 database | Er is een MariaDB beschikbaar. De connection string volgt van Bryan. | Nooit in de repo; als omgevingsvariabele of secret. |
|
||||
| A5 certificaat | Bryan regelt het Let's Encrypt-certificaat zodra de site op de nieuwe host staat. | Zie het stuk over het certificaat hierboven. |
|
||||
|
||||
**Oude URL's.** De oude WordPress-site is vastgesteld en de redirects staan in [oude-urls.md](oude-urls.md). Samenvatting: alleen de vijf echte pagina's (`/`, `/over-mij`, `/portfolio`, `/soorten-fotoshoots`, `/contact`; zelfde slugs als nu) en de sitemap-URL's gaan met 301 naar de nieuwe site; thema-demo en WordPress-systeemadressen krijgen 404/410. Op 2026-11-18 draait op andreaslop.nl nog WordPress.
|
||||
|
||||
### Correctie (Bryan, 2026-11-18): productie heeft alleen FTP, geen FTPS
|
||||
|
||||
Het plan sprak van FTPS-upload; het productiepakket biedt alleen gewone FTP. Gevolgen:
|
||||
- Gebruikersnaam, wachtwoord en alle bestanden gaan onversleuteld over het netwerk (risico R9). Maatregelen: een eigen FTP-account met rechten alleen op de site- en hostmappen, een uniek sterk wachtwoord, het wachtwoord alleen als Gitea-secret (`PROD_HOST_PASSWORD` in de ASF-repo, `ASF_PROD_HOST_PASSWORD` in de CMS-repo), rouleren na de eerste uitrol, en bij de hoster navragen of SFTP of FTPS (explicit) op aanvraag beschikbaar is.
|
||||
- Uploaden uit de pipeline gebeurt vanaf onze runner via het internet; geen geheimen in logs. Mogelijk IP-beperking van het FTP-account (indien de hoster dat biedt).
|
||||
- De uitrolscripts (`upload-production.sh` en de CMS-deploystap) moeten gewone FTP ondersteunen (passieve modus); `lftp`-opties dienovereenkomstig, zonder `ftps`.
|
||||
- Het besluit over SFTP/FTPS-beschikbaarheid komt in de vragen voor Bryan (V1).
|
||||
@@ -59,11 +59,12 @@ Decision (Bryan, 2026-11-15): the hosting package has one entry per website. The
|
||||
|
||||
## Environment and variables
|
||||
|
||||
| Name | Where | Meaning |
|
||||
| --------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. |
|
||||
| `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. |
|
||||
| `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. |
|
||||
| `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). |
|
||||
| Name | Where | Meaning |
|
||||
| --------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. |
|
||||
| `ASF_OFFERINGS_URL_TEST` | Gitea repo variable | Value of `OFFERINGS_URL` for the test build. Set by SLS, not by feature sessions. |
|
||||
| `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. |
|
||||
| `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. |
|
||||
| `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). |
|
||||
|
||||
No build sets `OFFERINGS_URL` any more (since the host injection, 2026-11-18): the CMS host writes the current data into the HTML. The variable stays supported for a local build against a CMS. The production artifact never carries the prices of the test CMS.
|
||||
The production artifact is built without `OFFERINGS_URL` on purpose: production must never carry the prices of the test CMS.
|
||||
|
||||
+3
-22
@@ -20,8 +20,8 @@ Dispatch from the CLI (the token comes from your git credentials, never print it
|
||||
|
||||
## Jobs
|
||||
|
||||
1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build (with the committed package snapshot), audit. Uploads artifact `dist` (this is what production gets).
|
||||
2. `build-test`: builds again with `VITE_CONTACT_FORM_ENABLED=true` and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`.
|
||||
1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build **without** `OFFERINGS_URL` (so with the committed snapshot), audit. Uploads artifact `dist` (this is what production gets).
|
||||
2. `build-test`: builds again with `OFFERINGS_URL=${{ vars.ASF_OFFERINGS_URL_TEST }}` (packages and banners from the test CMS) and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`.
|
||||
3. `deploy-test`: needs `check` and `build-test`, downloads `dist-test`, uploads to the ASF test host and runs the deployment check (served by the CMS host, admin files, POST status).
|
||||
4. `lighthouse`: against the built site with the preview stub (`--audit-route --contact-stub`).
|
||||
5. `deploy-production`: manual, from `release/*` only, uses artifact `dist`.
|
||||
@@ -52,23 +52,4 @@ The test site stands on its own: in the test build `VITE_SITE_URL` is `https://t
|
||||
|
||||
There used to be a nightly test build (`schedule`, 03:15 UTC) that baked the CMS data into the HTML for search engines. It is gone: the CMS host writes the packages, banners and hero into the first HTML of every request (cache 60 s, refreshed at once on a change; NFR-10), so a content change is visible without a rebuild. A rebuild is only needed for code and design. The nightly run also put `master` over ASF-test every night, which would undo a feature branch deployed there.
|
||||
|
||||
The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build no longer sets `OFFERINGS_URL` (removed 2026-11-18, once the host injection was confirmed on ASF-test); it still sets `VITE_SITE_URL` (own address of the test site) and `VITE_CONTACT_FORM_ENABLED`.
|
||||
|
||||
## Names of the repo variables and secrets
|
||||
|
||||
Format `{ENV}_{GROUP}_{NAME}` with `ENV` = `TEST` or `PROD`, no app part (this repo only deploys the ASF site) and no `VITE` (the pipeline maps a value to `VITE_...` in the build). Decision of Bryan, 2026-11-18; the full list is in the SLS repo (`aidlc-docs/_shared/gitea-naamgeving-variabelen.md`). Repo variables and secrets are created by SLS, not by feature sessions.
|
||||
|
||||
| Name | Kind | Used by |
|
||||
| ------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `TEST_DEPLOY_PATH` | variable | `deploy-test`: target folder on the Pi |
|
||||
| `TEST_HEALTH_URL` | variable | `deploy-test`: check after the deploy |
|
||||
| `PROD_DEPLOY_PATH` | variable | `deploy-production`: remote folder (default `wwwroot`) |
|
||||
| `PROD_HEALTH_URL` | variable | `deploy-production`: check after the deploy |
|
||||
| `TEST_SENTRY_DSN`, `TEST_UMAMI_SCRIPT_URL`, `TEST_UMAMI_WEBSITE_ID` | variable | `build-test` and the CSP check in `deploy-test` (as `VITE_SENTRY_DSN`, `VITE_UMAMI_SCRIPT_URL`, `VITE_UMAMI_WEBSITE_ID`, `VITE_APP_ENV=test`) |
|
||||
| `PROD_SENTRY_DSN`, `PROD_UMAMI_SCRIPT_URL`, `PROD_UMAMI_WEBSITE_ID` | variable | `check` (the production artifact; `VITE_APP_ENV=production`) |
|
||||
| `PROD_HOST_ADDRESS`, `PROD_HOST_USERNAME`, `PROD_HOST_PASSWORD` | secrets | `deploy-production`: FTP (plain FTP, no FTPS, at the hosting partner) |
|
||||
| `PI_MAIN_ADDRESS`, `_PORT`, `_USERNAME`, `_PASSWORD` | secrets | `deploy-test`: still the old names; they become `TEST_HOST_*` with an SSH key (SLS arranges the key) |
|
||||
|
||||
Removed: `DEPLOY_PATH_TEST`, `HEALTH_CHECK_URL_TEST`, `HEALTH_CHECK_URL_PRODUCTION`, `FTP_REMOTE_DIR`, `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD` (renamed), `ASF_OFFERINGS_URL_TEST` and `ASF_TEST_SERVED_BY_CMS` (no longer needed). The old names in the repo are removed by SLS after a green run.
|
||||
|
||||
**Monitoring per build.** Sentry and Umami settings are no longer in the code (`src/monitoring/config.ts`): every build gets them for its own environment and measures only on that environment's host (production build on `andreaslop.nl`, test build on `test.andreaslop.nl`; any other host measures nothing). The CSP origins for Umami and Sentry (`config/securityHeaders.ts`) come from the same variables, so a build without them has neither a measurement nor those origins; the build steps fail when a variable is empty. Unit and browser tests use the production values from `config/monitoringTestEnv.ts` (public values, the same as the variables); `pnpm server-config` does too, so the committed generated files carry the production CSP. The CMS host has its own copy of the origins in its environment (CMS repo).
|
||||
The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build still sets `OFFERINGS_URL`; removing that (and `VITE_SITE_URL`) is a separate follow-up once host injection is confirmed end to end.
|
||||
|
||||
@@ -11,7 +11,7 @@ What must be true before the CMS-driven parts of the site go to production. Brya
|
||||
|
||||
- [ ] Production hosting in place with the CMS host as the one entry of the website: IIS passes ALL requests to the CMS host (not only `/api/v1/*`) and serves no static files itself; the prerendered `dist/` is deployed to the CMS host ([cms-integration.md](cms-integration.md), "Hosting"). The generated IIS config and the production upload script are updated for this. Without it production keeps the committed snapshot and the console shows a 404 per page view for the API.
|
||||
- [ ] `web/src/content/offerings.snapshot.json` holds the real, current packages (production builds use it).
|
||||
- [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (no build fetches packages from a CMS any more).
|
||||
- [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (it is built without `OFFERINGS_URL`).
|
||||
|
||||
## Hero
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// De monitoringinstellingen die de tests als productiebuild zien. De echte
|
||||
// waarden komen in de pipeline uit de Gitea-variabelen PROD_SENTRY_DSN,
|
||||
// PROD_UMAMI_SCRIPT_URL en PROD_UMAMI_WEBSITE_ID (en TEST_...); deze openbare
|
||||
// waarden zijn er hetzelfde als, zodat de gegenereerde serverconfiguratie en de
|
||||
// CSP in de tests vergelijkbaar blijven. Zie src/monitoring/config.ts.
|
||||
export const monitoringTestEnv = {
|
||||
VITE_APP_ENV: 'production',
|
||||
VITE_SENTRY_DSN:
|
||||
'https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720',
|
||||
VITE_UMAMI_SCRIPT_URL: 'https://analytics.slpsoftware.nl/script.js',
|
||||
VITE_UMAMI_WEBSITE_ID: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
|
||||
|
||||
const umami = 'https://analytics.slpsoftware.nl';
|
||||
@@ -12,17 +12,7 @@ const captchaFrames = [
|
||||
const directive = (csp: string, name: string) =>
|
||||
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
|
||||
|
||||
afterEach(() => vi.unstubAllEnvs());
|
||||
|
||||
describe('securityHeaders', () => {
|
||||
it('noemt Umami en Sentry niet zonder monitoringinstellingen in de build', () => {
|
||||
vi.stubEnv('VITE_SENTRY_DSN', '');
|
||||
const csp = contentSecurityPolicy('production');
|
||||
expect(csp).not.toContain(umami);
|
||||
expect(csp).not.toContain(sentry);
|
||||
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
|
||||
});
|
||||
|
||||
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
|
||||
const csp = contentSecurityPolicy('production');
|
||||
expect(csp).not.toContain('unsafe-eval');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is
|
||||
// ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02).
|
||||
|
||||
import { monitoringOrigins } from '../src/monitoring/config.ts';
|
||||
import { sentryIngestOrigin, umamiOrigin } from '../src/monitoring/config.ts';
|
||||
|
||||
type Mode = 'production' | 'development';
|
||||
|
||||
@@ -21,24 +21,19 @@ export const captchaFrameOrigins = [
|
||||
'https://global1.frcapi.com',
|
||||
];
|
||||
|
||||
// De herkomsten van Umami en Sentry komen uit de build-omgeving (zie
|
||||
// src/monitoring/config.ts); zonder die instellingen staan ze er niet in.
|
||||
function productionCsp(): Record<string, string[]> {
|
||||
const origins = monitoringOrigins();
|
||||
return {
|
||||
'default-src': ["'self'"],
|
||||
'script-src': ["'self'", ...origins.umami],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'img-src': ["'self'", 'data:'],
|
||||
'font-src': ["'self'"],
|
||||
'connect-src': ["'self'", ...origins.umami, ...origins.sentry],
|
||||
'frame-src': captchaFrameOrigins,
|
||||
'object-src': ["'none'"],
|
||||
'base-uri': ["'self'"],
|
||||
'form-action': ["'self'"],
|
||||
'frame-ancestors': ["'none'"],
|
||||
};
|
||||
}
|
||||
const productionCsp: Record<string, string[]> = {
|
||||
'default-src': ["'self'"],
|
||||
'script-src': ["'self'", umamiOrigin],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'img-src': ["'self'", 'data:'],
|
||||
'font-src': ["'self'"],
|
||||
'connect-src': ["'self'", umamiOrigin, sentryIngestOrigin],
|
||||
'frame-src': captchaFrameOrigins,
|
||||
'object-src': ["'none'"],
|
||||
'base-uri': ["'self'"],
|
||||
'form-action': ["'self'"],
|
||||
'frame-ancestors': ["'none'"],
|
||||
};
|
||||
|
||||
// Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor
|
||||
// React Refresh en een websocket voor hot reload.
|
||||
@@ -48,7 +43,7 @@ const developmentExtras: Record<string, string[]> = {
|
||||
};
|
||||
|
||||
export function contentSecurityPolicy(mode: Mode): string {
|
||||
return Object.entries(productionCsp())
|
||||
return Object.entries(productionCsp)
|
||||
.map(([directive, sources]) => {
|
||||
const extra =
|
||||
mode === 'development'
|
||||
|
||||
@@ -2,15 +2,8 @@
|
||||
// Draait direct met Node (type stripping), zonder extra tooling.
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { dirname } from 'node:path';
|
||||
import { monitoringTestEnv } from './monitoringTestEnv.ts';
|
||||
import { serverConfigFiles } from './serverConfig.ts';
|
||||
|
||||
// The committed files carry the CSP of the production build; the origins of
|
||||
// Umami and Sentry come from the environment (src/monitoring/config.ts)
|
||||
for (const [name, value] of Object.entries(monitoringTestEnv)) {
|
||||
process.env[name] ??= value;
|
||||
}
|
||||
|
||||
for (const [path, generate] of Object.entries(serverConfigFiles)) {
|
||||
mkdirSync(dirname(path), { recursive: true });
|
||||
writeFileSync(path, generate());
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# headers staan met de exacte waarde op elk antwoord (pagina, asset,
|
||||
# 301, 404, robots.txt), cachebeleid, alleen gzip (nooit br), een
|
||||
# procentgecodeerd pad blijft gecodeerd, en /admin, /health en
|
||||
# /api/v1/System/capabilities (met Offerings en Hero) antwoorden.
|
||||
# /api/v1/System/capabilities (zonder Offerings) antwoorden.
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -lt 2 ] || [ "$#" -gt 4 ]; then
|
||||
@@ -272,7 +272,7 @@ if [ "$cms_mode" -eq 1 ]; then
|
||||
fail "POST /: status $status, verwacht 405"
|
||||
fi
|
||||
|
||||
# De CMS-routes: health, admin, API (met Offerings en Hero), onbekend API-pad
|
||||
# De CMS-routes: health, admin, API (zonder Offerings), onbekend API-pad
|
||||
fetch /health
|
||||
if [ "$status" != "200" ]; then fail "/health: status $status, verwacht 200"; fi
|
||||
|
||||
@@ -301,13 +301,8 @@ if [ "$cms_mode" -eq 1 ]; then
|
||||
fetch /api/v1/System/capabilities
|
||||
if [ "$status" != "200" ]; then
|
||||
fail "/api/v1/System/capabilities: status $status, verwacht 200"
|
||||
else
|
||||
# De site haalt pakketten, banners en de hero uit deze modules
|
||||
for module in Offerings Hero; do
|
||||
if ! grep -qi "\"$module\"" "$work/body"; then
|
||||
fail "/api/v1/System/capabilities noemt $module niet; de site heeft die module nodig"
|
||||
fi
|
||||
done
|
||||
elif grep -qi 'offerings' "$work/body"; then
|
||||
fail "/api/v1/System/capabilities noemt Offerings; die module hoort voor ASF uit te staan"
|
||||
fi
|
||||
|
||||
# Een onbekend API-pad is een API-404, nooit de website
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import UmamiAnalytics from './UmamiAnalytics';
|
||||
|
||||
const umamiScripts = () =>
|
||||
@@ -8,7 +8,6 @@ const umamiScripts = () =>
|
||||
);
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
umamiScripts().forEach((script) => script.remove());
|
||||
});
|
||||
|
||||
@@ -19,28 +18,18 @@ describe('UmamiAnalytics', () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
['production', 'andreaslop.nl', '3edbb7d1-4388-4f2d-9cef-11ade88ace96'],
|
||||
['test', 'test.andreaslop.nl', 'test-website'],
|
||||
])(
|
||||
'telt in de %s-build op %s met de juiste website',
|
||||
(environment, hostname, websiteId) => {
|
||||
vi.stubEnv('VITE_APP_ENV', environment);
|
||||
vi.stubEnv('VITE_UMAMI_WEBSITE_ID', websiteId);
|
||||
render(<UmamiAnalytics hostname={hostname} />);
|
||||
['andreaslop.nl', '3edbb7d1-4388-4f2d-9cef-11ade88ace96'],
|
||||
['test.andreaslop.nl', '7fb301ab-6ecc-4aea-beee-71bcb6009bfe'],
|
||||
])('telt op %s met de juiste website', (hostname, websiteId) => {
|
||||
render(<UmamiAnalytics hostname={hostname} />);
|
||||
|
||||
const [script] = umamiScripts();
|
||||
expect(script.defer).toBe(true);
|
||||
expect(script.dataset).toMatchObject({
|
||||
websiteId,
|
||||
domains: hostname,
|
||||
doNotTrack: 'true',
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it('voegt geen script toe op de host van de andere omgeving', () => {
|
||||
render(<UmamiAnalytics hostname="test.andreaslop.nl" />);
|
||||
expect(umamiScripts()).toHaveLength(0);
|
||||
const [script] = umamiScripts();
|
||||
expect(script.defer).toBe(true);
|
||||
expect(script.dataset).toMatchObject({
|
||||
websiteId,
|
||||
domains: hostname,
|
||||
doNotTrack: 'true',
|
||||
});
|
||||
});
|
||||
|
||||
it('voegt het script maar één keer toe', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect } from 'react';
|
||||
import { monitoringFor } from '@/monitoring/config';
|
||||
import { monitoringFor, umamiOrigin } from '@/monitoring/config';
|
||||
|
||||
const SCRIPT_ELEMENT_ID = 'umami-analytics-script';
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function UmamiAnalytics({ hostname }: { hostname?: string }) {
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.id = SCRIPT_ELEMENT_ID;
|
||||
script.src = monitoring.umamiScriptUrl;
|
||||
script.src = `${umamiOrigin}/script.js`;
|
||||
script.defer = true;
|
||||
script.dataset.websiteId = monitoring.umamiWebsiteId;
|
||||
script.dataset.domains = host;
|
||||
|
||||
@@ -1,22 +1,11 @@
|
||||
import fc from 'fast-check';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
monitoredHostnames,
|
||||
monitoringConfig,
|
||||
monitoringFor,
|
||||
monitoringOrigins,
|
||||
sentryIngestOrigin,
|
||||
} from './config';
|
||||
|
||||
const dsn = 'https://key@o1.ingest.de.sentry.io/2';
|
||||
const script = 'https://analytics.example.nl/script.js';
|
||||
const raw = (extra: Record<string, unknown> = {}) => ({
|
||||
environment: 'production',
|
||||
sentryDsn: dsn,
|
||||
umamiScriptUrl: script,
|
||||
umamiWebsiteId: 'site-1',
|
||||
...extra,
|
||||
});
|
||||
|
||||
// Alles wat geen test- of productiehost is
|
||||
const otherHostname = fc
|
||||
.oneof(
|
||||
@@ -36,89 +25,32 @@ const otherHostname = fc
|
||||
)
|
||||
.filter((host) => !monitoredHostnames.includes(host));
|
||||
|
||||
afterEach(() => vi.unstubAllEnvs());
|
||||
|
||||
describe('monitoringConfig', () => {
|
||||
it('leest de waarden uit de omgeving van de build', () => {
|
||||
// De testomgeving (vite.config.ts) is de productiebuild
|
||||
expect(monitoringConfig()).toMatchObject({
|
||||
describe('monitoringFor', () => {
|
||||
it('productiehost meet als production met de productiewebsite', () => {
|
||||
expect(monitoringFor('andreaslop.nl')).toEqual({
|
||||
environment: 'production',
|
||||
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
|
||||
});
|
||||
vi.stubEnv('VITE_APP_ENV', 'test');
|
||||
vi.stubEnv('VITE_UMAMI_WEBSITE_ID', ' abc ');
|
||||
expect(monitoringConfig()).toMatchObject({
|
||||
});
|
||||
|
||||
it('testhost meet als test met de testwebsite', () => {
|
||||
expect(monitoringFor('test.andreaslop.nl')).toEqual({
|
||||
environment: 'test',
|
||||
umamiWebsiteId: 'abc',
|
||||
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe',
|
||||
});
|
||||
});
|
||||
|
||||
it('geeft null als er iets ontbreekt of ongeldig is', () => {
|
||||
expect(monitoringConfig(raw())).not.toBeNull();
|
||||
for (const bad of [
|
||||
{ environment: 'staging' },
|
||||
{ environment: undefined },
|
||||
{ sentryDsn: undefined },
|
||||
{ sentryDsn: 'http://key@host/1' },
|
||||
{ sentryDsn: 'geen url' },
|
||||
{ umamiScriptUrl: '' },
|
||||
{ umamiScriptUrl: 'http://analytics.example.nl/script.js' },
|
||||
{ umamiWebsiteId: ' ' },
|
||||
{ umamiWebsiteId: 5 },
|
||||
]) {
|
||||
expect(monitoringConfig(raw(bad))).toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('monitoringFor', () => {
|
||||
it('productiebuild meet alleen op de productiehost', () => {
|
||||
const config = monitoringConfig(raw());
|
||||
expect(monitoringFor('andreaslop.nl', config)).toEqual({
|
||||
environment: 'production',
|
||||
sentryDsn: dsn,
|
||||
umamiScriptUrl: script,
|
||||
umamiWebsiteId: 'site-1',
|
||||
});
|
||||
expect(monitoringFor('test.andreaslop.nl', config)).toBeNull();
|
||||
});
|
||||
|
||||
it('testbuild meet alleen op de testhost', () => {
|
||||
const config = monitoringConfig(raw({ environment: 'test' }));
|
||||
expect(monitoringFor('test.andreaslop.nl', config)?.environment).toBe(
|
||||
'test',
|
||||
);
|
||||
expect(monitoringFor('andreaslop.nl', config)).toBeNull();
|
||||
});
|
||||
|
||||
it('meet niets zonder instellingen', () => {
|
||||
expect(monitoringFor('andreaslop.nl', null)).toBeNull();
|
||||
});
|
||||
|
||||
it('elke andere host meet niets (M1)', () => {
|
||||
fc.assert(
|
||||
fc.property(otherHostname, (host) => {
|
||||
expect(monitoringFor(host)).toBeNull();
|
||||
expect(
|
||||
monitoringFor(
|
||||
host,
|
||||
monitoringConfig(raw({ environment: 'test' })),
|
||||
),
|
||||
).toBeNull();
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('monitoringOrigins', () => {
|
||||
it('zijn de herkomst van het Umami-script en van de Sentry-ingest, zonder sleutel', () => {
|
||||
expect(monitoringOrigins(monitoringConfig(raw()))).toEqual({
|
||||
umami: ['https://analytics.example.nl'],
|
||||
sentry: ['https://o1.ingest.de.sentry.io'],
|
||||
});
|
||||
});
|
||||
|
||||
it('zijn leeg zonder instellingen', () => {
|
||||
expect(monitoringOrigins(null)).toEqual({ umami: [], sentry: [] });
|
||||
});
|
||||
it('Sentry-ingest is de EU-host uit de DSN, zonder sleutel', () => {
|
||||
expect(sentryIngestOrigin).toBe(
|
||||
'https://o4511795618185216.ingest.de.sentry.io',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,96 +1,43 @@
|
||||
// Instellingen voor Sentry en Umami (monitoring-plan M1/M2). De waarden zijn
|
||||
// openbaar (ze staan in de browser van elke bezoeker) maar komen niet meer uit
|
||||
// de code: de pipeline geeft ze per omgeving mee aan de build, uit de Gitea-
|
||||
// variabelen {TEST|PROD}_SENTRY_DSN, _UMAMI_SCRIPT_URL en _UMAMI_WEBSITE_ID,
|
||||
// als VITE_SENTRY_DSN, VITE_UMAMI_SCRIPT_URL, VITE_UMAMI_WEBSITE_ID en
|
||||
// VITE_APP_ENV ('test' of 'production'). Eén build hoort dus bij één omgeving.
|
||||
// Instellingen voor Sentry en Umami (monitoring-plan M1/M2). Deze waarden zijn
|
||||
// openbaar: ze staan hoe dan ook in de browser van elke bezoeker.
|
||||
// Geen imports uit Vite: config/securityHeaders.ts leest dit bestand ook in Node.
|
||||
|
||||
export type MonitoringEnvironment = 'test' | 'production';
|
||||
|
||||
export interface MonitoringConfig {
|
||||
export interface Monitoring {
|
||||
environment: MonitoringEnvironment;
|
||||
sentryDsn: string;
|
||||
umamiScriptUrl: string;
|
||||
umamiWebsiteId: string;
|
||||
}
|
||||
|
||||
export type Monitoring = MonitoringConfig;
|
||||
export const sentryDsn =
|
||||
'https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720';
|
||||
|
||||
// De host waarop de build van een omgeving meet
|
||||
const hostnameByEnvironment: Record<MonitoringEnvironment, string> = {
|
||||
production: 'andreaslop.nl',
|
||||
test: 'test.andreaslop.nl',
|
||||
};
|
||||
// Waar de browser fouten naartoe stuurt; nodig voor connect-src in de CSP
|
||||
export const sentryIngestOrigin = new URL(sentryDsn).origin;
|
||||
|
||||
// In de Vite-build staan de waarden in import.meta.env (statisch vervangen,
|
||||
// daarom elke naam los); de buildscripts onder Node lezen process.env.
|
||||
const fromProcess = (name: string): unknown =>
|
||||
typeof process === 'undefined' ? undefined : process.env[name];
|
||||
export const umamiOrigin = 'https://analytics.slpsoftware.nl';
|
||||
|
||||
function rawSettings(): Record<keyof MonitoringConfig, unknown> {
|
||||
const env = import.meta.env;
|
||||
return {
|
||||
environment: env?.VITE_APP_ENV ?? fromProcess('VITE_APP_ENV'),
|
||||
sentryDsn: env?.VITE_SENTRY_DSN ?? fromProcess('VITE_SENTRY_DSN'),
|
||||
umamiScriptUrl:
|
||||
env?.VITE_UMAMI_SCRIPT_URL ?? fromProcess('VITE_UMAMI_SCRIPT_URL'),
|
||||
umamiWebsiteId:
|
||||
env?.VITE_UMAMI_WEBSITE_ID ?? fromProcess('VITE_UMAMI_WEBSITE_ID'),
|
||||
};
|
||||
// Eén build voor beide omgevingen: de hostname bepaalt de omgeving
|
||||
const monitoringByHostname = new Map<string, Monitoring>([
|
||||
[
|
||||
'andreaslop.nl',
|
||||
{
|
||||
environment: 'production',
|
||||
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
|
||||
},
|
||||
],
|
||||
[
|
||||
'test.andreaslop.nl',
|
||||
{
|
||||
environment: 'test',
|
||||
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe',
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
// Onbekende host (localhost, Lighthouse CI, previews): niets meten (M1)
|
||||
export function monitoringFor(hostname: string): Monitoring | null {
|
||||
return monitoringByHostname.get(hostname) ?? null;
|
||||
}
|
||||
|
||||
const isHttps = (value: string): boolean => {
|
||||
try {
|
||||
return new URL(value).protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// De instellingen van deze build, of null als er iets ontbreekt of ongeldig is
|
||||
// (dan meet de site niets: liever geen meting dan een kapotte)
|
||||
export function monitoringConfig(
|
||||
raw: Record<keyof MonitoringConfig, unknown> = rawSettings(),
|
||||
): MonitoringConfig | null {
|
||||
const { environment, sentryDsn, umamiScriptUrl, umamiWebsiteId } = raw;
|
||||
if (environment !== 'test' && environment !== 'production') return null;
|
||||
const text = (value: unknown) =>
|
||||
typeof value === 'string' ? value.trim() : '';
|
||||
const dsn = text(sentryDsn);
|
||||
const script = text(umamiScriptUrl);
|
||||
const website = text(umamiWebsiteId);
|
||||
if (!isHttps(dsn) || !isHttps(script) || website === '') return null;
|
||||
return {
|
||||
environment,
|
||||
sentryDsn: dsn,
|
||||
umamiScriptUrl: script,
|
||||
umamiWebsiteId: website,
|
||||
};
|
||||
}
|
||||
|
||||
// Onbekende host (localhost, Lighthouse CI, previews, de andere omgeving):
|
||||
// niets meten (M1)
|
||||
export function monitoringFor(
|
||||
hostname: string,
|
||||
config: MonitoringConfig | null = monitoringConfig(),
|
||||
): Monitoring | null {
|
||||
if (!config || hostname !== hostnameByEnvironment[config.environment]) {
|
||||
return null;
|
||||
}
|
||||
return { ...config };
|
||||
}
|
||||
|
||||
// De herkomsten voor de CSP: Umami voor script-src en connect-src, de Sentry-
|
||||
// ingest voor connect-src. Leeg zonder meting.
|
||||
export function monitoringOrigins(
|
||||
config: MonitoringConfig | null = monitoringConfig(),
|
||||
): { umami: string[]; sentry: string[] } {
|
||||
if (!config) return { umami: [], sentry: [] };
|
||||
return {
|
||||
umami: [new URL(config.umamiScriptUrl).origin],
|
||||
sentry: [new URL(config.sentryDsn).origin],
|
||||
};
|
||||
}
|
||||
|
||||
export const monitoredHostnames = Object.values(hostnameByEnvironment);
|
||||
export const monitoredHostnames = [...monitoringByHostname.keys()];
|
||||
|
||||
@@ -11,7 +11,6 @@ async function freshSentry() {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
init.mockReset();
|
||||
captureException.mockReset();
|
||||
});
|
||||
@@ -28,7 +27,6 @@ describe('Sentry', () => {
|
||||
});
|
||||
|
||||
it('start op test met omgeving test en zonder persoonsgegevens', async () => {
|
||||
vi.stubEnv('VITE_APP_ENV', 'test');
|
||||
const { startSentry } = await freshSentry();
|
||||
startSentry('test.andreaslop.nl');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { monitoringFor } from './config';
|
||||
import { monitoringFor, sentryDsn } from './config';
|
||||
|
||||
// Sentry laadt pas na het load-event, buiten de hoofdbundel (M4). Fouten van
|
||||
// daarvoor wachten in een wachtrij en gaan mee zodra Sentry klaar is.
|
||||
@@ -33,7 +33,7 @@ export function startSentry(hostname = window.location.hostname): void {
|
||||
// Alleen fouten: geen tracing, geen replay, geen persoonsgegevens (M5).
|
||||
// Sinds SDK 11 verzamelt Sentry standaard alles; daarom alles expliciet uit.
|
||||
Sentry.init({
|
||||
dsn: monitoring.sentryDsn,
|
||||
dsn: sentryDsn,
|
||||
environment: monitoring.environment,
|
||||
release: import.meta.env.VITE_RELEASE,
|
||||
dataCollection: {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { monitoringTestEnv } from './config/monitoringTestEnv.ts';
|
||||
import { configDefaults, defineConfig } from 'vitest/config';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
||||
@@ -81,7 +80,6 @@ export default defineConfig(({ mode }) => ({
|
||||
preview: { headers: securityHeaders('production') },
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
env: monitoringTestEnv,
|
||||
// De CI-runner (Raspberry Pi, arm64) is ±5-8x trager dan een pc; de
|
||||
// eerste render met axe duurt daar tot 7 s. 5 s (standaard) is te krap.
|
||||
testTimeout: 20_000,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { monitoringTestEnv } from './config/monitoringTestEnv.ts';
|
||||
|
||||
// Browsertests (BR-TST-05, BR-TST-06) tegen de gebouwde site in dist/client.
|
||||
// Los van vite.config.ts: de Start-plugin en de jsdom-opzet van de
|
||||
@@ -9,7 +8,6 @@ export default defineConfig({
|
||||
resolve: { tsconfigPaths: true },
|
||||
test: {
|
||||
environment: 'node',
|
||||
env: monitoringTestEnv,
|
||||
include: ['e2e/**/*.e2e.ts'],
|
||||
// De CI-runner (Raspberry Pi) is veel trager dan een pc: Chrome starten
|
||||
// en een pagina hydrateren kost daar vele seconden. Tests die alle 11
|
||||
|
||||
Reference in New Issue
Block a user