PlotDirector.Website/Docs/Publishing.md

113 lines
6.2 KiB
Markdown

# Independent website publishing
Development runs on Atlas as `plotdirector-website-dev`, identity
`plotdirector-website`, port 5051. Actual LAN URL: **http://192.168.10.10:5051/**
(or **http://atlas:5051/** where Atlas resolves). Atlas UFW permits port 5051 only from `192.168.10.0/24`; reachability was verified
from the existing reverse-proxy host as well as Atlas. Application Development remains
**https://dev.plotdirector.com/**, port 5050, identity/service unchanged.
An optional public HTTPS edge template is prepared at
`Tools/Deployment/production/nginx-development.conf`; DNS, TLS and edge administrator
installation are required before `https://website-dev.plotdirector.com` exists.
Start independent Codex sessions:
```sh
cd /srv/repos/PlotDirector.Website && codex
cd /srv/repos/PlotDirector && codex
```
Build: `dotnet build PlotDirector.Website.slnx`.
HTTP qualification: `python3 Tests/verify.py --origin http://127.0.0.1:5051`.
Browser qualification: `npm ci && WEBSITE_ORIGIN=http://127.0.0.1:5051 npm run test:browser`.
Browser installation: `npx playwright install chromium`, only if missing.
Deployment-security qualification: `python3 Tests/test_deployment.py`.
Build and regression gates run serially. Website has no application project reference.
## Atlas setup (one time)
`sudo -n bash Tools/Deployment/provision-development.sh` installs the fixed website
profile. It refuses an existing target; maintenance requires explicit review and
administrator installation, rather than trusting files from a submitted release.
Independent signing material lives in
`~/.local/share/plotdirector-website-development/signing/`, private key 0600/parent 0700.
Install approved help as described in Content.md before activation.
## Development release
Use a clean committed checkout and unique release identifier/output directory:
```sh
python3 Tools/Deployment/website_release.py prepare \
--source /srv/repos/PlotDirector.Website \
--output /home/nick/.local/share/plotdirector-website-development/releases/RELEASE-ID \
--release-id RELEASE-ID \
--signing-key /home/nick/.local/share/plotdirector-website-development/signing/private.pem \
--public-key /home/nick/.local/share/plotdirector-website-development/signing/public.pem
sg plotdirector-website-deploy -c 'cp -R /home/nick/.local/share/plotdirector-website-development/releases/RELEASE-ID /opt/plotdirector-website-dev/incoming/RELEASE-ID'
sudo -n /usr/local/sbin/deploy-plotdirector-website-development validate RELEASE-ID
sudo -n /usr/local/sbin/deploy-plotdirector-website-development activate RELEASE-ID
```
Use `sg ... -c 'sudo ...'` when group membership is not yet active. Keep incoming
packages for explicit rollback. Preparation retains existing Zstandard level 6/four
workers/frame checksum and Ed25519 authorization plus transport signatures. The
vendored transport verifier checks signatures and compressed checksums before bounded
decoding, then checks every extracted file and the exact manifest/product identity.
Website manifests contain no SQL; this helper never invokes a database worker.
The root-owned helper locks its own target, snapshots/verifies untrusted input,
installs immutable files, atomically switches `current`, restarts only its own service,
and checks health/product/source identity plus the homepage, pricing, help, solver and
sitemap through bounded, non-redirecting loopback smoke requests. Failures record receipts and, after a
failed switch with a previous release, restore that previous website. No SQL rollback
is involved. Receipts: `/opt/plotdirector-website-dev/receipts/*.json`; current marker
`active-deployment.json`; releases under `releases/RELEASE-ID/app`. Signing is separate
from activation, and neither runtime nor transfer group can replace the trusted helper.
Restart/logs: `sudo systemctl restart plotdirector-website-dev` and
`journalctl -u plotdirector-website-dev`. Neither command touches the application.
Explicit independent website rollback:
```sh
sudo -n /usr/local/sbin/deploy-plotdirector-website-development rollback PREVIOUS-RELEASE-ID
```
This re-verifies the retained signed package and retained files before switching, and
writes a new rollback receipt. It does not roll back shared help; select its prior
approved content publication independently if necessary.
## Production (prepared; NOT activated)
Templates are in `Tools/Deployment/production`. Production preparation must use a
separate signing key and deployment SSH identity. The website uses port 5004, service
`plotdirector-website`, `/srv/plotdirector-website`, independent trust/configuration
`/etc/plotdirector-website-production`. Ports 5002/5003 and unrelated sites are untouched.
The fixed Production profile refuses non-web1 hosts and any other root/service/endpoint.
An administrator must install the helper/vendor modules and SSH dispatcher root-owned
under `/usr/local/lib/plotdirector-website-deployment`, plus the fixed launcher under
`/usr/local/sbin/deploy-plotdirector-website-production`. Install the target/public key,
service/env, sshd Match and sudoers from the reviewed templates. Runtime and transfer
identities are separate locked system users, with no sudo/adm/docker membership.
See the application's `Docs/Separation/Cutover.md` for exact directory permissions,
preflight, backups, Nginx/TLS and activation order. Do not change Production without
owner approval. No administrative key is currently required for Development work.
Prepare with the same `website_release.py prepare` command using Production signing
material. Transfer independently:
```sh
python3 Tools/Deployment/transfer.py /absolute/qualified-bundle \
--identity /home/nick/.ssh/plotdirector-website-production
```
Restricted SSH commands on `plotdirector-website-deploy@85.190.124.132`:
`validate RELEASE-ID`, `activate RELEASE-ID`, `rollback PREVIOUS-ID`, `receipt UUID`.
Use the application's documented pinned SSH options and verified web1 host key.
Preparation/transfer/validation do not authorize activation. Retain receipts/releases.
The application's independent Development/Production commands remain documented in
`/srv/repos/PlotDirector/Docs/Codex/Deployment.md` and `Docs/Deployment/Production.md`.
Website publication never invokes those commands and never deploys application SQL.