178 lines
10 KiB
Markdown
178 lines
10 KiB
Markdown
# PlotDirector Development Deployment
|
|
|
|
Development uses the installed Atlas-only manifest activation profile in
|
|
`Tools/Deployment/development.py`. Production uses a separate helper on web1.
|
|
Do not repoint either helper, copy Production credentials, or use Production access
|
|
for a Development release.
|
|
|
|
## Targets and trust boundaries
|
|
|
|
| Setting | Development on Atlas |
|
|
|---|---|
|
|
| Application root | `/opt/plotdirector-dev` |
|
|
| Current application | `/opt/plotdirector-dev/current` (atomic symlink) |
|
|
| Immutable releases | `/opt/plotdirector-dev/releases/<release-id>/app` |
|
|
| Service / runtime user | `plotdirector-dev.service` / `plotdirector` |
|
|
| Runtime environment | `/etc/plotdirector/plotdirector.env` |
|
|
| Deployment configuration | `/etc/plotdirector-development/target.json` |
|
|
| Database worker configuration | `/etc/plotdirector-development/database.json` |
|
|
| Database / SQL endpoint | `PlotDirector_Development` / `192.168.10.10,1433` |
|
|
| Installed helper | `/usr/local/sbin/deploy-plotdirector-development` |
|
|
| Installed implementation | `/usr/local/lib/plotdirector-dev-deployment` |
|
|
| Migration OS identity | `plotdirector-dev-migrate` |
|
|
| Deployment group / sudo rule | `plotdirector-dev-deploy` / `/etc/sudoers.d/plotdirector-development` |
|
|
| Submission inbox | `/var/lib/plotdirector-dev-deployment/incoming` |
|
|
| Approved code-only baseline | `/var/lib/plotdirector-dev-deployment/baseline` |
|
|
| Evidence / receipts | `/opt/plotdirector-dev/deployment-evidence`, `/opt/plotdirector-dev/deployment-receipts` |
|
|
| SQL backup (host / container) | `/sql/mssql/backup` / `/var/opt/mssql/backup` |
|
|
| Local / public URL | `http://127.0.0.1:5050` / `https://dev.plotdirector.com/` |
|
|
|
|
The fixed Development profile rejects any change to host, database, service,
|
|
configuration paths, trust anchor or endpoints. Its signing key is independent of
|
|
Production. The privileged command clears the environment and imports only its
|
|
root-owned installed modules. Operators submit untrusted packages; the helper
|
|
snapshots them and verifies signatures, manifests, file checksums, qualification,
|
|
schema fingerprints and the complete immutable migration ledger before admission.
|
|
|
|
`/srv/apps/plotdirector-dev/current` is the retained legacy application directory,
|
|
not the active service target. Existing uploads, logs and data-protection storage
|
|
remain at their original Development paths. Root-owned bindings and configuration
|
|
links under `/opt/plotdirector-dev/shared` preserve those paths across releases.
|
|
Runtime appsettings and the environment file are not taken from release packages.
|
|
The Development systemd drop-in explicitly retains
|
|
`DataProtection__KeysPath=/srv/apps/plotdirector-dev/App_Data/DataProtectionKeys`
|
|
and `DataProtection__ApplicationName=/srv/apps/plotdirector-dev/current/`. The latter
|
|
is the measured legacy ASP.NET application discriminator, including its trailing
|
|
slash. Both values are enforced by admission, so release-directory changes do not
|
|
rotate the cookie purpose or key ring.
|
|
Do not delete the legacy directory: some persistent bindings still reference it.
|
|
|
|
## Routine code-only deployment
|
|
|
|
Use a clean committed checkout. Preserve unrelated work by building from a separate
|
|
clean worktree when necessary. The caller must be a member of
|
|
`plotdirector-dev-deploy`; membership takes effect on the next login (or use
|
|
`sg plotdirector-dev-deploy -c 'COMMAND'` for the current session).
|
|
|
|
Run the repository's current orchestration tool, supplying the intended clean
|
|
application checkout and a new private output directory:
|
|
|
|
```bash
|
|
python3 Tools/Deployment/development_release.py \
|
|
--source /absolute/clean/checkout \
|
|
--output /home/nick/.local/share/plotdirector-development/releases/UNIQUE-ID \
|
|
--activate
|
|
```
|
|
|
|
This publishes the exact commit, runs the executable regression harness serially,
|
|
checks that SQL has not changed from the approved Development baseline, prepares
|
|
and signs the standard manifest package, submits it, validates it, then activates
|
|
it. The signing key is
|
|
`~/.local/share/plotdirector-development/signing/private.pem` (mode 0600, parent
|
|
0700). It never reads a Production signing key or invokes SSH. Without `--activate`
|
|
it stops after preactivation validation; there is no service stop or database write.
|
|
|
|
Activation checks queued/running work and holds the database deployment session
|
|
lock. It makes and verifies a COPY_ONLY/CHECKSUM backup, checks idle state again
|
|
before and after stopping the service, verifies/skips recorded migrations, installs
|
|
immutable files, switches `current`, starts the service, verifies application and
|
|
database identity, and records successful release history only after health passes.
|
|
Active import, Story Intelligence, synthesis, enrichment or other checked jobs
|
|
block deployment. Do not interrupt them without explicit acceptance.
|
|
|
|
For a previously submitted bundle:
|
|
|
|
```bash
|
|
sudo -n /usr/local/sbin/deploy-plotdirector-development --validate RELEASE-ID
|
|
sudo -n /usr/local/sbin/deploy-plotdirector-development --activate RELEASE-ID
|
|
sudo -n /usr/local/sbin/deploy-plotdirector-development --receipt DEPLOYMENT-ID
|
|
```
|
|
|
|
No administrator intervention or Production access is needed for these routine
|
|
commands after provisioning. A failed operation retains a sanitised receipt and
|
|
protected evidence. After a failure involving a service stop, investigate the
|
|
receipt before taking further action; the helper does not blindly roll back SQL.
|
|
|
|
## SQL changes and recovery
|
|
|
|
The routine command deliberately rejects changed SQL. A schema release needs an
|
|
explicit reviewed plan qualified against Development's schema, using the standard
|
|
`release.py` package contract and `DatabaseWorker`. Read
|
|
[database operations](Database.md) and the [manifest/history contract](../Deployment/Production.md).
|
|
Never replay all SQL files, infer history from a migration number, or adopt a
|
|
Production baseline. Update the approved Development code-only baseline only after
|
|
successful schema qualification and activation.
|
|
|
|
An application rollback needs a signed package with a new release identifier and
|
|
compatible schema. `--rollback` requires all migration history already present;
|
|
it never undoes database changes. The previous release remains in `releases`.
|
|
|
|
## Verification
|
|
|
|
Check service status, recent warning/error logs, local health identity and normal
|
|
TLS public GETs. Compare the installed DLL checksum and changed static assets with
|
|
the signed manifest. Confirm the running health endpoint reports the intended full
|
|
commit, `Development` and `PlotDirector_Development`. Verify affected authenticated
|
|
routes through normal login with an isolated Development fixture when applicable.
|
|
Never print credentials or record login screenshots, browser storage or traces.
|
|
|
|
## One-time provisioning and infrastructure updates
|
|
|
|
`Tools/Deployment/provision/development.py` is an administrator-only provisioning
|
|
operation. It accepts a previously signed **Development** package matching the
|
|
running DLL and a complete verified Development ledger; it refuses an existing
|
|
target. It installs an independent worker/profile/key/sudo rule, preserves runtime
|
|
configuration and persistent paths, seeds the previous release and reloads the
|
|
Development service drop-in without restarting the process. It does not contact
|
|
Production or change database state. Its worker input is a full published directory,
|
|
including nested `runtimes/` dependencies.
|
|
|
|
The actual 2026-11-25 provisioning command was:
|
|
|
|
```bash
|
|
sudo -n python3 Tools/Deployment/provision/development.py \
|
|
--deployment-user nick \
|
|
--database-config /home/nick/plotdirector-phase1-20261125/worker-development.private.json \
|
|
--worker /tmp/pd-dev-deploy-ops/worker \
|
|
--previous-package /home/nick/otp-refine-20261125/signed-bundle \
|
|
--previous-public-key /home/nick/plotdirector-phase1-20261125/release-signing/phase1-candidate.pub.pem \
|
|
--public-key /home/nick/.local/share/plotdirector-development/signing/public.pem
|
|
```
|
|
|
|
Those inputs describe the historical bootstrap, not routine deployment dependencies.
|
|
Subsequent releases use only the installed profile, approved baseline and independent
|
|
Development signing key. Installed privileged modules do not update themselves
|
|
from a checkout. Changes to the trusted helper require separate administrator
|
|
review/install and the focused Python regression suite; they do not require any
|
|
Production access.
|
|
|
|
## Why the 2026-11-25 blocker occurred
|
|
|
|
`05a689c2` changed this guide to mandate manifest/history activation, but supplied
|
|
only a Production-specific installed target. `793de563` retained that restriction.
|
|
The last successful Development deployment (`9b1770d9`, 19:48 UTC) used a one-off
|
|
private Development driver, with a signed package, verified backup, 321-entry
|
|
ledger and post-health release record. That driver was not installed or documented
|
|
as the reusable Development entry point. The later `ff6369e9` task therefore found
|
|
no supported configured Development target. The running application and ledger
|
|
were healthy; the regression was the incomplete operational handover.
|
|
|
|
## Acceptance of the restored mechanism
|
|
|
|
Commit `ff6369e9766b37fba38b9c327c0c170076236870` was deployed twice through the
|
|
routine command, with the final activation retaining the legacy data-protection
|
|
identity. Both used signed manifests, verified backups and complete 321-entry
|
|
history; zero migrations executed. A group-only temporary OS identity successfully
|
|
validated a release while general sudo, migration credentials and the private
|
|
signing key remained inaccessible. All 77 deployment tests and the complete
|
|
application regression harness passed. Authenticated Scan Manuscript and actual
|
|
theme-picker checks passed in light/dark modes; served stylesheet hashes match.
|
|
|
|
See the [activation receipt](../Deployment/Evidence/Development-20261125/activation-receipt.json),
|
|
[verification](../Deployment/Evidence/Development-20261125/verification.json), and
|
|
[permission checks](../Deployment/Evidence/Development-20261125/permission-check.json).
|
|
The legacy HTTPS-port warning behind the reverse proxy remains; public TLS checks
|
|
pass. A separate existing account-deletion foreign-key defect was observed while
|
|
removing the browser fixture; the fixture was fully removed, and no schema change
|
|
was made. Neither observation blocks Development deployments.
|