Continuous Integration / check (pull_request) Successful in 2m24s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 11m38s
Continuous Integration / deploy-production (pull_request) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
75 lines
10 KiB
Markdown
75 lines
10 KiB
Markdown
# Deploy and CI
|
|
|
|
Pipeline: [.gitea/workflows/continuous_integration.yaml](../.gitea/workflows/continuous_integration.yaml). Branch strategy and rollback are in `aidlc-docs/features/frontend-shell/operations/deployment/` and `aidlc-docs/features/prerendering/`.
|
|
|
|
## Triggers
|
|
|
|
| Trigger | Result |
|
|
| ---------------------------------------- | ---------------------------------------------------- |
|
|
| Pull request | Checks only, no deploy. |
|
|
| Push to `master` | Checks, then deploy to test. |
|
|
| Manual (`workflow_dispatch`), any branch | Checks, and a deploy to test if `deploy_test` is on. |
|
|
| Manual from a `release/*` branch | Deploy to production if `deploy_production` is on. |
|
|
|
|
## Workflow inputs
|
|
|
|
- `deploy_test` (boolean, default false): "Deploy to Test". Builds the test artifact and deploys it to ASF test.
|
|
- `deploy_production` (boolean, default false): "Deploy to Production". Only works from a `release/*` branch and only with Bryan's explicit go.
|
|
|
|
Dispatch from the CLI (the token comes from your git credentials, never print it): `POST /api/v1/repos/SLP_Software/AndreaSlopFotografie/actions/workflows/continuous_integration.yaml/dispatches` with `{"ref": "<branch>", "inputs": {"deploy_test": "true"}}`.
|
|
|
|
## Jobs
|
|
|
|
1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build (with the committed package snapshot), audit. Uploads artifact `dist` (this is what production gets).
|
|
2. `build-test`: builds again with `VITE_CONTACT_FORM_ENABLED=true` and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`.
|
|
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`.
|
|
|
|
There is one Raspberry Pi runner plus a desktop runner, so jobs can wait in the queue for a long time (for example 30 minutes before `build-test`); a deploy that only just started is not hung. Check `started_at` (UTC) before cancelling anything.
|
|
|
|
## Deploying a feature branch to test
|
|
|
|
Committing, pushing and deploying a feature branch to test is allowed for the sessions that work on it. Merging, deploying to production and changing repo variables are not (Bryan decides). After a test deploy, check the page in a real browser against the real test CMS; `web/e2e/` holds the checks that run in CI.
|
|
|
|
## Contact form switch (`VITE_CONTACT_FORM_ENABLED`)
|
|
|
|
The contact form is closed by default. Only the test build (`build-test`) sets `VITE_CONTACT_FORM_ENABLED=true`, so the ASF test host shows the real form; the production artifact (job `check`) is built without it and stays closed. Only the exact value `true` opens the form (`src/lib/contactFormFlag.ts`); anything else keeps it closed, so a typo cannot open it in production. This replaced the former TEST ONLY commit `d449e76` (which hard-coded `enabled: true`); it was reverted before the merge, so nothing has to be undone any more. Opening the form in production needs Bryan's explicit go after the captcha decision (see [go-live-checklist.md](go-live-checklist.md)). Locally: `VITE_CONTACT_FORM_ENABLED=true pnpm build`.
|
|
|
|
## The check after a deploy and the host injection
|
|
|
|
`deploy/verify-deployment.sh` compares what the server sends with the files in `dist`. Once the CMS host injects (packages, banners, prices, JSON-LD price, site address), the pages differ from `dist` by design, so both sides are first normalised with `config/normalizeInjected.ts` (the contents of the CMS regions, the data block, `offers` in structured data, inline prices and the site address are taken out). Everything else must still be equal byte for byte, so an old build or a wrong server config is still caught; the 404 page is not injected and is compared as it is. The preview server can stand in for the host (`node config/previewServer.ts --cms-data=<json>`), which is how the script is tried locally.
|
|
|
|
## Own address of the test site
|
|
|
|
The test site stands on its own: in the test build `VITE_SITE_URL` is `https://test.andreaslop.nl`, so canonical, `og:url`, `og:image`, the JSON-LD ids and urls and `sitemap.xml` all point to the test host. A link shared from the test site (WhatsApp, Discord) therefore shows its own picture, not one from production. The production artifact (job `check`) is built without the variable and keeps `https://andreaslop.nl`. `src/lib/siteUrl.ts` only accepts an origin (https, or http on localhost); anything else falls back to production, so a typo cannot move production to another domain. This is a build setting, not TEST ONLY code: nothing has to be reverted before a merge. `robots.txt` on the test host is the nginx one (`Disallow: /`, plus `X-Robots-Tag: noindex`), not `public/robots.txt`, so the test site stays out of search engines. To try it locally: `VITE_SITE_URL=http://localhost:4173 pnpm build`.
|
|
|
|
## Generated files
|
|
|
|
`web/deploy/iis/web.config` and `web/deploy/nginx/*.conf` are generated by `pnpm server-config` from `web/config/serverConfig.ts`. Change the generator, rerun it and commit the result; a test checks that they match.
|
|
|
|
## No nightly build (since the host injection)
|
|
|
|
There used to be a nightly test build (`schedule`, 03:15 UTC) that baked the CMS data into the HTML for search engines. It is gone: the CMS host writes the packages, banners and hero into the first HTML of every request (cache 60 s, refreshed at once on a change; NFR-10), so a content change is visible without a rebuild. A rebuild is only needed for code and design. The nightly run also put `master` over ASF-test every night, which would undo a feature branch deployed there.
|
|
|
|
The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build no longer sets `OFFERINGS_URL` (removed 2026-11-18, once the host injection was confirmed on ASF-test); it still sets `VITE_SITE_URL` (own address of the test site) and `VITE_CONTACT_FORM_ENABLED`.
|
|
|
|
## Names of the repo variables and secrets
|
|
|
|
Format `{ENV}_{GROUP}_{NAME}` with `ENV` = `TEST` or `PROD`, no app part (this repo only deploys the ASF site) and no `VITE` (the pipeline maps a value to `VITE_...` in the build). Decision of Bryan, 2026-11-18; the full list is in the SLS repo (`aidlc-docs/_shared/gitea-naamgeving-variabelen.md`). Repo variables and secrets are created by SLS, not by feature sessions.
|
|
|
|
| Name | Kind | Used by |
|
|
| -------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `TEST_DEPLOY_PATH` | variable | `deploy-test`: target folder on the Pi |
|
|
| `TEST_HEALTH_URL` | variable | `deploy-test`: check after the deploy |
|
|
| `PROD_DEPLOY_PATH` | variable | `deploy-production`: remote folder (default `wwwroot`) |
|
|
| `PROD_HEALTH_URL` | variable | `deploy-production`: check after the deploy |
|
|
| `TEST_SENTRY_DSN`, `TEST_UMAMI_SCRIPT_URL`, `TEST_UMAMI_WEBSITE_ID` | variable | `build-test` and the CSP check in `deploy-test` (as `VITE_SENTRY_DSN`, `VITE_UMAMI_SCRIPT_URL`, `VITE_UMAMI_WEBSITE_ID`, `VITE_APP_ENV=test`) |
|
|
| `PROD_SENTRY_DSN`, `PROD_UMAMI_SCRIPT_URL`, `PROD_UMAMI_WEBSITE_ID` | variable | `check` (the production artifact; `VITE_APP_ENV=production`) |
|
|
| `PROD_HOST_ADDRESS`, `PROD_HOST_USERNAME`, `PROD_HOST_PASSWORD` | secrets | `deploy-production`: FTP (plain FTP, no FTPS, at the hosting partner) |
|
|
| `TEST_HOST_ADDRESS`, `TEST_HOST_PORT`, `TEST_HOST_USERNAME`, `TEST_HOST_SSH_KEY` | secrets | `deploy-test`: SSH key login to the Pi (one shared deploy key; no password) |
|
|
|
|
Removed: `PI_MAIN_*` (the SSH password login; the old secrets are deleted by Bryan after a green run), `DEPLOY_PATH_TEST`, `HEALTH_CHECK_URL_TEST`, `HEALTH_CHECK_URL_PRODUCTION`, `FTP_REMOTE_DIR`, `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD` (renamed), `ASF_OFFERINGS_URL_TEST` and `ASF_TEST_SERVED_BY_CMS` (no longer needed). The old names in the repo are removed by SLS after a green run.
|
|
|
|
**Monitoring per build.** Sentry and Umami settings are no longer in the code (`src/monitoring/config.ts`): every build gets them for its own environment and measures only on that environment's host (production build on `andreaslop.nl`, test build on `test.andreaslop.nl`; any other host measures nothing). The CSP origins for Umami and Sentry (`config/securityHeaders.ts`) come from the same variables, so a build without them has neither a measurement nor those origins; the build steps fail when a variable is empty. Unit and browser tests use the production values from `config/monitoringTestEnv.ts` (public values, the same as the variables); `pnpm server-config` does too, so the committed generated files carry the production CSP. The CMS host has its own copy of the origins in its environment (CMS repo).
|