17 KiB
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:
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:
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 and the manifest/history contract.
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:
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, verification, and permission checks. 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.
Independent public website
Application-only domain separation is prepared in Docs/Separation/Cutover.md.
Application Development stays on this profile/service/5050 and retains its SQL,
persistence and Data Protection identity. Public website Development is a separate
repository/service on Atlas port 5051; its publishing commands live in
/srv/repos/PlotDirector.Website/Docs/Publishing.md. Neither helper operates the
other service. Application root health now accepts the normal redirect to Projects;
public marketing smoke tests belong to the independent website. Production cutover
requires separate explicit approval and is not implied by Development qualification.
Unattended CYJ Development releases
Development deployment is a normal requirement for CYJ assignments reaching user acceptance. Implement, verify, commit, deploy, check running identity, perform the required live acceptance, then record the deployed commit, helper receipt, tests and feature URL in CYJ before completion. Larger projects may explicitly define later acceptance milestones. Production remains separately authorised.
The unattended Codex sandbox cannot invoke sudo: no_new_privs is intentional.
The long-lived controller also inherited groups predating the deployment-group
membership. Consequently task 52 could neither read the baseline nor write the
inbox. A fresh interactive deployer can use sg; doing so inside the sandbox cannot
overcome no_new_privs. Do not disable either protection or expose signing keys.
The controller now accepts bounded Development requests and calls a root-installed
snapshot of this existing development_release.py with --isolate-build.
That optional mode runs all publishing and regression processes in an unprivileged
namespace with only OS tools, source, scratch output and public NuGet packages.
Host home, signing material, controller/worker records, SQL/runtime configuration
and the inbox are absent. The normal interactive command remains supported.
Package preparation still uses release.prepare; its default Production path is
unchanged. Existing signing, schema qualification, locking, backup, activation,
health checks, rollback and receipts are retained. The orchestration now preserves
the original activation receipt alongside submission.json, including on failure.
Review/test and install the unprivileged snapshot with the administrator-only
Tools/Deployment/provision/install-unattended-release.sh. This does not alter the
privileged helper, sudoers or running application. The shared toolkit's
/home/nick/cyj-planner/DEPLOYMENT.md documents root-owned policy installation,
standing Development acceptance authority, exact task/commit approvals, worker
commands, service-level probes and recovery. The policy binds resource 7 to this
repository and application-development; workers submit no commands or paths.
Remove broad controller-state write grants before enabling the capability.
A successful request is only deployment evidence. Task 52 must still resume through Clara's normal assistance-response workflow, retain its prior effort, and perform its authenticated persistence/reload acceptance checks. Never manually complete it or resolve stage 53 to test the integration. Reconcile any existing receipt before requesting deployment again; uncertain attempts are not automatically repeated.
Development artifact retention (Atlas)
Successful activations now run Development-only housekeeping after releasing the
activation lock; housekeeping reacquires /opt/plotdirector-dev/deployment.lock
and refuses overlapping activation/cleanup. A concurrent activation safely skips
housekeeping with a warning. Failed and validation-only deployments do not prune.
Both the publisher and activation helper warn below 20% available storage.
Administrator commands (dry run is the default):
sudo -n /usr/local/sbin/housekeep-plotdirector-development
sudo -n /usr/local/sbin/housekeep-plotdirector-development --apply
The active release and three distinct most recent successfully activated previous
releases are protected using activation receipts and the current symlink/marker.
Older successful immutable installations lose only their runtime app payload;
manifests, SQL, qualification evidence and activation receipts remain. Named
rollback/restore packages and installations without successful receipts remain.
The retired /srv/apps/plotdirector-dev/releases publish artifacts and historical
current-before-* copies are pruned, keeping three newest valid installation
snapshots (including archive links). The legacy current, persistent data,
uploads, configuration and Data Protection paths must remain.
Only recognised published output is disposable. Source patches, repositories,
registered worktrees, evidence, unknown layouts, mounted content, process references
and recent content are preserved. /srv/tmp/plotdirector-dev-publish-* expires
after 48 hours; disposable /srv/repos/.plotdirector-builds/* after seven days,
measured against all descendant modification times. Other temporary/source paths
are deliberately outside automatic scope. Do not use historical ad hoc copy/rename
deployments; all activation must use the installed helper and its lock.
Pin additional packages using an exact absolute path in the root-owned
/etc/plotdirector-development/retention-protected.json paths array, or add a
.retain marker within an artifact. Pins take precedence over retention counts.
Housekeeping logs removed directories, allocated bytes by category and filesystem
available-space change. Unknown content is preserved for administrator review.
No Production hosts, backup retention, databases, or source worktrees are targeted.
Cleanup rechecks pins, processes, source/evidence, mounts, retention markers and
age immediately before each removal. Ancestor symlinks and same-device bind mounts
are rejected; removal uses directory descriptors without following symlinked
ancestors. Snapshot metadata must be regular files with valid runtime/dependency
JSON. Unreadable process protection or unavailable trusted Git inspection aborts
cleanup rather than guessing. Registered worktrees are inspected through Atlas's
root-owned /usr/local/lib/atlas-security/git_snapshot.py namespace reader; this is
an installation prerequisite. Pin configuration and its ancestors must be root-owned
and not group/world-writable. .protect markers are also recognised.
Source changes to development.py and retention.py require administrator install
into /usr/local/lib/plotdirector-dev-deployment. Initial provisioning includes the
retention module, administrator launcher and empty protected-path configuration;
existing installations must preserve their administrator pins. Install only reviewed
changed modules under the deployment lock. The installed publisher already has the
storage warning and additional Atlas security hardening: do not overwrite hardened
installed publisher/release modules from an older source snapshot. Reconcile those
security differences separately before any full reinstall. No new sudo rule is
needed for retention.