Deploys to test without waiting for Lighthouse and with group write access #4
@@ -38,10 +38,16 @@ defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
|
||||
# Runners (labels per eigenschap; een job draait op een runner met al zijn
|
||||
# runs-on-labels): 'linux' = elke vrije runner (Pi of pc), 'raspberry-pi' =
|
||||
# alleen de Pi.
|
||||
# Volgorde: Gitea geeft wachtende jobs uit in de volgorde van dit bestand.
|
||||
# Daarom staan de deploys boven lighthouse: met één vrije runner gaat de deploy
|
||||
# eerst, met twee draaien ze tegelijk.
|
||||
jobs:
|
||||
# lint, opmaak, tests (incl. property-based en axe), build en audit
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -77,8 +83,11 @@ jobs:
|
||||
- name: Tests
|
||||
run: pnpm test
|
||||
|
||||
# Sentry toont bij elke fout uit welke commit de build komt
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
env:
|
||||
VITE_RELEASE: ${{ github.sha }}
|
||||
|
||||
- name: Audit (productiepakketten, blokkerend)
|
||||
run: pnpm audit:deps
|
||||
@@ -93,10 +102,68 @@ jobs:
|
||||
path: web/dist/
|
||||
retention-days: 7
|
||||
|
||||
# Test wacht niet op Lighthouse: test is om te testen, de rapporten zie je
|
||||
# achteraf. Lighthouse draait ernaast of erna (zie de volgorde bovenaan).
|
||||
# Deploys alleen vanaf de Pi: die bereikt zichzelf zeker, en container-
|
||||
# actions werken niet op Podman.
|
||||
deploy-test:
|
||||
needs: check
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
runs-on: raspberry-pi
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: web/dist
|
||||
|
||||
# Eenvoudig: de testmap leegmaken en de nieuwe build erin zetten. Oude
|
||||
# versies worden niet bewaard. Op de Pi draait ook de huidige
|
||||
# WordPress-site; daarom weigert deze stap een lege variabele, '/', of
|
||||
# een map waarin WordPress staat.
|
||||
- name: Upload naar de testserver
|
||||
env:
|
||||
# Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt
|
||||
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }}
|
||||
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
|
||||
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
|
||||
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
run: |
|
||||
case "$DEPLOY_PATH" in
|
||||
''|'/'|*' '*) 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"
|
||||
$SSH "set -e
|
||||
if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then
|
||||
echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1
|
||||
fi
|
||||
mkdir -p '$DEPLOY_PATH'
|
||||
find '$DEPLOY_PATH' -mindepth 1 -delete"
|
||||
# De inhoud kopiëren (dist/*), niet de map zelf (dist/.): dan probeert
|
||||
# scp de rechten van de doelmap niet te zetten, wat alleen de eigenaar
|
||||
# mag. Zo zijn groeps-schrijfrechten op de doelmap genoeg.
|
||||
# dotglob: ook bestanden die met een punt beginnen gaan mee.
|
||||
shopt -s dotglob
|
||||
sshpass -e scp -P "$SSH_PORT" -o StrictHostKeyChecking=accept-new -r dist/* "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/"
|
||||
echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})"
|
||||
|
||||
- name: Controle na deploy
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
run: |
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi
|
||||
curl -fsS -o /dev/null --retry 5 --retry-delay 3 "$HEALTH_URL"
|
||||
curl -fsSI "$HEALTH_URL" | grep -qi '^content-security-policy:'
|
||||
echo "Test bereikbaar met security headers"
|
||||
|
||||
# Lighthouse tegen de gebouwde site (mobiel en desktop)
|
||||
lighthouse:
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -157,60 +224,13 @@ jobs:
|
||||
path: web/lighthouse-reports/
|
||||
retention-days: 14
|
||||
|
||||
deploy-test:
|
||||
needs: [check, lighthouse]
|
||||
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: web/dist
|
||||
|
||||
# Eenvoudig: de testmap leegmaken en de nieuwe build erin zetten. Oude
|
||||
# versies worden niet bewaard. Op de Pi draait ook de huidige
|
||||
# WordPress-site; daarom weigert deze stap een lege variabele, '/', of
|
||||
# een map waarin WordPress staat.
|
||||
- name: Upload naar de testserver
|
||||
env:
|
||||
# Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt
|
||||
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }}
|
||||
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
|
||||
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
|
||||
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }}
|
||||
run: |
|
||||
case "$DEPLOY_PATH" in
|
||||
''|'/'|*' '*) 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"
|
||||
$SSH "set -e
|
||||
if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then
|
||||
echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1
|
||||
fi
|
||||
mkdir -p '$DEPLOY_PATH'
|
||||
find '$DEPLOY_PATH' -mindepth 1 -delete"
|
||||
sshpass -e scp -P "$SSH_PORT" -o StrictHostKeyChecking=accept-new -r dist/. "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/"
|
||||
echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})"
|
||||
|
||||
- name: Controle na deploy
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
run: |
|
||||
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi
|
||||
curl -fsS -o /dev/null --retry 5 --retry-delay 3 "$HEALTH_URL"
|
||||
curl -fsSI "$HEALTH_URL" | grep -qi '^content-security-policy:'
|
||||
echo "Test bereikbaar met security headers"
|
||||
|
||||
# Productie wacht wel op Lighthouse: toegankelijkheid, Best Practices en SEO
|
||||
# moeten slagen voordat er iets live gaat.
|
||||
deploy-production:
|
||||
needs: [check, lighthouse]
|
||||
# Alleen handmatig, en alleen vanaf een release-branch
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true' && startsWith(github.ref, 'refs/heads/release/')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: raspberry-pi
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
| Type | Name | Status | Branch | Affected Components | Session Start |
|
||||
|------|------|--------|--------|---------------------|---------------|
|
||||
| Feature | frontend-shell | 🟡 Operations | feature/frontend-shell | web/src (AppShell, NavigationBar, Footer, Hero socials, new BackToTop/SkipLink/404/error pages, routes, theme.ts, main.tsx), web/vite.config.js, web/package.json | 2026-10-14 |
|
||||
| Feature | frontend-shell | ✅ Complete | feature/frontend-shell | web/src (AppShell, NavigationBar, Footer, Hero socials, new BackToTop/SkipLink/404/error pages, routes, theme.ts, main.tsx), web/vite.config.js, web/package.json | 2026-10-14 |
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
- **Feature Slug**: frontend-shell
|
||||
- **Project Type**: Brownfield
|
||||
- **Start Date**: 2026-10-14T09:46:02Z
|
||||
- **Current Stage**: OPERATIONS - Deployment Setup (awaiting approval)
|
||||
- **Current Stage**: Complete
|
||||
- **Branch**: feature/frontend-shell
|
||||
|
||||
## Workspace State
|
||||
@@ -40,6 +40,10 @@
|
||||
- **Included**: Yes
|
||||
- **Method**: CI/CD (Gitea Actions) — test via SSH/scp to Raspberry Pi nginx, production via FTPS to IIS webhost (manual, release/* only)
|
||||
|
||||
### Monitoring Setup
|
||||
- **Included**: Yes
|
||||
- **Approach**: Combination — Sentry (JS errors), Umami (cookieless visitor stats), UptimeRobot (availability); e-mail alerts; reuses existing services
|
||||
|
||||
## Scope Notes (from user)
|
||||
- Side area / "Info menu" from the static design is OUT of scope (deliberately left out)
|
||||
- E-mail address in the mobile menu is OUT of scope (deliberately left out)
|
||||
@@ -69,14 +73,14 @@
|
||||
- [x] Build and Test - EXECUTE (complete)
|
||||
|
||||
### 🟡 OPERATIONS PHASE
|
||||
- [~] Deployment Setup - EXECUTE (artifacts generated, awaiting approval)
|
||||
- [ ] Monitoring Setup - EXECUTE
|
||||
- [ ] Production Readiness Validation - EXECUTE
|
||||
- [x] Deployment Setup - EXECUTE (approved; pipeline verified, first test deploy green)
|
||||
- [x] Monitoring Setup - EXECUTE (approved; Sentry + Umami live on test and verified)
|
||||
- [x] Production Readiness Validation - EXECUTE (complete; ready with caveats, go-live follow-ups in the checklist)
|
||||
|
||||
## Current Status
|
||||
- **Lifecycle Phase**: OPERATIONS
|
||||
- **Current Stage**: Deployment Setup
|
||||
- **Next Stage**: Monitoring Setup
|
||||
- **Lifecycle Phase**: COMPLETE
|
||||
- **Current Stage**: Complete
|
||||
- **Next Stage**: None (feature complete)
|
||||
|
||||
## Reverse Engineering Status
|
||||
- [x] Reverse Engineering - Artifacts generated on 2026-10-14T09:58:04Z (approved 2026-10-14T10:05:21Z)
|
||||
|
||||
@@ -702,3 +702,301 @@ Verder heb ik de vraag ook beantwoord"
|
||||
**Context**: OPERATIONS - Deployment Setup; fixing CI
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - PR Green and Merged
|
||||
|
||||
**Timestamp**: 2026-10-18T23:42:04Z
|
||||
|
||||
**User Input**: "(none — monitoring as authorised)"
|
||||
|
||||
**AI Response**: "Run 530 (PR #3, 23f7020): check and lighthouse succeeded. PR #3 auto-merged by the owner (merge commit fccc909). Run 531 (push to master) started with deploy-test; watching it."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup; watching first master run
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - First Master Run 531
|
||||
|
||||
**Timestamp**: 2026-10-19T00:01:36Z
|
||||
|
||||
**User Input**: "(none — monitoring as authorised)"
|
||||
|
||||
**AI Response**: "Run 531 (push to master, fccc909): check and lighthouse succeeded; deploy-test reached the Pi (SSH login with secrets OK, WordPress guard passed) but failed on 'mkdir: cannot create directory /var/www/html/andreaslop-test: Permission denied'. Cause: folder missing and /var/www/html owned by root (deployment-instructions 1.2.1 not yet done). Not solved with sudo in the pipeline (would widen deploy-user rights). Asked owner to create and chown the folder once, then re-run."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup; awaiting owner action on the Pi
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Lighthouse After Test Deploy
|
||||
|
||||
**Timestamp**: 2026-10-19T07:01:45Z
|
||||
|
||||
**User Input**: "Ja, voer maar door, maar wacht met een PR maken totdat de huidige run de deploy-test job heeft afgerond. Ik heb voor PR's bewust alleen de check job aangegeven omdat ik dacht dat lighthouse vooral belangrijk is voor productie om te blokkeren en voor test is het info waar je eventueel op kan reageren als je het lokaal vergeten bent bijvoorbeeld. Voor nu hoeft het niet als check voor mergen naar master."
|
||||
|
||||
**AI Response**: "Owner re-ran run 531 after creating the test folder via a symlink (/var/www/html -> /mnt/storage1/www/html; explained symlink permissions are ignored, target folder rights count). Fast-forwarded feature/frontend-shell to master (fccc909). Workflow: deploy-test now needs only check (Lighthouse runs alongside as information); deploy-production still needs check and lighthouse. Deployment plan D6 updated incl. branch protection (only check required, Lighthouse deliberately not). Pushing to the feature branch; PR to be created after run 531's deploy-test finishes."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Run 531 Re-run Result
|
||||
|
||||
**Timestamp**: 2026-10-19T07:08:01Z
|
||||
|
||||
**User Input**: "ik zie niet dat je de run in de gaten aan het houden bent, klopt dat? Hij zit al in de deploy-test en heb je nog niks zien zeggen over de run"
|
||||
|
||||
**AI Response**: "Explained the watcher only notified at run completion. Re-run of 531: check and lighthouse succeeded; deploy-test resolved the symlink (/var/www/html/andreaslop-test -> /mnt/storage1/www/html/andreaslop-test), SSH login, WordPress guard and mkdir OK; scp failed with 'Permission denied' on files and 'remote setstat' on the folder: deploy user lacks write access and is not the owner. Asked owner to chown the target folder to the SSH user and re-run the failed job. Watcher extended with STOP_ON_JOB to report as soon as deploy-test finishes; started for the next re-run."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup; awaiting owner action on the Pi
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Test Folder Permissions
|
||||
|
||||
**Timestamp**: 2026-10-19T07:32:23Z
|
||||
|
||||
**User Input**: "hoe doet de workspace `K:\Development\Projects\SimpleDeckApp` het in de deployment? want die kan wel deployen terwijl daar dezelfde rechten op staan en dezelfde gebruiker wordt gebruikt" / "ik heb de rechten aangepast. de gebruiker zat al wel in de juiste groep, maar ik zag dat die nog niet mocht schrijven naar de map. alleen uitlezen en uitvoeren. dus even deze run afwachten nu"
|
||||
|
||||
**AI Response**: "SimpleDeckApp creates a new releases/<timestamp> folder as the SSH user before scp, so the user owns its target; our pipeline wrote into an existing folder not owned by the user. Owner gave the group write access. Remaining issue: scp -r dist/. also sets the target folder's mode (setstat), which only the owner may do. Changed deploy-test to copy dist/* with dotglob (contents, not the folder; hidden files included, verified locally), so group write is sufficient. Pushed to feature/frontend-shell; current run 531 still uses the old step."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup; watching run 531
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - First Successful Test Deploy
|
||||
|
||||
**Timestamp**: 2026-10-19T07:34:55Z
|
||||
|
||||
**User Input**: "(none — monitoring as authorised)"
|
||||
|
||||
**AI Response**: "Run 531 re-run succeeded: check, lighthouse and deploy-test green. Verified https://test.andreaslop.nl with curl and headless Chrome: /, /portfolio, /bestaat-niet return 200 and render correct title, h1 and robots meta with footer; no console errors or failed requests; robots.txt disallows all; all five security headers plus X-Robots-Tag noindex; index no-cache, assets immutable 1 year; http -> https 301. Fallback head present in served HTML (title wrapped over lines by Prettier). Creating PR for job order (a87602e) and group-write deploy (67ef16b)."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Deploy User and Folder Rights in Instructions
|
||||
|
||||
**Timestamp**: 2026-10-19T07:41:36Z
|
||||
|
||||
**User Input**: "kan in de deployinstructies worden opgenomen dat voor de pipeline de gebruiker gitea-workflow gebruikt moet worden. die zit in de www-data groep en die groep moet wel schrijfrechten hebben. ik had bijvoorbeeld met de webadmin gebruiker in filezilla de map aangemaakt. die zit ook in de www-data groep, maar de rechten worden standaard 755 en die staan nu op 775 en dat werkte dus."
|
||||
|
||||
**AI Response**: "Updated deployment-instructions.md: PI_MAIN_USERNAME = gitea-workflow (member of www-data); step 1.2.1 now creates the folder with chgrp www-data and chmod 2775, explains the 755 default (FileZilla/mkdir) pitfall, setgid tip, and the external-disk symlink; added a troubleshooting row for mkdir/scp Permission denied. Pushing to the PR #4 branch (restarts the PR run)."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Commit/Push Scope
|
||||
|
||||
**Timestamp**: 2026-10-19T07:43:33Z
|
||||
|
||||
**User Input**: "laat mij weten wanneer die klaar is. gezien alles nu lijkt te werken wi lik niet meer dat je zelf commit en pusht. dat was voor het fixen van de pipeline. dese pr kunnen we nu ook gebruiken voor de rest van deze aidlc feature"
|
||||
|
||||
**AI Response**: "Autonomous commit/push withdrawn; only on explicit request from now on. PR #4 stays open for the rest of the frontend-shell AI-DLC feature. Watching run 533 and will report when done."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup
|
||||
|
||||
---
|
||||
|
||||
## Deployment Setup - Approval
|
||||
|
||||
**Timestamp**: 2026-10-19T08:02:45Z
|
||||
|
||||
**User Input**: "ja, zodra hij groen is mag je door naar de monitoring fase"
|
||||
|
||||
**AI Response**: "Run 533 (PR #4, 7750971) green: check and lighthouse succeeded. Deployment Setup marked approved (decision: included; method CI/CD via Gitea Actions, test via SSH/scp to Raspberry Pi nginx, production via FTPS to IIS, manual from release/*). Started OPERATIONS - Monitoring Setup. Found existing monitoring stack in owner's projects (SlpSoftware react-frontend, SlpModularCms): Sentry free tier, self-hosted Umami on the Pi, UptimeRobot."
|
||||
|
||||
**Context**: OPERATIONS - Deployment Setup complete; Monitoring Setup started
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Plan and Questions
|
||||
|
||||
**Timestamp**: 2026-10-19T08:03:14Z
|
||||
|
||||
**User Input**: "(none — stage start)"
|
||||
|
||||
**AI Response**: "Created operations/plans/monitoring-setup-plan.md: context (static site; existing Sentry/Umami/UptimeRobot stack in other projects), pre-decided items (one build for both environments, environment from hostname at runtime; narrow CSP exceptions per chosen service generated into web.config/nginx; privacy statement action item), and 7 questions (inclusion, approach, reuse, Sentry delivery without tunnel, Umami, UptimeRobot, alert channels)."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; awaiting answers
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Answers and Artifacts
|
||||
|
||||
**Timestamp**: 2026-10-19T09:23:26Z
|
||||
|
||||
**User Input**: "ik heb de vragen beantwoord"
|
||||
|
||||
**AI Response**: "Answers: Q1 A, Q2 D, Q3 A, Q4 A, Q5 A, Q6 'A, maar gezien er nu ook al een site draait kan ik die nu ook al opzetten voor productie. Voor UptimeRobot hoeven we verder geen code toe te voegen toch?', Q7 A. Confirmed UptimeRobot needs no code; production monitor can start now (watches WordPress until DNS switch), deep-link monitor after go-live. Read SlpSoftware's Sentry init (tunnel via reverse proxy) and UmamiAnalytics (analytics.slpsoftware.nl). Generated operations/monitoring/monitoring-plan.md (M1-M8: hostname-based environment with one build, config in code, direct Sentry without tunnel, lazy Sentry for performance, errors only without PII, separate Umami websites with data-domains and DNT, narrow CSP exceptions, UptimeRobot monitors) and monitoring-setup.md (one-time steps per service, code changes per file, tests, checks after deploy, values needed). Code changes deferred until approval. State updated."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; awaiting approval
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Sentry Plugin
|
||||
|
||||
**Timestamp**: 2026-10-19T09:47:28Z
|
||||
|
||||
**User Input**: "Help me met het opzetten van sentry. org slug: slp-software run code: 8fc9ce6c75" / "ik heb net de sentry agent plugin geinstalleerd. die zou je kunnen gebruiken. ik heb namelijk uitgevoerd `npx @sentry/agent-plugin install slp-software#8fc9ce6c75`"
|
||||
|
||||
**AI Response**: "Read Sentry's instrument playbook: provisioning, DSN retrieval, onboarding progress (run code) and verification all go through the Sentry MCP. Owner installed the Sentry plugin (sentry@claude-plugins-official 1.4.0, MCP https://mcp.sentry.dev/mcp, enabled globally); its tools are not loaded in this already-running session. Advised: restart Claude Code, authenticate via /mcp, start the Sentry setup with a first prompt containing the onboarding code and the M1-M7 constraints (errors only, no tracing/replay, lazy load, hostname-based environment, no PII), on feature/frontend-shell without committing/pushing unasked. Monitoring artifacts and audit entries are uncommitted; offered to commit on request."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; awaiting session restart for Sentry MCP
|
||||
|
||||
---
|
||||
|
||||
## Session End - Commit
|
||||
|
||||
**Timestamp**: 2026-10-19T09:49:35Z
|
||||
|
||||
**User Input**: "ik start een nieuwe sessie. de ssh agent. moet die dan ook opnieuw gestart worden? Commit alle wijzigingen voor ik de sessie sluit"
|
||||
|
||||
**AI Response**: "Explained the ssh-agent survives Claude sessions (key lifetime 4h). Committed all pending changes (monitoring plan and setup, monitoring question file with answers, state and audit) on feature/frontend-shell; not pushed."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; awaiting approval / Sentry setup in a new session
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Sentry Project via MCP
|
||||
|
||||
**Timestamp**: 2026-10-19T09:55:00Z
|
||||
|
||||
**User Input**: "ik wil verder met de openstaande feature. we waren bezig met monitoring en ik was bezig met het opzetten van sentry. Die geeft mij de volgende prompt zodat jij mij kan helpen opzetten met behulp van de mcp server die ik heb toegevoegd, prompt van sentry: Help me create and set up Sentry projects for this application. org slug: slp-software run code: 8fc9ce6c75" / "kan je het nog eens proberen? members kunnen nu een project aanmaken"
|
||||
|
||||
**AI Response**: "Org slp-software (EU, de.sentry.io), team slp-software. First create_project failed with 403: the MCP OAuth token acts as a member and 'Let Members Create Projects' was off. Owner enabled it; created project andreaslop-fotografie (javascript-react), DSN https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720. Changed the default alert 1390900 from 'high priority issues' to 'first seen event' (a new issue is created) → e-mail, renamed 'Send a notification for new issues', to match Q7 = A. 'Prevent Storing of IP Addresses' has no MCP tool: left for the owner in the UI. Seer PR-ready rule left untouched."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; one-time Sentry setup
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Umami IDs and Code Changes
|
||||
|
||||
**Timestamp**: 2026-10-19T10:07:53Z
|
||||
|
||||
**User Input**: "de umami Website ID's zijn: - Andrea Slop Fotografie (Test): 7fb301ab-6ecc-4aea-beee-71bcb6009bfe - Andrea Slop Fotografie: 3edbb7d1-4388-4f2d-9cef-11ade88ace96"
|
||||
|
||||
**AI Response**: "Took the owner's completed one-time setup and supplied values as approval of the monitoring setup and implemented the code changes from monitoring-setup.md: @sentry/react 11.8.0; src/monitoring/config.ts (DSN, ingest origin derived from DSN, Umami origin, monitoringFor via Map); src/monitoring/sentry.ts (startSentry after load event, queue incl. early unhandled errors/rejections, reportError); src/monitoring/sentryClient.ts (named re-exports, lazy chunk 31 kB gzip instead of 150 kB); UmamiAnalytics in AppShell (data-website-id, data-domains, data-do-not-track); ErrorPage calls reportError; CSP script-src + Umami, connect-src + Umami + Sentry ingest, regenerated web.config and nginx; workflow Build step sets VITE_RELEASE=github.sha. Found: SDK 11 removed sendDefaultPii and collects all data by default, so every dataCollection category is set off explicitly (M5). Tests: monitoringFor examples + PBT (domains, IPs, strings, lookalikes → null), sentry queue/start/once/load-event/unhandled, UmamiAnalytics per host/unknown host/once, CSP exactly two external hosts in the right directives. lint, format, 109 tests and build green. Main bundle unchanged (572 kB vs 579 kB before). Not committed."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; code changes done, awaiting approval
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Commit/Push and Watch Run
|
||||
|
||||
**Timestamp**: 2026-10-19T10:08:46Z
|
||||
|
||||
**User Input**: "Zodra je klaar bent mag je comiiten en pushen. Daarna wil ik dat je de run van de PR in de gaten houdt om te zien of die slaagt. Je hebt toestemming om zelf de problemen die je tegenkomt op te lossen, te committen en te pushen totdat alles weer slaagt en groen is. Ik wil achteraf wel een samenvatting van wat je gedaan hebt. ga nog NIET automatisch door naar de volgende stage van aidlc. dat geef ik aan wanneer dat mag"
|
||||
|
||||
**AI Response**: "Committing and pushing the monitoring changes to PR #4; watching the PR run and fixing/committing/pushing until green (permission scoped to this task). Monitoring Setup stays awaiting approval; not proceeding to Production Readiness until the owner says so."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; task-scoped commit/push permission
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Sentry IP Storage
|
||||
|
||||
**Timestamp**: 2026-10-19T10:09:56Z
|
||||
|
||||
**User Input**: "ik heb `Prevent Storing of IP Addresses` in Sentry aan gezet"
|
||||
|
||||
**AI Response**: "Noted: step 1.3 (M5) done by the owner in the Sentry UI. The MCP has no tool to read this project setting, so not independently verified. All one-time Sentry steps are now complete. Audit entry not pushed yet, to avoid restarting the running PR run."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - PR Run Watch
|
||||
|
||||
**Timestamp**: 2026-10-19T10:30:34Z
|
||||
|
||||
**User Input**: "Zou een nieuwe push de oude run niet moeten stoppen? Anders moet dat er nog bij worden gebouwd." / "je hebt dus toestemming om de runs te controleren en te fixen totdat dit gedeelte klaar is."
|
||||
|
||||
**AI Response**: "Confirmed the workflow already cancels stale PR runs (concurrency, cancel-in-progress for pull_request): run 534 was cancelled by the push of 6d3a156. Holding back the audit push had been the wrong call (a later push also starts a full run), so pushed 51d2dc1 immediately; run 535 cancelled. Run 536 (51d2dc1) green: check success (lint, format, tests, build with VITE_RELEASE, audits), lighthouse success, deploy-test skipped (PR). No fixes needed. Commit/push permission scoped to this monitoring part; this audit entry committed locally, not pushed, to avoid another run. Monitoring Setup still awaiting the owner's go for the next stage."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup; PR run green
|
||||
|
||||
---
|
||||
|
||||
## Deployment - Second Runner and Job Order
|
||||
|
||||
**Timestamp**: 2026-10-19T12:17:12Z
|
||||
|
||||
**User Input**: "Ik heb de labels aangepast. kan je het controleren? Daarna mag je de aanpassingen voor de workflow doen. dan kunnen we meteen alles testen" (earlier: "Ik wil nog wel de mogelijkheid hebben om ze tegelijk te draaien als ik 2 runners heb, maar als alleen de pi draait of de andere runner nog druk is wil ik dat deploy eerst wordt opgepakt. is dat mogelijk?" and "Dat is nog een issue. MIsschien later te verhelpen of deploys niet op de pc laten doen.")
|
||||
|
||||
**AI Response**: "Owner added a second global runner on the PC (bryan-desktop-podman, Podman in WSL, same job image as the Pi, labels global/linux/x64/podman/bryan-desktop). Pi labels verified via API: linux-arm64, ubuntu-latest, global, linux, arm64, podman, raspberry-pi. Gitea 1.27 hands out waiting jobs ordered by (updated, id) and job ids follow the YAML order, and a runner must have all runs-on labels. Workflow: check and lighthouse on 'linux' (any runner), deploy-test and deploy-production on 'raspberry-pi' (deploys never on the PC; container actions do not work on Podman); deploy-test moved above lighthouse so a single free runner takes the deploy first while two runners run them in parallel. Commit/push and test runs allowed for this change."
|
||||
|
||||
**Context**: OPERATIONS - Deployment pipeline adjustment (during Monitoring Setup approval wait)
|
||||
|
||||
---
|
||||
|
||||
## Deployment - Runner Tests
|
||||
|
||||
**Timestamp**: 2026-10-19T12:58:55Z
|
||||
|
||||
**User Input**: "In theorie kan de raspberry pi de lighthouse nog wel runnen toch? De raspberry pi runne ris namelijk de hoofdrunner die altijd aan staat en alles moet kunnen runnnen anmelijk"
|
||||
|
||||
**AI Response**: "Confirmed: the Pi has every label the workflow uses (linux for check/lighthouse, raspberry-pi for deploys) with the same job image as before. Test results: run 538 (PR, 0eec9a4) failed: lighthouse on the PC runner, chrome-launcher treated the container as WSL (is-wsl sees 'microsoft' in the shared WSL kernel; is-docker 2.2.1 only checks /.dockerenv, which Podman does not create) and tried /mnt/undefined/Users/undefined/AppData/Local. Fixed in the PC runner config (empty /.dockerenv via --volume /dev/null:/.dockerenv:ro), not in the project; also fixed start-runner.ps1 (PowerShell 'if (podman container exists)' tested output, not exit code, so the old container was never replaced). Run 539 (dispatch, both runners): check Pi, deploy-test Pi in parallel with lighthouse on the PC, all green. Run 540 (dispatch, PC runner stopped): Pi ran check, then deploy-test, then lighthouse, all green. PC runner restarted. Updated deployment-instructions 1.1 and deployment-plan D1. Docs committed locally, not pushed (a push starts another full run); commit/push permission for this change ends here."
|
||||
|
||||
**Context**: OPERATIONS - Deployment pipeline adjustment verified
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup - Approval
|
||||
|
||||
**Timestamp**: 2026-10-19T13:02:24Z
|
||||
|
||||
**User Input**: "helemaal goed. ga door naar Production Readiness"
|
||||
|
||||
**AI Response**: "Monitoring Setup marked approved (Sentry + Umami verified on test: Sentry event in environment test with the commit as release, owner saw it and resolved it; Umami counted the owner's own visit, headless Chrome is ignored as a bot). Started Production Readiness Validation: not a .NET project (no .csproj, api/ empty), so the appsettings check is skipped. Rollback (rollback-plan.md), backups (static site, nothing to back up), secrets (Gitea secrets; DSN/Umami IDs public by design) and alert ownership (owner, Q7 = A) are covered. Open gaps put in operations/plans/production-readiness-questions.md: production dress rehearsal, www.andreaslop.nl, incident runbook, SSH password for deploy-test, privacy statement before go-live."
|
||||
|
||||
**Context**: OPERATIONS - Monitoring Setup complete; Production Readiness Validation started, awaiting answers
|
||||
|
||||
---
|
||||
|
||||
## Production Readiness Validation - Answers
|
||||
|
||||
**Timestamp**: 2026-10-19T13:49:14Z
|
||||
|
||||
**User Input**: "ik heb de vragen beantwoord"
|
||||
|
||||
**AI Response**: "Answers: Q1 B ('want ik heb de hosting nog niet dus kan dat nog niet testen'), Q2 A, Q3 B, Q4 B, Q5 A. Implemented Q2: web.config redirects www.andreaslop.nl with 301 to https://andreaslop.nl in one step (rule before HTTPS; productionHost in serverConfig.ts; tests for the rule, its order and that the target is the monitored production host); regenerated web.config; lint, format, typecheck, 111 tests and build green. Deployment instructions go-live: www check in the dress rehearsal, privacy statement as blocking step before the DNS switch (Q5 A), certificate must cover www, post-go-live monitoring checks. Created operations/production-readiness-checklist.md. Not committed (commit/push only on request)."
|
||||
|
||||
**Context**: OPERATIONS - Production Readiness Validation
|
||||
|
||||
---
|
||||
|
||||
## Production Readiness Validation - Complete
|
||||
|
||||
**Timestamp**: 2026-10-19T13:49:14Z
|
||||
|
||||
**Overall Readiness**: Yes with caveats (production go-live belongs to the feature that fills the pages; hosting not yet available)
|
||||
|
||||
**Feature Status**: Complete
|
||||
|
||||
---
|
||||
|
||||
## Production Readiness Validation - Commit and Push
|
||||
|
||||
**Timestamp**: 2026-10-19T14:14:26Z
|
||||
|
||||
**User Input**: "heb je alle changes al gepusht" / "ja doe dat maar"
|
||||
|
||||
**AI Response**: "Committing the www redirect, go-live instructions, readiness checklist and questions, state, registry and audit, and pushing together with the local runner-docs commit to PR #4; watching the run until green."
|
||||
|
||||
**Context**: Feature complete; commit/push on request
|
||||
|
||||
---
|
||||
|
||||
## Deployment - Runner Preference
|
||||
|
||||
**Timestamp**: 2026-10-19T15:22:43Z
|
||||
|
||||
**User Input**: "lighthouse is weer met de raspberry pi opgepakt. kan je voorkeur geven voor runner of is het gewoon net welke hem oppakt?" / "kan jij dat nog toevoegen committen en pushen?"
|
||||
|
||||
**AI Response**: "Explained: Gitea has no runner priority; the first runner that fetches with matching labels gets the job, and a runner fetches again right after finishing one (run 541: check and then lighthouse on the Pi). The PC runner v3.5 also backs off to 5 s while idle. Set the PC runner to fetch_interval 1s / fetch_interval_max 1s (restarted); the Pi needs fetch_interval: 10s in /etc/gitea-runner/config.yaml (owner, outside the repo). Run 541 (c24f629) green. Documented the preference in deployment-instructions 1.1; committing and pushing on request."
|
||||
|
||||
**Context**: Feature complete; deployment documentation update
|
||||
|
||||
---
|
||||
|
||||
+37
-7
@@ -13,7 +13,7 @@ In Gitea, under **Repository → Settings → Actions**:
|
||||
|---|---|
|
||||
| `PI_MAIN_ADDRESS` | Address of the Pi as reachable from the runner (same as in your other projects) |
|
||||
| `PI_MAIN_PORT` | SSH port |
|
||||
| `PI_MAIN_USERNAME` | SSH user |
|
||||
| `PI_MAIN_USERNAME` | `gitea-workflow`: the deploy user for pipelines, member of the `www-data` group (see 1.2) |
|
||||
| `PI_MAIN_PASSWORD` | SSH password (see 1.4 for switching to a key) |
|
||||
| `FTP_HOST` | Domain or A-record IP of the hosting space (control panel) |
|
||||
| `FTP_USERNAME` | FTP account **including** the FTP prefix |
|
||||
@@ -28,16 +28,41 @@ In Gitea, under **Repository → Settings → Actions**:
|
||||
| `HEALTH_CHECK_URL_PRODUCTION` | `https://andreaslop.nl/` | no; set it only once the DNS points to the new host |
|
||||
| `FTP_REMOTE_DIR` | `wwwroot` | no; default `wwwroot` |
|
||||
|
||||
Check that Actions is enabled for the repository. The global runner `raspberry-pi-arm64` picks up `runs-on: ubuntu-latest`.
|
||||
Check that Actions is enabled for the repository. Two global runners, each job image `gitea/runner-images:ubuntu-latest`. A job runs on a runner that has **all** its `runs-on` labels.
|
||||
|
||||
| Runner | Labels | Always on | Runs |
|
||||
|---|---|---|---|
|
||||
| `raspberry-pi-arm64` (systemd service `gitea-runner`, config `/etc/gitea-runner/config.yaml`) | `global`, `linux`, `arm64`, `podman`, `raspberry-pi`, plus `ubuntu-latest` and `linux-arm64` for older workflows | yes | everything |
|
||||
| `bryan-desktop-podman` (Podman machine on the owner's PC, `C:\Users\Bryan\gitea-runner\`) | `global`, `linux`, `x64`, `podman`, `bryan-desktop` | no | `check` and `lighthouse` when it is free |
|
||||
|
||||
`check` and `lighthouse` use `runs-on: linux`, the deploys `runs-on: raspberry-pi`. `deploy-test` is listed above `lighthouse` in the workflow: Gitea hands out waiting jobs in that order, so a single free runner deploys first, while two runners deploy and run Lighthouse at the same time.
|
||||
|
||||
Gitea has no runner priority: a job goes to the first runner that asks for work and has all its labels, and a runner asks again right after finishing a job. To let the PC take `check` and `lighthouse` when it is on, the PC asks every second and the Pi every 10 seconds:
|
||||
|
||||
| Runner | Setting under `runner:` |
|
||||
|---|---|
|
||||
| PC (`C:\Users\Bryan\gitea-runner\config.yaml`) | `fetch_interval: 1s` and `fetch_interval_max: 1s` (no slowing down while idle) |
|
||||
| Pi (`/etc/gitea-runner/config.yaml`) | `fetch_interval: 10s`; restart with `sudo systemctl restart gitea-runner` only while it runs no job |
|
||||
|
||||
This is a strong preference, not a guarantee: a busy PC leaves the job to the Pi, and with the PC off the Pi starts a run at most 10 seconds later.
|
||||
|
||||
Notes for the PC runner: its job containers share the WSL kernel, so the runner mounts an empty `/.dockerenv` (otherwise `is-wsl` in chrome-launcher treats the container as WSL and Lighthouse fails). Container actions (`uses:` of a Docker action) do not work on Podman; that is one reason deploys stay on the Pi.
|
||||
|
||||
### 1.2 Test server (Raspberry Pi with nginx)
|
||||
The current WordPress site runs on the same Pi. The test site gets its **own folder** and its **own nginx block**, and touches nothing of WordPress.
|
||||
|
||||
1. Create a separate folder, **not** inside the WordPress folder:
|
||||
1. Create a separate folder, **not** inside the WordPress folder, and give the `www-data` group **write** access.
|
||||
|
||||
The pipeline logs in as **`gitea-workflow`**, a member of the `www-data` group. Group write access on the folder is enough; `gitea-workflow` does not need to own it. The folder may be created by another user, for example `webadmin` (also in `www-data`) via FileZilla.
|
||||
```bash
|
||||
sudo mkdir -p /var/www/html/andreaslop-test
|
||||
sudo chown <ssh-user> /var/www/html/andreaslop-test
|
||||
sudo chgrp www-data /var/www/html/andreaslop-test
|
||||
sudo chmod 2775 /var/www/html/andreaslop-test
|
||||
```
|
||||
- **775 is required.** New folders get **755** by default, also when created with FileZilla or `mkdir`. With 755 the group may only read, and the deploy fails with `Permission denied`. Check it with `ls -ld /var/www/html/andreaslop-test`: it must show `drwxrwxr-x` (or `drwxrwsr-x` with the 2).
|
||||
- **The 2 (setgid)** is optional but recommended. New files and folders in the test folder then also get group `www-data`, so `webadmin` and `gitea-workflow` can keep managing each other's files.
|
||||
- **On the Pi** `/var/www/html` is a symlink to `/mnt/storage1/www/html` (external disk). Rights on the symlink itself are ignored; the folder it points to counts. The commands above work through the symlink.
|
||||
|
||||
Every deploy empties this folder first. The pipeline refuses a folder with `wp-config.php` or `wp-content` in it.
|
||||
2. Copy [`web/deploy/nginx/andreaslop-test.conf`](../../../../../web/deploy/nginx/andreaslop-test.conf) to `/etc/nginx/conf.d/andreaslop-test.conf`. nginx loads everything in `conf.d/` automatically, so no symlink is needed. Adjust `server_name` and `root` if needed.
|
||||
```bash
|
||||
@@ -107,10 +132,14 @@ git rm --cached -r -q . && git reset --hard
|
||||
- an unknown URL (the 404 page)
|
||||
- the five security headers (`curl -sI`)
|
||||
- that HTTP redirects to HTTPS
|
||||
- that `www.andreaslop.nl` (also add it to the `hosts` entry) redirects with 301 to `https://andreaslop.nl/` in one step, path included
|
||||
- Remove the `hosts` entry afterwards.
|
||||
2. Switch the DNS of `andreaslop.nl` (and `www`) to the new host, and make sure HTTPS is active.
|
||||
3. Set `HEALTH_CHECK_URL_PRODUCTION` so every deploy is checked from then on.
|
||||
4. Verify the live headers: `curl -sI https://andreaslop.nl/` must show all five security headers.
|
||||
2. **Privacy statement first (blocking).** The privacy statement page must mention Umami (anonymous, cookieless, self-hosted in the Netherlands) and Sentry (error reports without IP address or personal data, EU region). Do not switch the DNS before it does.
|
||||
3. Switch the DNS of `andreaslop.nl` and `www` to the new host, and make sure HTTPS is active for both (the certificate must cover `www`, otherwise the redirect shows a certificate error first).
|
||||
4. Set `HEALTH_CHECK_URL_PRODUCTION` so every deploy is checked from then on.
|
||||
5. Verify the live headers: `curl -sI https://andreaslop.nl/` must show all five security headers.
|
||||
6. Add the UptimeRobot deep-link monitor for `https://andreaslop.nl/portfolio` (monitoring-setup §3).
|
||||
7. Check the monitoring on production: a test error in the console arrives in Sentry under `production`, and a visit shows in Umami's production website.
|
||||
|
||||
## 3. If something fails
|
||||
|
||||
@@ -120,5 +149,6 @@ git rm --cached -r -q . && git reset --hard
|
||||
| Lighthouse: "Chrome could not be started" | Sandbox | `LIGHTHOUSE_CHROME_FLAGS` must contain `--no-sandbox` (already set). |
|
||||
| `Format` fails only in CI | Line endings | See 1.5. |
|
||||
| `sshpass`: Permission denied | Wrong secret, or special characters | Secrets go via `env:` (already so); check the values. |
|
||||
| `mkdir: cannot create directory` or `scp: dest open …: Permission denied` | The test folder does not exist, or the `www-data` group may not write to it (755 instead of 775) | See 1.2: `chgrp www-data` and `chmod 2775` on the test folder. |
|
||||
| `lftp`: certificate verification failed | Hostname does not match the hoster's certificate | Use the hostname from the control panel in `FTP_HOST`, not the IP. |
|
||||
| Health check fails, page is 404 on deep links | SPA fallback missing | Production: `web.config` not uploaded or URL Rewrite off. Test: nginx config not active. |
|
||||
|
||||
@@ -29,12 +29,12 @@ Text alternative: feature branches go through a pull request with CI into master
|
||||
|
||||
| # | Decision | Source |
|
||||
|---|---|---|
|
||||
| D1 | **CI**: Gitea Actions on the existing global runner `raspberry-pi-arm64` (labels `linux-arm64`, `ubuntu-latest`; Podman). | Q2 = A, Q3 = A, CQ5 |
|
||||
| D1 | **CI**: Gitea Actions on the global runner `raspberry-pi-arm64` (always on; Podman), plus since 2026-10-19 a second global runner on the owner's PC (`bryan-desktop-podman`, x64). Labels per property (`linux`, `arm64`/`x64`, `podman`, machine name); `check` and `lighthouse` run on any `linux` runner, deploys only on `raspberry-pi`, and the job order makes a single runner deploy before Lighthouse. See deployment-instructions 1.1. | Q2 = A, Q3 = A, CQ5; owner 2026-10-19 |
|
||||
| D2 | **Branching**: `master` + short-lived `feature/*` + `release/*`, no `develop` (trunk-based with release branches). Releases are merged back into `master` and tagged `vX.Y.Z` there. | CQ1 |
|
||||
| D3 | **Environments**: test and production. | Q5 = B |
|
||||
| D4 | **Test deploy**: automatically on every push to `master` (incl. a merged PR), and manually from any branch with "Deploy to Test", for example to try a branch before merging. | Q6 = B, CQ1 |
|
||||
| D5 | **Production deploy**: manual only ("Deploy to Production"), and only from a `release/*` branch; the workflow refuses other branches. | Q6 = B, CQ1 |
|
||||
| D6 | **Quality gate**: every run does lint, format, tests, build, audit and Lighthouse (mobile + desktop) before any deploy job can start. In CI, Lighthouse **Performance is report-only** (the Pi runner gives scores 30-40 points too low); accessibility, best practices and SEO block. Performance blocks in `pnpm check` on a PC. HTML reports are attached to every run as the `lighthouse-reports` artifact. | Q7 = A; Lighthouse CI question A |
|
||||
| D6 | **Quality gate**: every run does lint, format, tests, build and audit (`check`) before any deploy. **Test deploys right after `check`**, and Lighthouse (mobile + desktop) runs alongside as information. **Production waits for both `check` and Lighthouse.** Branch protection on `master` requires only `check`; Lighthouse is deliberately not a merge requirement. In CI, Lighthouse **Performance is report-only** (the Pi runner gives scores 30-40 points too low); accessibility, best practices and SEO block. Performance blocks in `pnpm check` on a PC. HTML reports are attached to every run as the `lighthouse-reports` artifact. | Q7 = A; Lighthouse CI question A |
|
||||
| D7 | **Chrome for Lighthouse**: Playwright's Chromium (supports linux-arm64), installed in the job with a pinned Playwright version. Not the browser on the host: jobs run in containers and cannot see it. | CQ5 |
|
||||
| D8 | **Test target**: Raspberry Pi with nginx behind the reverse-proxy Pi, **next to the current WordPress site**. Deploy over SSH (`sshpass` + `scp`, same secrets as your other projects). Simple: empty the test folder, then copy the new build in; no old versions are kept. The step refuses an empty path, `/`, or a folder containing WordPress (`wp-config.php` / `wp-content`). The nginx block has its own `server_name` and never `default_server`. | CQ4 = B; owner: simpler than other apps, must not conflict with WordPress |
|
||||
| D9 | **Test is never indexed**: `X-Robots-Tag: noindex, nofollow` and a `robots.txt` that disallows everything. | Derived |
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# Monitoring Plan — frontend-shell
|
||||
|
||||
Decisions: [monitoring-setup-plan.md](../plans/monitoring-setup-plan.md) (Q1 = A, Q2 = D, Q3 = A, Q4 = A, Q5 = A, Q6 = A + production now, Q7 = A).
|
||||
|
||||
## Overview
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
Visitor["Visitor browser"] -->|"JS errors"| Sentry["Sentry (EU), existing org"]
|
||||
Visitor -->|"page views, cookieless"| Umami["Umami on the Pi, analytics.slpsoftware.nl"]
|
||||
Uptime["UptimeRobot"] -->|"HTTP checks"| Site["andreaslop.nl and test.andreaslop.nl"]
|
||||
Sentry -->|"e-mail, new error type"| Owner["Owner"]
|
||||
Uptime -->|"e-mail, site down"| Owner
|
||||
|
||||
classDef visitor fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||
classDef service fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000;
|
||||
classDef site fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef owner fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
|
||||
class Visitor visitor;
|
||||
class Sentry,Umami,Uptime service;
|
||||
class Site site;
|
||||
class Owner owner;
|
||||
```
|
||||
|
||||
Text alternative: visitors' browsers send JavaScript errors to Sentry and cookieless page views to Umami; UptimeRobot checks both sites from outside; Sentry and UptimeRobot e-mail the owner.
|
||||
|
||||
## Chosen Approach (all three, reusing existing services)
|
||||
|
||||
| Area | Service | What it covers | Code needed |
|
||||
|---|---|---|---|
|
||||
| **Logging** | **Sentry** (existing EU organisation, new project `andreaslop-fotografie`) | JavaScript errors in visitors' browsers: render errors caught by `ErrorPage` and unhandled errors, tagged `test` or `production` | Yes |
|
||||
| **Dashboards: visitors** | **Umami** (existing install on the Pi, two new "websites": test and production) | Page views, referrers, devices, without cookies or personal data | Yes |
|
||||
| **Dashboards: availability** | **UptimeRobot** (existing account, new monitors) | Whether test and production respond; response time history | No |
|
||||
| **Alerting** | Sentry + UptimeRobot defaults | E-mail on a **new** type of error (Sentry) and when a site is **down** (UptimeRobot) | No |
|
||||
|
||||
## Key Decisions
|
||||
|
||||
| # | Decision | Why |
|
||||
|---|---|---|
|
||||
| M1 | **One build for both environments**: the browser picks the environment from the hostname (`andreaslop.nl` → production, `test.andreaslop.nl` → test). Any other host (localhost, Lighthouse CI, previews) sends **nothing**. | Keeps "deploy exactly what was tested" (D-pipeline). Local runs and CI never pollute the dashboards. |
|
||||
| M2 | **Sentry and Umami settings live in code** (`src/monitoring/config.ts`), not in Gitea variables. | The Sentry DSN and Umami website IDs are public by design: they end up in every visitor's browser anyway. In code they are reviewed, tested and versioned. |
|
||||
| M3 | **Sentry sends directly** to `*.ingest.de.sentry.io` (no tunnel). | Q4 = A: the IIS host serves only static files until the .NET API exists; some errors from visitors with ad-blockers are missed. Follow-up: tunnel via the API. |
|
||||
| M4 | **Sentry loads after the page**, not in the main bundle. | Keeps the performance budget: the home page on mobile already sits just above its 0.8 target. Errors are queued until Sentry is ready. |
|
||||
| M5 | **Sentry: errors only.** No performance tracing, no session replay, no personal data (`sendDefaultPii: false`, IP storage off in the project settings). | Smallest bundle, least data, simplest privacy story. |
|
||||
| M6 | **Umami: separate websites for test and production**; `data-domains` restricts counting to the right hostname, and `data-do-not-track` respects the browser's Do Not Track setting. | Test traffic never mixes with real numbers. |
|
||||
| M7 | **CSP exceptions as narrow as possible**, generated into `web.config` and the nginx config like the other headers. <ul><li>`script-src`: `https://analytics.slpsoftware.nl` (the Umami script)</li><li>`connect-src`: `https://analytics.slpsoftware.nl` and `https://o4511795618185216.ingest.de.sentry.io`</li></ul> | Nothing else is opened. |
|
||||
| M8 | **UptimeRobot**: production monitor now (it watches the current WordPress site until the DNS switch, then the new site automatically), test now, and the `/portfolio` deep-link monitors. | Q6 = A, owner: production can start now. |
|
||||
|
||||
## Explicitly Out of Scope
|
||||
- Sentry tunnel against ad-blockers: comes with the .NET API (follow-up).
|
||||
- Server-side logging (nginx, IIS): not managed by this project. nginx logs on the Pi and the hoster's IIS logs stay where they are.
|
||||
- Performance tracing, session replay, custom Umami events.
|
||||
- Alerts other than e-mail.
|
||||
|
||||
## Privacy (action item for the privacy statement page)
|
||||
The privacy statement (still a placeholder) must mention:
|
||||
- **Umami**: anonymous, cookieless visit statistics, self-hosted in the Netherlands, no personal data.
|
||||
- **Sentry**: technical error reports, sent to Sentry (EU region) without IP address or personal data.
|
||||
|
||||
Umami without cookies needs no cookie banner under the Dutch DPA's guidance for analytics that are set up privacy-friendly. Sentry error reporting falls under legitimate interest. **This is not legal advice; check it when writing the privacy statement.**
|
||||
@@ -0,0 +1,80 @@
|
||||
# Monitoring Setup — frontend-shell
|
||||
|
||||
What to do once in each service, and what changes in the code. The code changes are made on PR #4 after approval of this setup. Until the values below are filled in, the site sends nothing (safe default).
|
||||
|
||||
## 1. Sentry (logging + error e-mails)
|
||||
|
||||
### In Sentry (once)
|
||||
1. In your existing organisation, create a project: platform **React**, name `andreaslop-fotografie`.
|
||||
2. Copy the **DSN** (Settings → Client Keys). It looks like `https://<key>@o4511795618185216.ingest.de.sentry.io/<project-id>`.
|
||||
3. **Settings → Security & Privacy**: turn on **"Prevent Storing of IP Addresses"** (M5).
|
||||
4. **Alerts**: keep the default rule "A new issue is created" → e-mail to you (Q7 = A). Environments `test` and `production` appear automatically after the first event.
|
||||
|
||||
### In the code (after approval)
|
||||
| File | Change |
|
||||
|---|---|
|
||||
| `package.json` | Add `@sentry/react` (same package as SlpSoftware) |
|
||||
| `src/monitoring/config.ts` (new) | `sentryDsn` (from step 2) and `monitoringFor(hostname)` → `{ environment, umamiWebsiteId }` or `null` for unknown hosts (M1) |
|
||||
| `src/monitoring/sentry.ts` (new) | `startSentry()`: loads `@sentry/react` dynamically after the `load` event (M4); `init` with `environment`, `release` (commit SHA from the build), all `dataCollection` categories off (SDK 11 replaced `sendDefaultPii` and collects everything by default), no tracing or replay. `reportError(error)`: queues errors, including unhandled ones, until Sentry is ready. |
|
||||
| `src/monitoring/sentryClient.ts` (new) | Re-exports only `init` and `captureException`, so the lazy chunk is tree-shaken (31 kB gzip instead of 150 kB). |
|
||||
| `src/main.tsx` | Calls `startSentry()` |
|
||||
| `src/components/StatusPage/ErrorPage.tsx` | Besides `console.error`, also `reportError(error)` (BR-ERR-03 extended) |
|
||||
| `config/securityHeaders.ts` | `connect-src` + Sentry ingest host (M7); regenerated into `web.config` and nginx |
|
||||
| Workflow `check` job | Build with `VITE_RELEASE=${{ github.sha }}` so Sentry shows which release an error came from |
|
||||
|
||||
### Check after deploy
|
||||
On `https://test.andreaslop.nl`, run in the browser console:
|
||||
```js
|
||||
setTimeout(() => { throw new Error('Sentry-test vanaf test') })
|
||||
```
|
||||
The error appears in Sentry under environment `test` within a minute, and you get an e-mail for the new issue.
|
||||
|
||||
## 2. Umami (visitor dashboard)
|
||||
|
||||
### In Umami (once)
|
||||
1. Log in at `https://analytics.slpsoftware.nl`.
|
||||
2. **Settings → Websites → Add website**, twice:
|
||||
- name `Andrea Slop Fotografie`, domain `andreaslop.nl`
|
||||
- name `Andrea Slop Fotografie (test)`, domain `test.andreaslop.nl`
|
||||
3. Copy both **Website IDs** (a UUID per website).
|
||||
|
||||
### In the code (after approval)
|
||||
| File | Change |
|
||||
|---|---|
|
||||
| `src/monitoring/config.ts` | The two website IDs, one per hostname (M6) |
|
||||
| `src/components/Analytics/UmamiAnalytics.tsx` (new) | Adds `https://analytics.slpsoftware.nl/script.js` with `data-website-id`, `data-domains=<hostname>` and `data-do-not-track="true"`, only for a known hostname (M1). Same pattern as SlpSoftware's `UmamiAnalytics`. |
|
||||
| `src/components/AppShell.tsx` | Renders `UmamiAnalytics` |
|
||||
| `config/securityHeaders.ts` | `script-src` and `connect-src` + `https://analytics.slpsoftware.nl` (M7) |
|
||||
|
||||
### Check after deploy
|
||||
Open `https://test.andreaslop.nl`. In Umami, the test website shows a visitor under "Realtime". If you have Do Not Track switched on in your browser, you won't see yourself; that is expected.
|
||||
|
||||
## 3. UptimeRobot (availability + down e-mails)
|
||||
|
||||
No code needed. Create these monitors in your existing account (type **HTTP(s)**, interval 5 minutes, alert contact: your e-mail):
|
||||
|
||||
| Monitor | URL | When |
|
||||
|---|---|---|
|
||||
| Andrea Slop — test | `https://test.andreaslop.nl/` | Now |
|
||||
| Andrea Slop — test — deep link | `https://test.andreaslop.nl/portfolio` | Now (checks the SPA fallback) |
|
||||
| Andrea Slop — productie | `https://andreaslop.nl/` | **Now**. It watches the current WordPress site until the DNS switch, and the new site after that. |
|
||||
| Andrea Slop — productie — deep link | `https://andreaslop.nl/portfolio` | **After go-live**. On WordPress this URL may not exist and would give false alarms. |
|
||||
|
||||
Optional: type **Keyword** with the keyword `Andrea Slop Fotografie`. That catches an empty or wrong page that still answers 200; the word is in the static HTML of the new site.
|
||||
|
||||
## 4. Tests (part of the code changes)
|
||||
- **`monitoringFor`**: example tests for each known hostname, plus a property test that every other hostname (random strings, `localhost`, IP addresses) returns `null` (PBT-03 invariant).
|
||||
- **`UmamiAnalytics`**: no script for an unknown host; the right `data-website-id` and `data-domains` for each known host; only one script element.
|
||||
- **`reportError`**: errors before initialisation are queued and sent once Sentry is ready; nothing is sent for an unknown host.
|
||||
- **`securityHeaders`**: the production CSP contains exactly these two external hosts, in the right directives only, and no wildcards.
|
||||
- **`serverConfig`**: drift test; `web.config` and nginx contain the new CSP.
|
||||
|
||||
## 5. Values (filled in 2026-10-19, in `src/monitoring/config.ts`)
|
||||
|
||||
| Value | Setting |
|
||||
|---|---|
|
||||
| Sentry DSN | `https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720` (project `andreaslop-fotografie`) |
|
||||
| Umami website ID, production | `3edbb7d1-4388-4f2d-9cef-11ade88ace96` |
|
||||
| Umami website ID, test | `7fb301ab-6ecc-4aea-beee-71bcb6009bfe` |
|
||||
|
||||
Sentry project created via the Sentry MCP. The default alert ("high priority issues") was changed to "a new issue is created" → e-mail, to match Q7 = A: handled errors from `reportError` often get a lower priority and would not have sent an e-mail.
|
||||
@@ -0,0 +1,95 @@
|
||||
# Monitoring Setup Plan — frontend-shell
|
||||
|
||||
## Context
|
||||
|
||||
- **What runs**: a static site (no back-end), deployed to test (Raspberry Pi, nginx) and later production (IIS webhost). See [deployment-plan.md](../deployment/deployment-plan.md).
|
||||
- **Current state**: no monitoring in this project. Errors only go to the browser console (`ErrorPage`, BR-ERR-03).
|
||||
- **Existing stack in your other projects** (SlpSoftware `react-frontend`, SlpModularCms):
|
||||
- **Sentry** (free tier): JavaScript errors
|
||||
- **Umami**, self-hosted on the Pi: visitor statistics without cookies
|
||||
- **UptimeRobot**: is the site reachable
|
||||
- **Already decided** (no question needed):
|
||||
- **One build for both environments stays.** Test vs production (for example for Sentry or Umami) is determined in the browser from the hostname, not with a separate build. The pipeline keeps deploying exactly the same build that was tested.
|
||||
- **External monitoring services need CSP exceptions.** The current CSP only allows the site's own origin. Each external service you choose is added to `config/securityHeaders.ts`, and from there to `web.config` and the nginx config, as narrowly as possible (only that host, only the directive that needs it).
|
||||
- **Privacy statement.** Whatever measures visitors must later be mentioned there. The page is still a placeholder, so this becomes an action item for that page.
|
||||
|
||||
## Plan
|
||||
|
||||
- [x] 1. Answer the questions below
|
||||
- [x] 2. Analyze answers (follow-up questions if needed)
|
||||
- [x] 3. Generate `operations/monitoring/monitoring-plan.md`
|
||||
- [x] 4. Generate `operations/monitoring/monitoring-setup.md` (and, if needed, code and config changes on this PR after your approval)
|
||||
- [ ] 5. Update CSP, server config, tests and privacy action items for the chosen services
|
||||
|
||||
---
|
||||
|
||||
## Questions
|
||||
|
||||
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies dan de laatste (Anders) en licht toe. Waar ik een voorkeur heb staat **(aanbevolen)**.
|
||||
|
||||
### Vraag 1: Monitoring opzetten voor deze feature?
|
||||
|
||||
A) Ja, help me monitoring op te zetten
|
||||
B) Nee, dit sluit aan op bestaande monitoring of valt nu buiten de scope
|
||||
C) Weet ik niet, stel een aanpak voor en ik beslis
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A
|
||||
|
||||
### Vraag 2: Welke vormen van monitoring?
|
||||
|
||||
A) Logging: JavaScript-fouten bij bezoekers vastleggen
|
||||
B) Meldingen: een bericht als de site plat ligt of er fouten optreden
|
||||
C) Dashboards: bezoekersstatistieken en een overzicht van de beschikbaarheid
|
||||
D) Een combinatie, namelijk alle drie, net als je andere projecten **(aanbevolen)**
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: D
|
||||
|
||||
### Vraag 3: Bestaande diensten hergebruiken?
|
||||
|
||||
A) Ja: hetzelfde Sentry-account (een nieuw project of een eigen omgeving), dezelfde Umami-installatie op de Pi (nieuwe "websites" voor test en productie) en hetzelfde UptimeRobot-account (nieuwe monitors) **(aanbevolen)** Eén plek om alles te bekijken, geen extra kosten.
|
||||
B) Aparte, nieuwe accounts of installaties voor deze site
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A
|
||||
|
||||
### Vraag 4: Hoe komen JavaScript-fouten bij Sentry?
|
||||
|
||||
De site is statisch. In SlpSoftware loopt Sentry via een eigen doorgeefluik ("tunnel") langs adblockers, maar daarvoor is een server-onderdeel nodig. Bij de webhoster draait alleen IIS met statische bestanden, tot de .NET API er is.
|
||||
|
||||
A) Nu rechtstreeks naar Sentry. De CSP krijgt alleen het ingest-adres van Sentry erbij (`connect-src`). Een deel van de fouten mist bij bezoekers met een adblocker. De tunnel komt later via de .NET API. **(aanbevolen)**
|
||||
B) Nog geen Sentry. Fouten alleen in de browserconsole, Sentry pas met de API.
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A
|
||||
|
||||
### Vraag 5: Bezoekersstatistieken met Umami
|
||||
|
||||
Umami gebruikt geen cookies en slaat geen persoonsgegevens op. Daarmee is volgens de Autoriteit Persoonsgegevens meestal geen cookiebanner nodig, mits het zo ingesteld is.
|
||||
|
||||
A) Ja, met de bestaande Umami op de Pi. Aparte "websites" voor test en productie, zodat testverkeer niet in de echte cijfers komt. De CSP krijgt het Umami-adres erbij (`script-src` en `connect-src`). **(aanbevolen)**
|
||||
B) Alleen voor productie, niet voor test
|
||||
C) Nog geen statistieken
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A
|
||||
|
||||
### Vraag 6: Beschikbaarheid bewaken met UptimeRobot
|
||||
|
||||
A) Monitors op test nu, en op productie zodra de DNS omgezet is. Ze controleren de homepage en een deep link (`/portfolio`, om de SPA-fallback te testen). **(aanbevolen)**
|
||||
B) Alleen productie, na de livegang
|
||||
C) Geen beschikbaarheidsbewaking
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A, maar gezien er nu ook al een site draait kan ik die nu ook al opzetten voor productie. Voor UptimeRobot hoeven we verder geen code toe te voegen toch?
|
||||
|
||||
### Vraag 7: Meldingen
|
||||
|
||||
A) E-mail van UptimeRobot als de site plat ligt, en e-mail van Sentry bij een nieuw soort fout (hun standaardmeldingen) **(aanbevolen)**
|
||||
B) Alleen bij een storing (UptimeRobot), niet bij fouten
|
||||
C) Geen meldingen, ik kijk zelf in de dashboards
|
||||
D) Een ander kanaal (bv. Telegram, ntfy, Teams); beschrijf welk na de [Answer]:-tag
|
||||
X) Anders (beschrijf hieronder na de [Answer]:-tag)
|
||||
|
||||
[Answer]: A
|
||||
@@ -0,0 +1,61 @@
|
||||
# Production Readiness — vragen
|
||||
|
||||
Al geregeld en daarom geen vraag:
|
||||
|
||||
- **Rollback**: [rollback-plan.md](../deployment/rollback-plan.md), een vorige versie opnieuw deployen via de pipeline. Op test is die route vandaag een paar keer gebruikt.
|
||||
- **Back-ups**: niet nodig voor deze feature. De site is statisch en alles staat in git; er is geen database of upload.
|
||||
- **Secrets**: de Pi- en FTP-gegevens staan als secrets in Gitea. De Sentry-DSN en de Umami-ID's zijn openbaar en staan bewust in de code (M2).
|
||||
- **Eigenaarschap van alerts**: jij krijgt alle mails (Sentry: nieuw issue; UptimeRobot: site down) en lost ze op (Q7 = A).
|
||||
|
||||
Vul na elke vraag je antwoord in achter `[Answer]:`.
|
||||
|
||||
## Vraag 1: Generale repetitie productie
|
||||
|
||||
De productie-deploy (FTPS naar IIS bij MijnHostingPartner) heeft nog nooit gedraaid. Test draait op nginx; `web.config`, de IIS-rewrite voor deep links en de FTPS-upload zijn dus alleen getest met de generator-tests. Zolang de DNS naar de huidige host wijst, raakt een deploy naar de nieuwe host geen bezoekers (D12).
|
||||
|
||||
- A) Nu een generale repetitie: een `release/0.1`-branch, de workflow met **Deploy to Production**, en daarna de site via een tijdelijke `hosts`-regel controleren (home, deep link, headers). Pas daarna is de feature klaar. **(aanbevolen)**
|
||||
- B) Pas bij de livegang, als onderdeel van de feature die de pagina's vult. In de checklist komt het als open punt.
|
||||
- C) Other (beschrijf hieronder)
|
||||
|
||||
[Answer]: B, want ik heb de hosting nog niet dus kan dat nog niet testen.
|
||||
|
||||
## Vraag 2: www.andreaslop.nl
|
||||
|
||||
De go-live-stappen zetten de DNS van `andreaslop.nl` **en `www`** naar de nieuwe host. De site meet alleen op `andreaslop.nl` en `test.andreaslop.nl` (M1). Een bezoeker op `www.andreaslop.nl` krijgt dus geen Sentry en geen Umami, en Google ziet twee adressen voor dezelfde pagina's.
|
||||
|
||||
- A) `web.config` stuurt `www.andreaslop.nl` permanent (301) door naar `https://andreaslop.nl`, via de generator met een test. Monitoring en SEO zien dan één adres. **(aanbevolen)**
|
||||
- B) `www.andreaslop.nl` toevoegen aan de monitoringconfig als productie, zonder doorverwijzing.
|
||||
- C) Geen `www`-record aanmaken; alleen `andreaslop.nl`.
|
||||
- D) Other (beschrijf hieronder)
|
||||
|
||||
[Answer]: A
|
||||
|
||||
## Vraag 3: Wat te doen bij een melding
|
||||
|
||||
Er komen twee soorten mails binnen: een nieuw issue in Sentry en "site down" van UptimeRobot. De deployment-instructies hebben een tabel met problemen in de pipeline, maar niet wat je doet als zo'n mail binnenkomt.
|
||||
|
||||
- A) Een korte runbook-pagina (`operations/runbook.md`): per soort melding wat je eerst controleert, hoe je terugzet en wie je belt (hoster, Pi). **(aanbevolen)**
|
||||
- B) Niet nodig: ik ben de enige beheerder en ken de opzet. De rollback- en deployment-documenten zijn genoeg.
|
||||
- C) Other (beschrijf hieronder)
|
||||
|
||||
[Answer]: B
|
||||
|
||||
## Vraag 4: SSH-wachtwoord voor de test-deploy
|
||||
|
||||
`deploy-test` logt op de Pi in met het wachtwoord van `gitea-workflow` (secret `PI_MAIN_PASSWORD`). Deployment-instructies 1.4 beschrijft de overstap naar een SSH-sleutel. De Pi bereikt zichzelf, dus het wachtwoord gaat niet over internet, maar het werkt wel voor elke SSH-login van die gebruiker.
|
||||
|
||||
- A) Nu overstappen op een sleutel, alleen voor `gitea-workflow`, en de wachtwoord-login voor die gebruiker uitzetten.
|
||||
- B) Als open punt laten staan; later, samen met je andere projecten die hetzelfde doen. **(aanbevolen: het is een wijziging aan alle pipelines op de Pi, niet alleen deze)**
|
||||
- C) Other (beschrijf hieronder)
|
||||
|
||||
[Answer]: B
|
||||
|
||||
## Vraag 5: Privacyverklaring vóór de livegang
|
||||
|
||||
Het monitoringplan legt vast dat de privacyverklaring Umami (anoniem, zonder cookies, eigen server in Nederland) en Sentry (foutmeldingen zonder IP of persoonsgegevens, EU-regio) moet noemen. De pagina is nu nog een placeholder.
|
||||
|
||||
- A) Als harde voorwaarde voor de livegang in de checklist: de DNS gaat pas om als de privacyverklaring dit noemt. **(aanbevolen)**
|
||||
- B) Als gewoon open punt, zonder dat het de livegang blokkeert.
|
||||
- C) Other (beschrijf hieronder)
|
||||
|
||||
[Answer]: A
|
||||
@@ -0,0 +1,41 @@
|
||||
# Production Readiness Checklist — frontend-shell
|
||||
|
||||
Answers: [production-readiness-questions.md](plans/production-readiness-questions.md) (Q1 = B, Q2 = A, Q3 = B, Q4 = B, Q5 = A).
|
||||
|
||||
## Deployment
|
||||
- **Status**: Configured
|
||||
- **Method**: CI/CD with Gitea Actions ([deployment-plan.md](deployment/deployment-plan.md)).
|
||||
- Test: automatic from `master` or by hand, SSH/scp to nginx on the Raspberry Pi. Verified many times on `test.andreaslop.nl`.
|
||||
- Production: by hand from `release/*`, FTPS to IIS at the hoster. **Never run yet**: the hosting package does not exist yet (Q1 = B).
|
||||
- Runners: the Pi (always on, does everything) plus an optional PC runner for `check` and `lighthouse`. A single runner deploys before Lighthouse. Verified on 2026-10-19 with both runners and with the Pi only.
|
||||
- **Rollback Plan**: Yes, [rollback-plan.md](deployment/rollback-plan.md): redeploy a previous version through the pipeline. Used on test; not yet on production.
|
||||
- **www**: `web.config` redirects `www.andreaslop.nl` with 301 to `https://andreaslop.nl` in one step (Q2 = A), covered by a generator test.
|
||||
|
||||
## Monitoring
|
||||
- **Status**: Configured ([monitoring-plan.md](monitoring/monitoring-plan.md), [monitoring-setup.md](monitoring/monitoring-setup.md))
|
||||
- **Approach**:
|
||||
- **Sentry** (EU, project `andreaslop-fotografie`): JavaScript errors only, without personal data. Verified on test: event under environment `test`, with the commit as release.
|
||||
- **Umami** (self-hosted): cookieless visits, a separate website per environment. Verified on test with a real visit.
|
||||
- **UptimeRobot**: availability of test and production. The monitors are the owner's one-time step and were not checked by the AI.
|
||||
- **Alerts**: by e-mail to the owner, for a new Sentry issue and for a site that is down.
|
||||
- Monitoring only runs on `andreaslop.nl` and `test.andreaslop.nl`; local and CI runs send nothing.
|
||||
|
||||
## Additional Readiness Items
|
||||
- **Backups**: Not needed. The site is static and everything is in git; this feature has no database or uploads. With the future .NET API and database, the rollback plan already describes backups before migrations.
|
||||
- **Secrets Management**: Covered.
|
||||
- Pi and FTP credentials are Gitea secrets.
|
||||
- The Sentry DSN and Umami website IDs are public by design and live in `src/monitoring/config.ts` (M2).
|
||||
- Open: `deploy-test` still logs in with an SSH password instead of a key (Q4 = B, later for all pipelines on the Pi together).
|
||||
- **Runbook/Support Handover**: Not needed (Q3 = B): one administrator who knows the setup. Guidance lives in [rollback-plan.md](deployment/rollback-plan.md) and the troubleshooting table in [deployment-instructions.md](deployment/deployment-instructions.md).
|
||||
- **Alert Ownership**: The owner receives every alert and owns the fix (Q7 = A).
|
||||
|
||||
## Overall Readiness
|
||||
- **Ready for Production**: Yes with caveats. The feature is complete and runs on test. Production is blocked until the go-live, which belongs to the feature that fills the pages: the hosting and the content do not exist yet (D12).
|
||||
- **Open Follow-ups**:
|
||||
1. **Dress rehearsal on the production host** (Q1 = B), once the hosting package exists: production deploy, then check home, deep link, 404, headers, HTTP→HTTPS and the www redirect (deployment-instructions, Go-live step 1).
|
||||
2. **Privacy statement mentions Umami and Sentry: blocks the DNS switch** (Q5 = A; Go-live step 2).
|
||||
3. **HTTPS certificate covers `www.andreaslop.nl`** at the switch, so the 301 works without a certificate error.
|
||||
4. **After go-live**: set `HEALTH_CHECK_URL_PRODUCTION`, add the UptimeRobot deep-link monitor for `/portfolio`, and check Sentry and Umami on production.
|
||||
5. **SSH key instead of a password** for `gitea-workflow`, together with the owner's other pipelines on the Pi (Q4 = B).
|
||||
6. **Sentry tunnel** against ad-blockers, together with the .NET API (M3).
|
||||
7. **Container actions on the Podman runners** do not work (409 on attach). The workflow uses none; keep that in mind for new workflows.
|
||||
@@ -1,6 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
|
||||
|
||||
const umami = 'https://analytics.slpsoftware.nl';
|
||||
const sentry = 'https://o4511795618185216.ingest.de.sentry.io';
|
||||
|
||||
const directive = (csp: string, name: string) =>
|
||||
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
|
||||
|
||||
@@ -8,19 +11,37 @@ describe('securityHeaders', () => {
|
||||
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
|
||||
const csp = contentSecurityPolicy('production');
|
||||
expect(csp).not.toContain('unsafe-eval');
|
||||
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
|
||||
expect(directive(csp, 'script-src')).toBe(`script-src 'self' ${umami}`);
|
||||
expect(csp).not.toContain('ws:');
|
||||
expect(directive(csp, 'frame-ancestors')).toBe(
|
||||
"frame-ancestors 'none'",
|
||||
);
|
||||
});
|
||||
|
||||
it('productie-CSP opent alleen Umami en Sentry, op de juiste plekken (M7)', () => {
|
||||
const csp = contentSecurityPolicy('production');
|
||||
const externalHosts = new Set(csp.match(/https:\/\/[^\s;]+/g));
|
||||
expect([...externalHosts].sort()).toEqual([sentry, umami].sort());
|
||||
expect(directive(csp, 'connect-src')).toBe(
|
||||
`connect-src 'self' ${umami} ${sentry}`,
|
||||
);
|
||||
// Alleen script-src en connect-src noemen een externe host
|
||||
for (const d of csp.split('; ')) {
|
||||
if (!/^(script|connect)-src /.test(d)) {
|
||||
expect(d).not.toContain('https://');
|
||||
}
|
||||
}
|
||||
expect(csp).not.toContain('*');
|
||||
});
|
||||
|
||||
it('dev-CSP voegt alleen toe wat Vite nodig heeft', () => {
|
||||
const csp = contentSecurityPolicy('development');
|
||||
expect(directive(csp, 'script-src')).toBe(
|
||||
"script-src 'self' 'unsafe-inline'",
|
||||
`script-src 'self' ${umami} 'unsafe-inline'`,
|
||||
);
|
||||
expect(directive(csp, 'connect-src')).toBe(
|
||||
`connect-src 'self' ${umami} ${sentry} ws:`,
|
||||
);
|
||||
expect(directive(csp, 'connect-src')).toBe("connect-src 'self' ws:");
|
||||
expect(csp).not.toContain('unsafe-eval');
|
||||
});
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
// 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 { sentryIngestOrigin, umamiOrigin } from '../src/monitoring/config.ts';
|
||||
|
||||
type Mode = 'production' | 'development';
|
||||
|
||||
// Chakra/Emotion zetten tijdens runtime <style>-tags in de pagina, daarom
|
||||
// staat style-src 'unsafe-inline' toe. Scripts komen alleen van de eigen site.
|
||||
// staat style-src 'unsafe-inline' toe. Scripts komen van de eigen site en het
|
||||
// Umami-script; verbindingen alleen naar Umami en Sentry (monitoring-plan M7).
|
||||
const productionCsp: Record<string, string[]> = {
|
||||
'default-src': ["'self'"],
|
||||
'script-src': ["'self'"],
|
||||
'script-src': ["'self'", umamiOrigin],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'img-src': ["'self'", 'data:'],
|
||||
'font-src': ["'self'"],
|
||||
'connect-src': ["'self'"],
|
||||
'connect-src': ["'self'", umamiOrigin, sentryIngestOrigin],
|
||||
'object-src': ["'none'"],
|
||||
'base-uri': ["'self'"],
|
||||
'form-action': ["'self'"],
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { monitoringFor } from '../src/monitoring/config';
|
||||
import { securityHeaders } from './securityHeaders';
|
||||
import {
|
||||
iisWebConfig,
|
||||
nginxProxyConf,
|
||||
nginxTestConf,
|
||||
productionHost,
|
||||
serverConfigFiles,
|
||||
} from './serverConfig';
|
||||
|
||||
@@ -29,6 +31,24 @@ describe('serverconfiguratie', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('IIS stuurt www in één stap door naar https://andreaslop.nl', () => {
|
||||
const iis = iisWebConfig();
|
||||
expect(iis).toContain(
|
||||
'<add input="{HTTP_HOST}" pattern="^www\\.andreaslop\\.nl$" />',
|
||||
);
|
||||
expect(iis).toContain(
|
||||
'<action type="Redirect" url="https://andreaslop.nl/{R:1}" redirectType="Permanent" />',
|
||||
);
|
||||
// Vóór de HTTPS-regel, anders eerst http://www → https://www
|
||||
expect(iis.indexOf('name="www naar')).toBeLessThan(
|
||||
iis.indexOf('name="HTTPS"'),
|
||||
);
|
||||
});
|
||||
|
||||
it('www-doorverwijzing verwijst naar de productiehost uit de monitoring', () => {
|
||||
expect(monitoringFor(productionHost)?.environment).toBe('production');
|
||||
});
|
||||
|
||||
it('IIS heeft een SPA-fallback en een HTTPS-redirect', () => {
|
||||
const iis = iisWebConfig();
|
||||
expect(iis).toContain('<action type="Rewrite" url="/index.html" />');
|
||||
|
||||
@@ -15,7 +15,13 @@ const xmlAttribute = (value: string) =>
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
|
||||
// IIS (productie): security headers, HTTPS-redirect, SPA-fallback en caching.
|
||||
// De enige productiehost: www stuurt hierheen door, zodat monitoring (alleen
|
||||
// op deze hostname) en zoekmachines één adres zien
|
||||
export const productionHost = 'andreaslop.nl';
|
||||
|
||||
// IIS (productie): www-doorverwijzing, security headers, HTTPS-redirect,
|
||||
// SPA-fallback en caching. De www-regel staat vóór HTTPS, zodat
|
||||
// http://www. in één stap op https://andreaslop.nl uitkomt.
|
||||
// Bestanden in /assets hebben een hash in de naam en mogen lang gecachet
|
||||
// worden; index.html nooit, zodat een nieuwe release direct zichtbaar is.
|
||||
export function iisWebConfig(): string {
|
||||
@@ -32,6 +38,13 @@ export function iisWebConfig(): string {
|
||||
<system.webServer>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="www naar ${productionHost}" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
<add input="{HTTP_HOST}" pattern="^www\\.${productionHost.replace(/\./g, '\\.')}$" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://${productionHost}/{R:1}" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="HTTPS" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
<system.webServer>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="www naar andreaslop.nl" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
<add input="{HTTP_HOST}" pattern="^www\.andreaslop\.nl$" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://andreaslop.nl/{R:1}" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="HTTPS" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
@@ -24,7 +31,7 @@
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="X-Powered-By" />
|
||||
<add name="Content-Security-Policy" value="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" />
|
||||
<add name="Content-Security-Policy" value="default-src 'self'; script-src 'self' https://analytics.slpsoftware.nl; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https://analytics.slpsoftware.nl https://o4511795618185216.ingest.de.sentry.io; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" />
|
||||
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />
|
||||
<add name="X-Content-Type-Options" value="nosniff" />
|
||||
<add name="X-Frame-Options" value="DENY" />
|
||||
|
||||
@@ -15,7 +15,7 @@ server {
|
||||
# nginx naar zijn eigen http://-adres in plaats van de https-hostname
|
||||
absolute_redirect off;
|
||||
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://analytics.slpsoftware.nl; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https://analytics.slpsoftware.nl https://o4511795618185216.ingest.de.sentry.io; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
@@ -25,7 +25,7 @@ server {
|
||||
|
||||
# Testsite nooit indexeren
|
||||
location = /robots.txt {
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://analytics.slpsoftware.nl; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https://analytics.slpsoftware.nl https://o4511795618185216.ingest.de.sentry.io; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
@@ -37,7 +37,7 @@ server {
|
||||
|
||||
# Bestanden met een hash in de naam: lang cachen
|
||||
location /assets/ {
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://analytics.slpsoftware.nl; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https://analytics.slpsoftware.nl https://o4511795618185216.ingest.de.sentry.io; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
@@ -51,7 +51,7 @@ server {
|
||||
# =404 aan het eind: zonder index.html (lege map) een 404 in plaats van een
|
||||
# doorverwijzingslus die nginx als 500 afbreekt
|
||||
location / {
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://analytics.slpsoftware.nl; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https://analytics.slpsoftware.nl https://o4511795618185216.ingest.de.sentry.io; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@fontsource/jost": "^5.3.0",
|
||||
"@fontsource/marcellus": "^5.3.0",
|
||||
"@sentry/react": "^11.8.0",
|
||||
"@tanstack/react-router": "^1.170.39",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0"
|
||||
|
||||
Generated
+88
@@ -181,6 +181,9 @@ importers:
|
||||
'@fontsource/marcellus':
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
'@sentry/react':
|
||||
specifier: ^11.8.0
|
||||
version: 11.8.0(react@19.3.0)
|
||||
'@tanstack/react-router':
|
||||
specifier: ^1.170.39
|
||||
version: 1.170.39(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
|
||||
@@ -942,10 +945,30 @@ packages:
|
||||
resolution: {integrity: sha512-Fz5+4XCg3akeoFK+K7g+d7HqGMjmnLoY2eJlpONJmaeT9pXY7yfUyXKZMmMajdE2LxxKJgQ2YKvSCaGVamTjHw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
'@sentry/browser-utils@11.8.0':
|
||||
resolution: {integrity: sha512-tTqJmnfuJaQy9LyInCWJtJ0L+VnOq+L9+lTMkQH+pptXBAuHfdJyEl2IhGqO4QmsfKyZpHa2GVd3HKpEQsVYeg==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/browser@11.8.0':
|
||||
resolution: {integrity: sha512-uBC1k2ESZErHv+RfG6p9siHrtxv+QErDxL/jvEBZnoMV6OcWdZyWTGKcqrW7EjwlBiWkgVve1W7z8tNDDuVQxw==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/conventions@0.27.0':
|
||||
resolution: {integrity: sha512-Mrqd/o7n/z7qWSYfQQA7x4fFTA0IqOG6JNsbBpnC97khPwZk7n6DPtOO7YgaYplSl8R8QLRbBz9Xv2lVhToSAg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@sentry/core@11.8.0':
|
||||
resolution: {integrity: sha512-4MVTthk6C/1oQFjbVIfygHyNkx2YGbwNLml0kJji0vjJXy6ZNls9zdIp0FTBTi4e3189IcSc5OXD4qcJdmEeKA==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/core@7.120.4':
|
||||
resolution: {integrity: sha512-TXu3Q5kKiq8db9OXGkWyXUbIxMMuttB5vJ031yolOl5T/B69JRyAoKuojLBjRv1XX583gS1rSSoX8YXX7ATFGA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
'@sentry/feedback@11.8.0':
|
||||
resolution: {integrity: sha512-t8MSpbPoOcPOkywcv0Hwh97A82jWFZju5NU/a6pHmn2pKFktgCgnHKNHvlYp8QUaDNYijYpLv58NIM5Dg7by7A==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/integrations@7.120.4':
|
||||
resolution: {integrity: sha512-kkBTLk053XlhDCg7OkBQTIMF4puqFibeRO3E3YiVc4PGLnocXMaVpOSCkMqAc1k1kZ09UgGi8DxfQhnFEjUkpA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -954,6 +977,24 @@ packages:
|
||||
resolution: {integrity: sha512-qq3wZAXXj2SRWhqErnGCSJKUhPSlZ+RGnCZjhfjHpP49KNpcd9YdPTIUsFMgeyjdh6Ew6aVCv23g1hTP0CHpYw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
'@sentry/react@11.8.0':
|
||||
resolution: {integrity: sha512-8+RCBT4kZ954QpkKvHsQpBkFI3Tg0KShZLFRV4WVzocaRJL+iQA9Y2FV1bxQ12meC9BawaTbI8eX/uUIFDjwMA==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
peerDependencies:
|
||||
react: 17.x || 18.x || 19.x
|
||||
react-router: 6.x || 7.x || 8.x
|
||||
peerDependenciesMeta:
|
||||
react-router:
|
||||
optional: true
|
||||
|
||||
'@sentry/replay-canvas@11.8.0':
|
||||
resolution: {integrity: sha512-/MiivHLdDv3ot5uJmWcPhIOubec54hPd4U/c2OE5oNyhM3zrd/S6b2FEfwke/V120QGEdZcuzGatwNJ2jNSkgQ==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/replay@11.8.0':
|
||||
resolution: {integrity: sha512-0jXMLd9XCBEZ5tu0VJa1uj1HYCpsjuNjbEBhF5pUw4FHyIH5hz01WuI20SH2Ct0pP1mykTzJLPGjZ8sUiAmMnQ==}
|
||||
engines: {node: '>=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0'}
|
||||
|
||||
'@sentry/types@7.120.4':
|
||||
resolution: {integrity: sha512-cUq2hSSe6/qrU6oZsEP4InMI5VVdD86aypE+ENrQ6eZEVLTCYm1w6XhW1NvIu3UuWh7gZec4a9J7AFpYxki88Q==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -3815,6 +3856,9 @@ packages:
|
||||
resolution: {integrity: sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==}
|
||||
engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}
|
||||
|
||||
web-vitals@6.2.3:
|
||||
resolution: {integrity: sha512-Dmy+vdO1UPMqXiAtZSNayhl4f794Bxfd94W4HIj2HlYtczEQfEOon969memlcpcHrTuOKLa5baFjX7WbgmOq+A==}
|
||||
|
||||
webdriver-bidi-protocol@0.4.1:
|
||||
resolution: {integrity: sha512-ARrjNjtWRRs2w4Tk7nqrf2gBI0QXWuOmMCx2hU+1jUt6d00MjMxURrhxhGbrsoiZKJrhTSTzbIrc554iKI10qw==}
|
||||
|
||||
@@ -4740,11 +4784,36 @@ snapshots:
|
||||
'@sentry/types': 7.120.4
|
||||
'@sentry/utils': 7.120.4
|
||||
|
||||
'@sentry/browser-utils@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/conventions': 0.27.0
|
||||
'@sentry/core': 11.8.0
|
||||
web-vitals: 6.2.3
|
||||
|
||||
'@sentry/browser@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/browser-utils': 11.8.0
|
||||
'@sentry/conventions': 0.27.0
|
||||
'@sentry/core': 11.8.0
|
||||
'@sentry/feedback': 11.8.0
|
||||
'@sentry/replay': 11.8.0
|
||||
'@sentry/replay-canvas': 11.8.0
|
||||
|
||||
'@sentry/conventions@0.27.0': {}
|
||||
|
||||
'@sentry/core@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/conventions': 0.27.0
|
||||
|
||||
'@sentry/core@7.120.4':
|
||||
dependencies:
|
||||
'@sentry/types': 7.120.4
|
||||
'@sentry/utils': 7.120.4
|
||||
|
||||
'@sentry/feedback@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/core': 11.8.0
|
||||
|
||||
'@sentry/integrations@7.120.4':
|
||||
dependencies:
|
||||
'@sentry/core': 7.120.4
|
||||
@@ -4760,6 +4829,23 @@ snapshots:
|
||||
'@sentry/types': 7.120.4
|
||||
'@sentry/utils': 7.120.4
|
||||
|
||||
'@sentry/react@11.8.0(react@19.3.0)':
|
||||
dependencies:
|
||||
'@sentry/browser': 11.8.0
|
||||
'@sentry/conventions': 0.27.0
|
||||
'@sentry/core': 11.8.0
|
||||
react: 19.3.0
|
||||
|
||||
'@sentry/replay-canvas@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/core': 11.8.0
|
||||
'@sentry/replay': 11.8.0
|
||||
|
||||
'@sentry/replay@11.8.0':
|
||||
dependencies:
|
||||
'@sentry/browser-utils': 11.8.0
|
||||
'@sentry/core': 11.8.0
|
||||
|
||||
'@sentry/types@7.120.4': {}
|
||||
|
||||
'@sentry/utils@7.120.4':
|
||||
@@ -8153,6 +8239,8 @@ snapshots:
|
||||
dependencies:
|
||||
xml-name-validator: 5.0.0
|
||||
|
||||
web-vitals@6.2.3: {}
|
||||
|
||||
webdriver-bidi-protocol@0.4.1: {}
|
||||
|
||||
webidl-conversions@3.0.1: {}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import UmamiAnalytics from './UmamiAnalytics';
|
||||
|
||||
const umamiScripts = () =>
|
||||
document.querySelectorAll<HTMLScriptElement>(
|
||||
'script[src="https://analytics.slpsoftware.nl/script.js"]',
|
||||
);
|
||||
|
||||
afterEach(() => {
|
||||
umamiScripts().forEach((script) => script.remove());
|
||||
});
|
||||
|
||||
describe('UmamiAnalytics', () => {
|
||||
it('voegt geen script toe op een onbekende host', () => {
|
||||
render(<UmamiAnalytics hostname="localhost" />);
|
||||
expect(umamiScripts()).toHaveLength(0);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['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 het script maar één keer toe', () => {
|
||||
render(<UmamiAnalytics hostname="andreaslop.nl" />);
|
||||
render(<UmamiAnalytics hostname="andreaslop.nl" />);
|
||||
expect(umamiScripts()).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('rendert niets zichtbaars', () => {
|
||||
const { container } = render(
|
||||
<UmamiAnalytics hostname="andreaslop.nl" />,
|
||||
);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import { useEffect } from 'react';
|
||||
import { monitoringFor, umamiOrigin } from '@/monitoring/config';
|
||||
|
||||
const SCRIPT_ELEMENT_ID = 'umami-analytics-script';
|
||||
|
||||
// Bezoekersstatistieken zonder cookies (M6). Alleen op een bekende host, met
|
||||
// de website van die omgeving; data-domains telt nergens anders mee en
|
||||
// data-do-not-track respecteert de Do Not Track-instelling van de browser.
|
||||
export default function UmamiAnalytics({
|
||||
hostname = window.location.hostname,
|
||||
}: {
|
||||
hostname?: string;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
const monitoring = monitoringFor(hostname);
|
||||
if (!monitoring || document.getElementById(SCRIPT_ELEMENT_ID)) return;
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.id = SCRIPT_ELEMENT_ID;
|
||||
script.src = `${umamiOrigin}/script.js`;
|
||||
script.defer = true;
|
||||
script.dataset.websiteId = monitoring.umamiWebsiteId;
|
||||
script.dataset.domains = hostname;
|
||||
script.dataset.doNotTrack = 'true';
|
||||
document.head.appendChild(script);
|
||||
|
||||
return () => script.remove();
|
||||
}, [hostname]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { SkipNavContent, SkipNavLink } from '@chakra-ui/react';
|
||||
import { Outlet } from '@tanstack/react-router';
|
||||
import siteContent from '@/content/siteContent';
|
||||
import useRouteFocus from '@/hooks/useRouteFocus';
|
||||
import UmamiAnalytics from './Analytics/UmamiAnalytics';
|
||||
import BackToTop from './BackToTop/BackToTop';
|
||||
import Footer from './Footer/Footer';
|
||||
import NavigationBar from './NavigationBar/NavigationBar';
|
||||
@@ -22,6 +23,7 @@ export default function AppShell() {
|
||||
</SkipNavContent>
|
||||
<Footer content={siteContent} />
|
||||
<BackToTop />
|
||||
<UmamiAnalytics />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import { useEffect } from 'react';
|
||||
import { chakra, useRecipe } from '@chakra-ui/react';
|
||||
import { useRouter, type ErrorComponentProps } from '@tanstack/react-router';
|
||||
import { reportError } from '@/monitoring/sentry';
|
||||
import LinkButton from '../LinkButton';
|
||||
import StatusPage from './StatusPage';
|
||||
|
||||
// Algemene foutpagina (FR-10). Toont nooit de foutmelding zelf; die gaat
|
||||
// alleen naar de console (BR-ERR-02/03).
|
||||
// alleen naar de console en Sentry (BR-ERR-02/03).
|
||||
export default function ErrorPage({ error, reset }: ErrorComponentProps) {
|
||||
const router = useRouter();
|
||||
const buttonRecipe = useRecipe({ key: 'linkButton' });
|
||||
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
reportError(error);
|
||||
}, [error]);
|
||||
|
||||
// Foutgrens resetten en de route opnieuw laden (BR-ERR-04)
|
||||
|
||||
@@ -5,12 +5,16 @@ import { routeTree } from './routeTree.gen';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import system from './theme.ts';
|
||||
import ErrorPage from './components/StatusPage/ErrorPage';
|
||||
import { startSentry } from './monitoring/sentry';
|
||||
|
||||
import '@fontsource/jost/300.css';
|
||||
import '@fontsource/jost/400.css';
|
||||
import '@fontsource/jost/500.css';
|
||||
import '@fontsource/marcellus/400.css';
|
||||
|
||||
// Foutmeldingen naar Sentry, alleen op test en productie (M1)
|
||||
startSentry();
|
||||
|
||||
// Create a new router instance
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
monitoredHostnames,
|
||||
monitoringFor,
|
||||
sentryIngestOrigin,
|
||||
} from './config';
|
||||
|
||||
// Alles wat geen test- of productiehost is
|
||||
const otherHostname = fc
|
||||
.oneof(
|
||||
fc.domain(),
|
||||
fc.ipV4(),
|
||||
fc.ipV6(),
|
||||
fc.string(),
|
||||
fc.constantFrom(
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
'www.andreaslop.nl',
|
||||
'andreaslop.nl.',
|
||||
'test.andreaslop.nl.evil.com',
|
||||
'__proto__',
|
||||
'constructor',
|
||||
),
|
||||
)
|
||||
.filter((host) => !monitoredHostnames.includes(host));
|
||||
|
||||
describe('monitoringFor', () => {
|
||||
it('productiehost meet als production met de productiewebsite', () => {
|
||||
expect(monitoringFor('andreaslop.nl')).toEqual({
|
||||
environment: 'production',
|
||||
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
|
||||
});
|
||||
});
|
||||
|
||||
it('testhost meet als test met de testwebsite', () => {
|
||||
expect(monitoringFor('test.andreaslop.nl')).toEqual({
|
||||
environment: 'test',
|
||||
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe',
|
||||
});
|
||||
});
|
||||
|
||||
it('elke andere host meet niets (M1)', () => {
|
||||
fc.assert(
|
||||
fc.property(otherHostname, (host) => {
|
||||
expect(monitoringFor(host)).toBeNull();
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('Sentry-ingest is de EU-host uit de DSN, zonder sleutel', () => {
|
||||
expect(sentryIngestOrigin).toBe(
|
||||
'https://o4511795618185216.ingest.de.sentry.io',
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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 Monitoring {
|
||||
environment: MonitoringEnvironment;
|
||||
umamiWebsiteId: string;
|
||||
}
|
||||
|
||||
export const sentryDsn =
|
||||
'https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720';
|
||||
|
||||
// Waar de browser fouten naartoe stuurt; nodig voor connect-src in de CSP
|
||||
export const sentryIngestOrigin = new URL(sentryDsn).origin;
|
||||
|
||||
export const umamiOrigin = 'https://analytics.slpsoftware.nl';
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
export const monitoredHostnames = [...monitoringByHostname.keys()];
|
||||
@@ -0,0 +1,99 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const init = vi.fn();
|
||||
const captureException = vi.fn();
|
||||
vi.mock('@sentry/react', () => ({ init, captureException }));
|
||||
|
||||
// De module houdt zijn toestand bij; elke test begint met een verse kopie
|
||||
async function freshSentry() {
|
||||
vi.resetModules();
|
||||
return import('./sentry');
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
init.mockReset();
|
||||
captureException.mockReset();
|
||||
});
|
||||
|
||||
describe('Sentry', () => {
|
||||
it('start niet en stuurt niets op een onbekende host', async () => {
|
||||
const { startSentry, reportError } = await freshSentry();
|
||||
startSentry('localhost');
|
||||
reportError(new Error('lokaal'));
|
||||
|
||||
await Promise.resolve();
|
||||
expect(init).not.toHaveBeenCalled();
|
||||
expect(captureException).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('start op test met omgeving test en zonder persoonsgegevens', async () => {
|
||||
const { startSentry } = await freshSentry();
|
||||
startSentry('test.andreaslop.nl');
|
||||
|
||||
await vi.waitFor(() => expect(init).toHaveBeenCalledOnce());
|
||||
expect(init.mock.calls[0][0]).toMatchObject({
|
||||
environment: 'test',
|
||||
dataCollection: {
|
||||
userInfo: false,
|
||||
cookies: false,
|
||||
httpHeaders: false,
|
||||
httpBodies: [],
|
||||
urlQueryParams: false,
|
||||
},
|
||||
});
|
||||
expect(init.mock.calls[0][0]).not.toHaveProperty('tracesSampleRate');
|
||||
});
|
||||
|
||||
it('fouten van voor de start gaan mee zodra Sentry klaar is', async () => {
|
||||
const { startSentry, reportError } = await freshSentry();
|
||||
startSentry('andreaslop.nl');
|
||||
const early = new Error('vroeg');
|
||||
reportError(early);
|
||||
expect(captureException).not.toHaveBeenCalled();
|
||||
|
||||
await vi.waitFor(() =>
|
||||
expect(captureException).toHaveBeenCalledWith(early),
|
||||
);
|
||||
const later = new Error('later');
|
||||
reportError(later);
|
||||
expect(captureException).toHaveBeenLastCalledWith(later);
|
||||
expect(init.mock.calls[0][0]).toMatchObject({
|
||||
environment: 'production',
|
||||
});
|
||||
});
|
||||
|
||||
it('vangt onafgevangen fouten tijdens het laden op', async () => {
|
||||
const { startSentry } = await freshSentry();
|
||||
startSentry('andreaslop.nl');
|
||||
const error = new Error('onafgevangen');
|
||||
window.dispatchEvent(new ErrorEvent('error', { error }));
|
||||
|
||||
await vi.waitFor(() =>
|
||||
expect(captureException).toHaveBeenCalledWith(error),
|
||||
);
|
||||
});
|
||||
|
||||
it('wacht op het load-event als de pagina nog laadt', async () => {
|
||||
const readyState = vi
|
||||
.spyOn(document, 'readyState', 'get')
|
||||
.mockReturnValue('loading');
|
||||
const { startSentry } = await freshSentry();
|
||||
startSentry('andreaslop.nl');
|
||||
|
||||
await Promise.resolve();
|
||||
expect(init).not.toHaveBeenCalled();
|
||||
|
||||
readyState.mockReturnValue('complete');
|
||||
window.dispatchEvent(new Event('load'));
|
||||
await vi.waitFor(() => expect(init).toHaveBeenCalledOnce());
|
||||
});
|
||||
|
||||
it('start maar één keer', async () => {
|
||||
const { startSentry } = await freshSentry();
|
||||
startSentry('andreaslop.nl');
|
||||
startSentry('andreaslop.nl');
|
||||
|
||||
await vi.waitFor(() => expect(init).toHaveBeenCalled());
|
||||
expect(init).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
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.
|
||||
|
||||
type State =
|
||||
| { kind: 'off' }
|
||||
| { kind: 'loading'; queue: unknown[] }
|
||||
| { kind: 'ready'; capture: (error: unknown) => void };
|
||||
|
||||
let state: State = { kind: 'off' };
|
||||
|
||||
export function reportError(error: unknown): void {
|
||||
if (state.kind === 'ready') state.capture(error);
|
||||
else if (state.kind === 'loading') state.queue.push(error);
|
||||
}
|
||||
|
||||
// Onafgevangen fouten tijdens het laden; daarna vangt Sentry ze zelf
|
||||
const onError = (event: ErrorEvent) => reportError(event.error);
|
||||
const onRejection = (event: PromiseRejectionEvent) => reportError(event.reason);
|
||||
|
||||
export function startSentry(hostname = window.location.hostname): void {
|
||||
const monitoring = monitoringFor(hostname);
|
||||
if (!monitoring || state.kind !== 'off') return;
|
||||
|
||||
const queue: unknown[] = [];
|
||||
state = { kind: 'loading', queue };
|
||||
window.addEventListener('error', onError);
|
||||
window.addEventListener('unhandledrejection', onRejection);
|
||||
|
||||
const load = async () => {
|
||||
const Sentry = await import('./sentryClient');
|
||||
// Alleen fouten: geen tracing, geen replay, geen persoonsgegevens (M5).
|
||||
// Sinds SDK 11 verzamelt Sentry standaard alles; daarom alles expliciet uit.
|
||||
Sentry.init({
|
||||
dsn: sentryDsn,
|
||||
environment: monitoring.environment,
|
||||
release: import.meta.env.VITE_RELEASE,
|
||||
dataCollection: {
|
||||
userInfo: false,
|
||||
cookies: false,
|
||||
httpHeaders: false,
|
||||
httpBodies: [],
|
||||
urlQueryParams: false,
|
||||
},
|
||||
});
|
||||
window.removeEventListener('error', onError);
|
||||
window.removeEventListener('unhandledrejection', onRejection);
|
||||
state = { kind: 'ready', capture: Sentry.captureException };
|
||||
queue.forEach(reportError);
|
||||
};
|
||||
|
||||
if (document.readyState === 'complete') void load();
|
||||
else window.addEventListener('load', () => void load(), { once: true });
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// Alleen wat sentry.ts gebruikt. Een dynamische import van '@sentry/react'
|
||||
// zelf haalt de hele SDK binnen; via losse named exports kan Vite de rest
|
||||
// weglaten (tree-shaking).
|
||||
export { captureException, init } from '@sentry/react';
|
||||
Reference in New Issue
Block a user