From 64756967094a859691d96568963c21984ceeb547 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Wed, 18 Nov 2026 19:20:19 +0100 Subject: [PATCH] Pipeline: new names for repo variables and secrets; no OFFERINGS_URL; the post-deploy check always runs as CMS host TEST_DEPLOY_PATH, TEST_HEALTH_URL, PROD_HEALTH_URL, PROD_DEPLOY_PATH and PROD_HOST_* replace the old names (decision of Bryan, 2026-11-18). The test build no longer fetches packages (the host injects them) and ASF_TEST_SERVED_BY_CMS is gone: test is always served by the CMS host. PI_MAIN_* stay until the TEST_HOST_* secrets and the SSH key exist. Co-Authored-By: Claude Sonnet 5.5 --- .gitea/workflows/continuous_integration.yaml | 49 +++++++++----------- docs/cms-integration.md | 15 +++--- docs/deploy-and-ci.md | 21 +++++++-- docs/go-live-checklist.md | 2 +- 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/continuous_integration.yaml b/.gitea/workflows/continuous_integration.yaml index 57b6155..74c6cc0 100644 --- a/.gitea/workflows/continuous_integration.yaml +++ b/.gitea/workflows/continuous_integration.yaml @@ -84,9 +84,9 @@ jobs: run: pnpm test # Sentry toont bij elke fout uit welke commit de build komt - # Dit artefact (dist) is ook wat naar productie gaat: bewust zonder - # OFFERINGS_URL, dus met de gecommitte pakketlijst. De testbuild met de - # pakketten uit het CMS is job build-test. + # Dit artefact (dist) is ook wat naar productie gaat: met de gecommitte + # pakketlijst (snapshot), zonder testadres en met dicht formulier. De + # CMS-host schrijft de actuele gegevens bij elk verzoek in de HTML. - name: Build run: pnpm build env: @@ -105,10 +105,10 @@ jobs: path: web/dist/client/ retention-days: 7 - # De build voor de testsite: zelfde code als dist, maar met de pakketten uit - # het CMS van de testomgeving (OFFERINGS_URL uit de repo-variabele - # ASF_OFFERINGS_URL_TEST). Productie krijgt dit artefact nooit: die blijft op - # dist met de gecommitte lijst tot er een productie-CMS is. + # De build voor de testsite: zelfde code als dist, maar met het eigen adres + # van de testsite en het formulier open. De pakketten komen niet meer uit + # het CMS bij de build: de CMS-host injecteert ze bij elk verzoek. + # Productie krijgt dit artefact nooit. build-test: needs: check if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') @@ -137,11 +137,10 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build (testomgeving, pakketten uit het CMS) + - name: Build (testomgeving) run: pnpm build env: VITE_RELEASE: ${{ github.sha }} - OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL_TEST }} # De testsite staat op zichzelf: canonical, og:url, og:image, # JSON-LD en sitemap wijzen naar het eigen adres, zodat een gedeelde # link (WhatsApp, Discord) ook zijn eigen plaatje toont. Alleen in @@ -197,10 +196,10 @@ jobs: SSH_PORT: ${{ secrets.PI_MAIN_PORT }} SSH_USER: ${{ secrets.PI_MAIN_USERNAME }} SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }} - DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }} + DEPLOY_PATH: ${{ vars.TEST_DEPLOY_PATH }} run: | case "$DEPLOY_PATH" in - ''|'/'|*' '*) echo "DEPLOY_PATH_TEST ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;; + ''|'/'|*' '*) echo "TEST_DEPLOY_PATH 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" @@ -223,18 +222,12 @@ jobs: # dus staan voor de deploy (zie pi-install-instructions.md). - name: Controle na deploy env: - HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }} - # 'true' zodra test.andreaslop.nl door de CMS-host (Api.AndreaSlopFotografie) - # wordt bediend in plaats van nginx: dan controleert het script ook de - # exacte CSP en de CMS-routes. Zet hem om samen met de proxy-route. - SERVED_BY_CMS: ${{ vars.ASF_TEST_SERVED_BY_CMS }} + HEALTH_URL: ${{ vars.TEST_HEALTH_URL }} run: | - if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi - if [ "$SERVED_BY_CMS" = "true" ]; then - EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms - else - bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test - fi + if [ -z "$HEALTH_URL" ]; then echo "Geen TEST_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi + # test.andreaslop.nl wordt door de CMS-host bediend: het script + # controleert ook de exacte CSP en de CMS-routes + EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms echo "Test bereikbaar en gelijk aan de build" # Lighthouse tegen de gebouwde site (mobiel en desktop) @@ -350,10 +343,10 @@ jobs: # Deze job kan pas draaien als er een webhost is. - name: Upload naar productie (FTPS) env: - FTP_HOST: ${{ secrets.FTP_HOST }} - FTP_USER: ${{ secrets.FTP_USERNAME }} - LFTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} - FTP_DIR: ${{ vars.FTP_REMOTE_DIR || 'wwwroot' }} + FTP_HOST: ${{ secrets.PROD_HOST_ADDRESS }} + FTP_USER: ${{ secrets.PROD_HOST_USERNAME }} + LFTP_PASSWORD: ${{ secrets.PROD_HOST_PASSWORD }} + FTP_DIR: ${{ vars.PROD_DEPLOY_PATH || 'wwwroot' }} run: | sudo apt-get update && sudo apt-get install -y lftp bash deploy/upload-production.sh dist "$FTP_DIR" @@ -361,8 +354,8 @@ jobs: - name: Controle na deploy env: - HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }} + HEALTH_URL: ${{ vars.PROD_HEALTH_URL }} run: | - if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_PRODUCTION ingesteld; overgeslagen"; exit 0; fi + if [ -z "$HEALTH_URL" ]; then echo "Geen PROD_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi bash deploy/verify-deployment.sh "$HEALTH_URL" dist echo "Productie bereikbaar en gelijk aan de build" diff --git a/docs/cms-integration.md b/docs/cms-integration.md index 532b91b..1c7bbf7 100644 --- a/docs/cms-integration.md +++ b/docs/cms-integration.md @@ -59,12 +59,11 @@ Decision (Bryan, 2026-11-15): the hosting package has one entry per website. The ## Environment and variables -| Name | Where | Meaning | -| --------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. | -| `ASF_OFFERINGS_URL_TEST` | Gitea repo variable | Value of `OFFERINGS_URL` for the test build. Set by SLS, not by feature sessions. | -| `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. | -| `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. | -| `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). | +| Name | Where | Meaning | +| --------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. | +| `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. | +| `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. | +| `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). | -The production artifact is built without `OFFERINGS_URL` on purpose: production must never carry the prices of the test CMS. +No build sets `OFFERINGS_URL` any more (since the host injection, 2026-11-18): the CMS host writes the current data into the HTML. The variable stays supported for a local build against a CMS. The production artifact never carries the prices of the test CMS. diff --git a/docs/deploy-and-ci.md b/docs/deploy-and-ci.md index b735559..c878ce0 100644 --- a/docs/deploy-and-ci.md +++ b/docs/deploy-and-ci.md @@ -20,8 +20,8 @@ Dispatch from the CLI (the token comes from your git credentials, never print it ## Jobs -1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build **without** `OFFERINGS_URL` (so with the committed snapshot), audit. Uploads artifact `dist` (this is what production gets). -2. `build-test`: builds again with `OFFERINGS_URL=${{ vars.ASF_OFFERINGS_URL_TEST }}` (packages and banners from the test CMS) and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`. +1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build (with the committed package snapshot), audit. Uploads artifact `dist` (this is what production gets). +2. `build-test`: builds again with `VITE_CONTACT_FORM_ENABLED=true` and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`. 3. `deploy-test`: needs `check` and `build-test`, downloads `dist-test`, uploads to the ASF test host and runs the deployment check (served by the CMS host, admin files, POST status). 4. `lighthouse`: against the built site with the preview stub (`--audit-route --contact-stub`). 5. `deploy-production`: manual, from `release/*` only, uses artifact `dist`. @@ -52,4 +52,19 @@ The test site stands on its own: in the test build `VITE_SITE_URL` is `https://t There used to be a nightly test build (`schedule`, 03:15 UTC) that baked the CMS data into the HTML for search engines. It is gone: the CMS host writes the packages, banners and hero into the first HTML of every request (cache 60 s, refreshed at once on a change; NFR-10), so a content change is visible without a rebuild. A rebuild is only needed for code and design. The nightly run also put `master` over ASF-test every night, which would undo a feature branch deployed there. -The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build still sets `OFFERINGS_URL`; removing that (and `VITE_SITE_URL`) is a separate follow-up once host injection is confirmed end to end. +The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build no longer sets `OFFERINGS_URL` (removed 2026-11-18, once the host injection was confirmed on ASF-test); it still sets `VITE_SITE_URL` (own address of the test site) and `VITE_CONTACT_FORM_ENABLED`. + +## Names of the repo variables and secrets + +Format `{ENV}_{GROUP}_{NAME}` with `ENV` = `TEST` or `PROD`, no app part (this repo only deploys the ASF site) and no `VITE` (the pipeline maps a value to `VITE_...` in the build). Decision of Bryan, 2026-11-18; the full list is in the SLS repo (`aidlc-docs/_shared/gitea-naamgeving-variabelen.md`). Repo variables and secrets are created by SLS, not by feature sessions. + +| Name | Kind | Used by | +| --------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- | +| `TEST_DEPLOY_PATH` | variable | `deploy-test`: target folder on the Pi | +| `TEST_HEALTH_URL` | variable | `deploy-test`: check after the deploy | +| `PROD_DEPLOY_PATH` | variable | `deploy-production`: remote folder (default `wwwroot`) | +| `PROD_HEALTH_URL` | variable | `deploy-production`: check after the deploy | +| `PROD_HOST_ADDRESS`, `PROD_HOST_USERNAME`, `PROD_HOST_PASSWORD` | secrets | `deploy-production`: FTP (plain FTP, no FTPS, at the hosting partner) | +| `PI_MAIN_ADDRESS`, `_PORT`, `_USERNAME`, `_PASSWORD` | secrets | `deploy-test`: still the old names; they become `TEST_HOST_*` with an SSH key (SLS arranges the key) | + +Removed: `DEPLOY_PATH_TEST`, `HEALTH_CHECK_URL_TEST`, `HEALTH_CHECK_URL_PRODUCTION`, `FTP_REMOTE_DIR`, `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD` (renamed), `ASF_OFFERINGS_URL_TEST` and `ASF_TEST_SERVED_BY_CMS` (no longer needed). The old names in the repo are removed by SLS after a green run. diff --git a/docs/go-live-checklist.md b/docs/go-live-checklist.md index e97b7a9..8165d9d 100644 --- a/docs/go-live-checklist.md +++ b/docs/go-live-checklist.md @@ -11,7 +11,7 @@ What must be true before the CMS-driven parts of the site go to production. Brya - [ ] Production hosting in place with the CMS host as the one entry of the website: IIS passes ALL requests to the CMS host (not only `/api/v1/*`) and serves no static files itself; the prerendered `dist/` is deployed to the CMS host ([cms-integration.md](cms-integration.md), "Hosting"). The generated IIS config and the production upload script are updated for this. Without it production keeps the committed snapshot and the console shows a 404 per page view for the API. - [ ] `web/src/content/offerings.snapshot.json` holds the real, current packages (production builds use it). -- [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (it is built without `OFFERINGS_URL`). +- [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (no build fetches packages from a CMS any more). ## Hero