280 lines
18 KiB
Markdown
280 lines
18 KiB
Markdown
# Controlled Production cutover — approval required
|
|
|
|
**Prepared procedure only. No Production cutover, certificate issuance, service,
|
|
Nginx, external-provider or SQL change has been performed by this separation task.**
|
|
Development acceptance and outstanding requirements are recorded in Acceptance.md.
|
|
Do not infer approval from a successful build, push, package or this document.
|
|
|
|
## Baseline and preconditions
|
|
|
|
Use the measured baseline in Audit.md: deployed commit
|
|
`9dcd29d423b20e373e49fb28180d993c40aa165d`, release
|
|
`plotdirector-production-spatial-9dcd29d423b2-20261127T203415Z`, receipt
|
|
`20261127T203623Z-d82f2be53cfe`. Retain its signed compressed package, full
|
|
337-entry Production ledger/qualified plan, verified backups and rollback material.
|
|
Application release tooling remains `Tools/Deployment/{release,transfer,deploy}.py`;
|
|
website tooling is independently in PlotDirector.Website/Tools/Deployment.
|
|
There are no SQL changes in the separation. Do not copy Development's ledger.
|
|
|
|
Before requesting approval, confirm both accepted source SHAs, pushed repositories,
|
|
public compatibility report, current schema and supported rollback packages. Check
|
|
current Production has not advanced since the baseline; if it has, rebase qualification
|
|
and recovery on the actual accepted live release. Restrict source/SDKs to Atlas.
|
|
|
|
Owner must explicitly confirm that pending offline/editor/Companion work is saved to
|
|
the existing server. Open the old installed PWA online, verify saved state and no pending
|
|
synchronisation, then close every application/Word window. The service worker does
|
|
not implement offline fetch caching or background sync; that is not proof that every
|
|
editor/Companion buffer has reached the database. Do not clear browser storage before
|
|
this check. Finish in-flight authentication/MFA/payment flows. Active import, analysis,
|
|
synthesis/enrichment jobs block application deployment under the existing helper.
|
|
|
|
## Administrative access and configuration preservation
|
|
|
|
Production provisioning requires an administrator to create the independent website
|
|
runtime/deployment identities, protected helper/configuration/service and two reviewed
|
|
vhosts, and to issue TLS for app.plotdirector.com. The restricted application deploy
|
|
account cannot do these actions and must not be expanded. No temporary administrative
|
|
access is needed to finish Atlas work.
|
|
|
|
When this administrative step is approved, the operator can execute it from their
|
|
administrative workstation. If Atlas execution is requested instead, temporarily
|
|
re-authorize only its existing dedicated key, fingerprint
|
|
`SHA256:2Iw3JYNS8TgPARowjnp+7wNC6cmWf1EV7Cy1Mg1ig3w`, following
|
|
Docs/Deployment/Production.md. Use pinned SSH host key
|
|
`SHA256:4X54DW85/3J/iGU7ECfRkbMn0n13gVPbpRnvtcZfn/0` and documented strict options.
|
|
Remove only that temporary authorization after restricted access is verified.
|
|
|
|
First back up uniquely named copies/checksums of PlotDirector Nginx files/snippets,
|
|
systemd unit/drop-ins, deployment configuration/active marker and certificate renewal
|
|
configuration. Record actual `current`, PID, DLL hash and last successful release.
|
|
Record catherinelynwood.com TLS/HTTP and its service/configuration checksums for an
|
|
unchanged comparison. Do not modify that site, port 5002, reserved 5003 or any other
|
|
unrelated service. Verify port 5004 is free. The application stays on port 5001 with
|
|
its existing service, runtime identity, environment file, uploads, secrets, database,
|
|
key ring/discriminator and acceptance/egress/worker controls. Never rotate or copy
|
|
Data Protection material into the website. Merge the prepared non-secret
|
|
`application-origin.env.example` values into the existing application configuration:
|
|
`Site__WebsiteBaseUrl=https://plotdirector.com` and an explicit AllowedHosts list for
|
|
app.plotdirector.com, the legacy apex bridge and loopback health. Set `HelpContent__Path=/srv/plotdirector/shared/help/current` after installing the
|
|
same approved Production help artifact into the application's own protected store.
|
|
Keep all other application environment values intact; do not replace its environment file.
|
|
|
|
## Independent website provisioning (web1)
|
|
|
|
Review the exact templates in
|
|
`/srv/repos/PlotDirector.Website/Tools/Deployment/production` on Atlas, then install
|
|
reviewed files, not executable package hooks. Website schema/database work is absent.
|
|
|
|
1. Create locked `plotdirector-website` runtime identity with nologin, and separate
|
|
`plotdirector-website-deploy` transfer identity with `/bin/sh` only for sshd's forced
|
|
command. Neither belongs to sudo, adm, docker or application/Catherine groups.
|
|
Install a new dedicated SSH public key for the website transfer identity with
|
|
restrictive authorized_keys options. Its private identity remains on Atlas.
|
|
2. Provision an independent Production Ed25519 release signing key on Atlas
|
|
(private 0600 in a 0700 directory). Install only its public key on web1.
|
|
Never reuse the application or Development signing keys.
|
|
3. Create these fixed paths/permissions:
|
|
|
|
| Path | Owner/mode |
|
|
| --- | --- |
|
|
| `/srv/plotdirector-website` | root:root 0755 |
|
|
| `releases`, `shared`, `receipts` | root:root 0755 |
|
|
| `incoming` | root:plotdirector-website-deploy 0730 |
|
|
| `deployment.lock` | root:root 0600 |
|
|
| `incoming-upload.lock` | root:plotdirector-website-deploy 0660 |
|
|
| `shared/keys` | plotdirector-website:plotdirector-website 0700 |
|
|
| `shared/help` and immutable content directories | root:root 0755; files 0444 |
|
|
| `/etc/plotdirector-website-production` | root:root 0755 |
|
|
| target JSON/public key | root:root 0644 |
|
|
| website.env | root:plotdirector-website 0640 |
|
|
| `/usr/local/lib/plotdirector-website-deployment` + vendor | root:root dirs 0755/files 0644 |
|
|
|
|
4. Install reviewed website_release.py, vendor primitives/transport and ssh_dispatch.py
|
|
at that fixed helper directory. Install the fixed Production launcher as
|
|
`/usr/local/sbin/deploy-plotdirector-website-production` root:root 0755. Its cleared
|
|
environment fixes `PLOTDIRECTOR_WEBSITE_TARGET=Production`; the helper refuses any
|
|
different service/root/host/health target. Runtime and transfer cannot update it.
|
|
5. Install the separate sshd Match and sudoers templates. Run `sshd -t` and
|
|
`visudo -cf` before reloading SSH. Test unsupported commands/shell/SFTP/forwarding
|
|
rejection and signed-package validate/receipt through the restricted identity.
|
|
Retain an administrative session until the restricted path is proven.
|
|
6. Install the separate service/env/target from templates, daemon-reload and enable
|
|
only the website service. Publish the explicitly approved **Production** help
|
|
artifact into `shared/help/current` using the verified manifest-digest consumer.
|
|
The website runtime has no app SQL/password/cookie/SMTP/Stripe/OpenAI configuration.
|
|
Logs use its own journald service and Nginx access/error logs.
|
|
|
|
## DNS, TLS and Nginx
|
|
|
|
DNS was provided as already configured: app.plotdirector.com CNAME -> plotdirector.com.
|
|
At cutover independently resolve A/AAAA/CNAME from external resolvers and verify they
|
|
reach web1, including IPv6 if published. DNS aliasing does not provide TLS coverage.
|
|
Retain the apex/www certificate and renewal hook. Use a separate app certificate.
|
|
|
|
After approval, install the HTTP-only app challenge vhost first, verify a unique
|
|
challenge through the real hostname, and issue:
|
|
|
|
```sh
|
|
certbot certonly --webroot --webroot-path /srv/plotdirector/acme \
|
|
--cert-name app.plotdirector.com -d app.plotdirector.com --non-interactive --agree-tos
|
|
```
|
|
|
|
Use the existing registered account. Do not issue/renew Catherine's certificate.
|
|
Install an app-lineage-only deploy hook performing `nginx -t` and reload, preserving
|
|
the apex hook. Perform a targeted renewal dry-run for the new app certificate.
|
|
Only then enable the prepared HTTPS app vhost. Confirm certificate SAN/chain/expiry
|
|
and normal verified TLS to both PlotDirector hosts, apex/www redirect and ACME renewal.
|
|
|
|
Merge templates into the backed-up **actual** PlotDirector configuration; do not blindly
|
|
replace unrelated locations, maps, maintenance or verification handling. Keep the
|
|
current no-public-access `/_deployment` health restriction. Nginx `-t` must pass before
|
|
any reload. Public website backend is 5004; application remains 5001. Source templates
|
|
include explicit legacy browser-route redirects and integration reverse proxies.
|
|
Do not leave duplicate vhosts for the same host.
|
|
|
|
## Compatibility and authentication
|
|
|
|
Public `/`, features, pricing, help, solver, policies and sitemap stay at plotdirector.com.
|
|
The complete accepted contract is Evidence/public-urls.json, not a list reconstructed
|
|
from a few landing pages. Unknown pages stay 404. Existing canonical help aliases
|
|
and method/query-preserving `/writing-problems` redirects are retained.
|
|
|
|
Known legacy browser application URLs (Projects, Books, Chapters, Scenes, Characters,
|
|
Writer/Writing, Context, ManageAccount, account token URLs, admin/onboarding/manuscript
|
|
routes and authenticated solver workspace routes) redirect 308 to the **same path/query**
|
|
on app.plotdirector.com. Known controller POSTs and GETs identified as AJAX/JSON
|
|
are proxied to the original backend instead of crossing origins through a redirect.
|
|
Plain stale browser fetch clients without identifying headers should reload at the
|
|
new application origin. Do not redirect every missing URL to a homepage. Review any
|
|
new attribute routes against the compatibility template before activation.
|
|
|
|
Legacy `/api`, `/hubs`, `/native-companion`, `/word-companion` and `/uploads` traffic
|
|
is explicitly proxied to the existing application backend. The taskpane-specific
|
|
JavaScript, notification CSS/JavaScript and legacy manifest icons are also proxied
|
|
explicitly, so the bridged taskpane does not lose its scripts or styling. Preserve request bodies,
|
|
Authorization/Stripe signatures, queries and websocket upgrade semantics. These
|
|
protocol clients cannot safely rely on ordinary browser redirects. The temporary
|
|
bridge preserves endpoint availability, not a promise to migrate origin-bound cookie,
|
|
Office trust or native installation credentials. Retain it until observed usage and
|
|
owner acceptance permit a separately reviewed retirement. Never forward application
|
|
cookies to the website process or widen their Domain to share authentication.
|
|
|
|
New app-root behavior: authenticated -> Projects; unauthenticated -> Sign in -> Projects.
|
|
A protected deep link -> sign-in -> requested local page. Existing authenticated users
|
|
opening public Sign in reach the app and bypass another prompt if the **app-origin**
|
|
cookie is valid. Existing old-origin cookies do not create a new-origin session:
|
|
expect a one-time sign-in at app.plotdirector.com. Logout -> application sign-in.
|
|
All unauthenticated account pages use public branding; authenticated theme preferences
|
|
remain in the existing application. Website never branches on application authentication.
|
|
|
|
Email verification/reset links generated after cutover use the app request host.
|
|
Old links retain token/query through the browser compatibility redirect. Do not
|
|
invalidate tokens, reset users/subscriptions or enable held email workers. Review
|
|
queued messages and provider allowlists/sender settings without exposing secrets.
|
|
|
|
## Third parties, Word and PWA
|
|
|
|
Owner/provider administrator must approve or perform Stripe endpoint/domain changes:
|
|
`https://app.plotdirector.com/api/stripe/webhook`, checkout/customer-portal return URLs
|
|
and any configured account/business website URLs. Keep the old signed webhook proxy
|
|
during transition. Use dashboard test-mode events against Development where possible;
|
|
never manufacture live payment events, change prices or claim external acceptance
|
|
without real evidence. Preserve signing secrets and provider event idempotency.
|
|
|
|
Word web add-in: provide `PlotDirector.WordCompanion/manifest.production.xml`, same
|
|
add-in identifier/version 1.0.1.0. Update the approved sideload/central deployment
|
|
manifest and reopen Word/taskpane. Production AppDomain/SourceLocation/icons now use
|
|
app.plotdirector.com. Development manifest remains pointed to dev.plotdirector.com.
|
|
Office manifest validation has separate evidence; it is not physical Word testing.
|
|
The current native MSI is origin-configurable: synchronize/capture pending work,
|
|
sign out/revoke old approval, use supported Change account/server to select the new
|
|
app origin, sign in and approve a new installation. Do not manually transplant
|
|
origin-scoped DPAPI credentials. Verify document association, book lists/capture,
|
|
Context navigation, AI/analysis connectivity, SignalR and updates on actual Windows.
|
|
No binary installer rebuild is needed for an origin-only reconfiguration; a newly
|
|
rebuilt installer would require the established Windows signing/qualification process.
|
|
|
|
PWA owner: synchronize first, uninstall the old installed app, sign in to
|
|
https://app.plotdirector.com, install there, launch and verify `/Projects`, safe deep
|
|
link authentication, icons, independent window/Context navigation and chosen theme.
|
|
Confirm the old public website offers no manifest/worker/installation prompt. No
|
|
complex automatic installed-PWA migration is attempted. Retain old browser data until
|
|
saved manuscript work is verified on the new origin. The PWA remains network-dependent;
|
|
offline requests must not expose a cached authenticated response or pretend to save.
|
|
|
|
## Activation order after explicit approval
|
|
|
|
1. Confirm both final SHAs and explicit scope approval; verify backup/idle state and
|
|
the baseline still matches. Qualify the app rollback against current schema.
|
|
2. Provision/verify independent infrastructure and app TLS while current public site
|
|
remains served by the baseline app. Confirm unrelated service checksums/HTTPS.
|
|
3. Prepare/sign/transfer/validate the website and app bundles independently. Application
|
|
uses the existing full Production ledger/code-only plan and compressed process.
|
|
4. Start/qualify the website on loopback 5004 with approved Production help, without
|
|
changing public traffic. Test every public URL/sitemap/metadata with the intended
|
|
Host and independent app outage, and record its source/health receipt.
|
|
5. Confirm owner synchronization/no active work again. Activate the approved application
|
|
release through the existing restricted helper. Its standard verified backup/ledger,
|
|
locks/health/receipts and minimal-downtime controls remain mandatory.
|
|
6. Atomically enable the reviewed app/public Nginx arrangement and reload only after
|
|
`nginx -t`. This small coordinated Nginx change is the public domain cutover.
|
|
Do not perform it before approval. Keep legacy integration bridges operational.
|
|
7. Check public routes, 404s, canonical sitemap, Production indexability, app noindex,
|
|
Projects/auth/deep links/logout/themes, protected Context/manuscript/API access,
|
|
SignalR upgrades, callback compatibility, Word and PWA acceptance. Verify both
|
|
hosts with real TLS and verify Catherine unchanged. Capture receipts/screenshots.
|
|
8. Complete only the approved external dashboard/client changes and record outcomes.
|
|
Retain old releases/configuration/keys/uploads/backups and legacy bridge. Remove
|
|
temporary admin authorization after restricted commands are verified.
|
|
|
|
## Future independent publishing commands
|
|
|
|
Application Development (clean committed checkout; no changed SQL):
|
|
|
|
```sh
|
|
python3 Tools/Deployment/development_release.py --source /absolute/clean/app-checkout \
|
|
--output /home/nick/.local/share/plotdirector-development/releases/UNIQUE-ID --activate
|
|
```
|
|
|
|
Application Production (qualified bundle; defaults to validation only):
|
|
|
|
```sh
|
|
python3 Tools/Deployment/deploy.py --bundle /absolute/qualified-app-bundle \
|
|
--identity /home/nick/.ssh/plotdirector-production \
|
|
--public-key /absolute/trusted/app-public.pem --receipt /absolute/app-receipt.json \
|
|
--public-acceptance
|
|
```
|
|
|
|
Add `--activate` only for an approved release. No migration flag is needed for this
|
|
code-only separation; unexpected SQL/history blocks. Application activation never
|
|
restarts the website. Website Development/Production prepare/transfer/validate/
|
|
activate/rollback commands are in the independent website's Docs/Publishing.md.
|
|
Documentation publication/consumption commands are in its Docs/Content.md and do not
|
|
restart or deploy application code.
|
|
|
|
## Rollback
|
|
|
|
Website-only failure: independently re-verify/activate its previous retained signed
|
|
release via `rollback PREVIOUS-ID`. Shared-help rollback independently switches to a
|
|
previous approved immutable publication. Neither operation touches application data.
|
|
|
|
Application failure: follow the existing qualified code-only rollback process, using
|
|
a new signed release ID with the known baseline binaries against the **current**
|
|
Production schema and full ledger. Invoke the application's restricted rollback
|
|
operation; never just switch a symlink past its health/history guard. Preserve all
|
|
keys, uploads, configuration and database data. Do not restore SQL automatically.
|
|
|
|
Whole-cutover rollback: first fence new writes if app health/data integrity is
|
|
uncertain; record receipts/current pointers/actual schema. Restore the uniquely
|
|
backed-up PlotDirector Nginx configuration (after `nginx -t`), and roll application
|
|
binaries back through the existing qualified helper to the baseline combined product.
|
|
The old public domain then serves the tested combined baseline. Stop/disable only the
|
|
new website service if necessary; retain its artifacts. Revert specifically approved
|
|
provider changes or keep the old webhook bridge as appropriate, avoiding duplicate
|
|
endpoint processing. App-origin cookies/PWA may require signing in again or reinstall;
|
|
this is not data loss. Keep app TLS/compatibility available long enough for owner/client
|
|
recovery rather than deleting certificates/DNS. Never change Catherine or unrelated
|
|
services. A database restore is a separate explicit recovery authorization, not a
|
|
normal domain/application rollback.
|