6.3 KiB
6.3 KiB
Manual steps for Bryan - Andrea Slop Fotografie (ASF) test host (ordered, complete)
Scope: test environment only. Nothing here touches production. Commands are drafted by the Pi-Main session (via "CMS & API") from this list; this list says WHAT and in WHICH ORDER. Items marked (verify) are facts from the inventory that were not verified by the author.
Legend: [Pi] app Pi, [Proxy] proxy Pi 192.168.1.102, [Gitea] the CMS repository settings, [Code] needs the code on Gitea.
Phase A - Prepare (nothing is live yet; the old nginx route keeps serving)
- [Pi] Verify prerequisites: user
gitea-workflowexists and has lingering enabled for user units (loginctl enable-linger gitea-workflow) (verify);dotnetruntime 10 is installed and its path is known (verify); port 5200 is free; the folder/mnt/storage1/www/html/andreaslop-testexists andgitea-workflowcan read it (group/mode; the SlpSoftware setup needed a cross-account permission fix of the same kind) (verify). - [Pi] Database (sudo): create database
AndreaSlopFotografieTest(utf8mb4) and userAndreaSlopFotografie@localhostwith a strong password; grant all privileges on that database only. Note the password for step 4. Do not confuse with the WordPress databaseandreaslop. - [Pi] Directories as
gitea-workflow:apps/andreaslopfotografie/test/{releases,shared}. Create the symlinkshared/wwwroot-web->/mnt/storage1/www/html/andreaslop-test. (Variant B, only if you choose it later: skip the symlink; the website pipeline then copies intoshared/wwwroot-webitself.) - [Pi]
shared/env(mode 600, ownergitea-workflow) with the variables frominfrastructure-design.md:ASPNETCORE_ENVIRONMENT,ASPNETCORE_URLS,ConnectionStrings__DefaultConnection,JwtSettings__Secret,Identity__Setup__Token,Observability__SentryDsn,Observability__Environment,ForwardedHeaders__KnownProxies__0,Logging__LogLevel__SlpModularCms.Website. Generate the JWT secret (64+ chars) and the setup token (32+ chars) randomly; keep the token for step 17. - [Pi] systemd user unit
~/.config/systemd/user/andreaslopfotografie-test.service:WorkingDirectory=<deploy path>/current,EnvironmentFile=<deploy path>/shared/env,ExecStart=<dotnet path> SlpModularCms.Api.AndreaSlopFotografie.dll,Restart=on-failure,KillSignal=SIGINT,WantedBy=default.target. Runsystemctl --user daemon-reloadandsystemctl --user enable(do not start yet:currentdoes not exist until the first deploy). - [Pi] Firewall: allow 5200/tcp only from 192.168.1.102; verify with
ufw status. - [Pi, Pi-Main] Backup: add
AndreaSlopFotografieTestto the DB backup script. - [Gitea] Variables (repository SlpModularCms):
DEPLOY_PATH_ASF_TEST,SERVICE_NAME_ASF_TEST(same form as the SlpSoftware one),HEALTH_CHECK_URL_ASF_TEST=https://test.andreaslop.nl/health,VITE_SENTRY_DSN_ASF(the website's Sentry DSN). The existing secretsPI_MAIN_*are reused: confirm they point at the same Pi and user. Do NOT setASF_TEST_DEPLOY_ENABLEDyet. Until it istruethe ASF jobs are skipped and the pipeline stays as it is. - [Code] Make the code available to Gitea: this feature's branch must be pushed (or merged into master) before any deploy can run. I do not push; tell me when you want that. A merge to master with the switch off changes nothing for Andrea.
Phase B - Cut over (this causes the short test downtime you accepted)
- [Proxy] Save the current server block for
test.andreaslop.nl(copy the file; this is the revert point). - [Proxy] Switch the route: the block for
test.andreaslop.nl(website repo copy:web/deploy/nginx/test.andreaslop.nl.proxy.conf, generated byweb/config/serverConfig.ts) already setsHost,X-Forwarded-For($proxy_add_x_forwarded_for),X-Forwarded-Proto($scheme) andX-Real-IP. Verify these three forwarded headers are present in the live block (grep), then change only the target:proxy_pass http://192.168.1.103;(port 80, nginx fallback) ->proxy_pass http://192.168.1.103:5200;. Keep the certbot TLS settings. Test the config, reload nginx. Until the first deploy the site answers 502/503 (expected). The generator in the website repo is updated in U3 so the repo copy matches. - [Gitea] Set
ASF_TEST_DEPLOY_ENABLED=true. - [Gitea/Code] Run the first deploy: push to master, or start "Continuous Integration" manually with the box "Deploy ASF test" ticked. Watch the job: build admin, publish, upload, link, switch, restart,
/healthcheck on the public URL, prune.
Phase C - Verify (can be done together with this session)
curl -I https://test.andreaslop.nl/-> 200 with CSP, HSTS,X-Robots-Tag: noindex, nofollow;/over-mij(or any page) 200;/Over-Mij-> one 301; an unknown path -> 404 with the 404 page;/robots.txt->Disallow: /.https://test.andreaslop.nl/health-> healthy;/api/v1/System/capabilities-> noOfferings./admin/: Andrea's theme, Dutch; the setup page asks for the setup token.- Create the first administrator with the setup token. Afterwards remove
Identity__Setup__Tokenfromshared/envand restart the unit (the setup endpoint is closed once initialised; removing the token is hygiene). - Report what you see for the forwarded headers (visitor address in the logs/limiter rather than 192.168.1.102) and optionally time a page request on the Pi; both are asked for in the hand-back.
Rollback
- Release:
ln -sfn releases/<previous> currentandsystemctl --user restart andreaslopfotografie-test. - Route: restore the saved nginx block on the proxy Pi (step 10) and reload; the old nginx fallback on the app Pi serves the test site again.
- Switch off CI: set
ASF_TEST_DEPLOY_ENABLEDto anything buttrue.
Optional, separate (existing hosts; only if you want per-visitor rate limits there too)
- SlpSoftware test: add
ForwardedHeaders__KnownProxies__0=192.168.1.102to itsshared/env, make sure its proxy-Pi block setsX-Forwarded-For/-Proto, restart the unit after the next deploy of the new code. - SlpSoftware production and other hosts: the same two things, later, when you decide. Until then they behave exactly as before.
- Production Andrea: out of scope for this feature (when it comes:
Website__NoIndex=false, its own database/port 5201/route).