Operations: deployment- en monitoringdocumentatie voor andreaslop-site-hosting
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
# Deployment Instructions - ASF test host
|
||||
|
||||
The pipeline definition already exists in `.gitea/workflows/continuous_integration.yaml` (jobs `config-asf`, `publish-asf-test`, `deploy-asf-test`, reusing `deploy-scp.yaml`); this runbook sequences the one-time Pi work, the first deploy and every later deploy. The exact one-time steps (1-18) are in `construction/andreaslop-client/infrastructure-design/manual-steps-for-bryan.md`; the Pi-Main session drafts the commands from that list.
|
||||
|
||||
## 0. Before anything is pushed
|
||||
1. The vulnerability gate is clean (done: Xml 10.0.14, zod, react-router). Run `dotnet test SlpModularCms.sln` where MariaDB exists, or let CI do it.
|
||||
2. Decide when to push or merge (done by Bryan; the assistant never pushes unasked). A merge to master with `ASF_TEST_DEPLOY_ENABLED` unset changes nothing for ASF, but does deploy the shared Core change (patched packages, per-client limiters, opt-in forwarded headers) to SlpSoftware test on that push. Watch that first SlpSoftware deploy.
|
||||
|
||||
## 1. One-time preparation (manual-steps phase A, nothing live yet)
|
||||
Verify prerequisites, create database/user, directories + symlink `shared/wwwroot-web`, `shared/env`, user unit (enabled, not started), ufw 5200 from 192.168.1.102, DB backup entry, Gitea variables (`DEPLOY_PATH_ASF_TEST`, `SERVICE_NAME_ASF_TEST`, `HEALTH_CHECK_URL_ASF_TEST`, `VITE_SENTRY_DSN_ASF`). Leave `ASF_TEST_DEPLOY_ENABLED` unset.
|
||||
|
||||
## 2. Cut over (phase B, accepted short test downtime)
|
||||
Save the current proxy block; verify the three forwarded headers are present; change only `proxy_pass` to `http://192.168.1.103:5200`; test config; reload. Set `ASF_TEST_DEPLOY_ENABLED=true`; push to master or run the workflow manually with "Deploy ASF test".
|
||||
|
||||
## 3. What a deploy does (every time)
|
||||
Build admin (`VITE_THEME=asf`, Dutch default) -> publish linux-arm64 -> upload to `releases/<timestamp>` -> link `wwwroot/web` to `shared/wwwroot-web` -> atomic switch of `current` -> `systemctl --user restart` -> `/health` on the public URL (10 tries) -> prune to current + previous.
|
||||
|
||||
## 4. Verify after the first deploy (phase C)
|
||||
`curl -I https://test.andreaslop.nl/` (CSP, HSTS, noindex), an inner page, `/Over-Mij` -> one 301, unknown path -> 404 page, `/robots.txt`, `/health`, `/api/v1/System/capabilities` (no Offerings), admin in Dutch with ASF theme, create the first administrator with the setup token, then remove `Identity__Setup__Token` from `shared/env` and restart the unit. Report forwarded-header observation and optional timing.
|
||||
|
||||
## 5. Later deploys
|
||||
Push to master (or manual run). The website itself is delivered by its own repository into `/mnt/storage1/www/html/andreaslop-test`; no host restart is needed.
|
||||
@@ -0,0 +1,8 @@
|
||||
# Deployment Plan - andreaslop-site-hosting (test only)
|
||||
|
||||
- **Method**: CI/CD pipeline (Gitea Actions) to an on-premises Pi, as decided in U2 Infrastructure Design (answers: all A).
|
||||
- **Environment**: test only, `https://test.andreaslop.nl`. Production for Andrea Slop Fotografie is a separate later decision (`Website__NoIndex=false`, own database, port 5201, own route) and not part of this feature.
|
||||
- **Why this shape**: it reuses the proven SlpSoftware path (`deploy-scp.yaml`: timestamped release, atomic `current` switch, restart, public `/health` check, prune to two releases) without touching it. ASF has its own jobs behind one switch, `ASF_TEST_DEPLOY_ENABLED`.
|
||||
- **Triggers**: push to master, or manual run with "Deploy ASF test" ticked; both only when the switch variable is `true`.
|
||||
- **Secrets**: Gitea secrets `PI_MAIN_*` (existing) and the Pi file `shared/env` (mode 600). Nothing secret is committed. No approval gate for test.
|
||||
- **Sources of truth**: `construction/andreaslop-client/infrastructure-design/{infrastructure-design,deployment-architecture,manual-steps-for-bryan}.md`.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Rollback Plan - ASF test host
|
||||
|
||||
| What went wrong | Rollback |
|
||||
|---|---|
|
||||
| Bad release (health check red or wrong behaviour) | On the Pi: `ln -sfn releases/<previous> current && systemctl --user restart andreaslopfotografie-test`. The previous release is always kept (prune keeps current + 1). |
|
||||
| Proxy route broke the test site | Restore the saved nginx server block on the proxy Pi (manual step 10), test config, reload; the old nginx fallback on the app Pi serves the site again. |
|
||||
| Pipeline misbehaves | Set `ASF_TEST_DEPLOY_ENABLED` to anything but `true`: all ASF jobs are skipped, SlpSoftware is unaffected. |
|
||||
| Shared Core change misbehaves on another host | Redeploy the previous release of that host the same way. The new behaviour is opt-in (forwarded headers) or equivalent to before (limiter buckets share the proxy address when no proxy is configured). |
|
||||
| Database | Migrations run automatically at start and are forward-only. The test database is backed up by the Pi DB backup (step 7); restore from that backup if a migration must be undone. |
|
||||
| Setup token leaked | Replace `Identity__Setup__Token` in `shared/env` and restart, or remove it once the first administrator exists. |
|
||||
Reference in New Issue
Block a user