PlotDirector/Docs/Deployment/Phase1-20261125.md

16 KiB
Raw Blame History

Production migration Phase 1 — 25 November 2026

Status: Phase 1 qualification passed; ready for separately authorised Phase 2 provisioning. No Production deployment authorised or performed. See the final result and linked evidence below. A draft plan or prototype rehearsal is not release approval.

Source and installed Development baseline

Repository HEAD at discovery was 643f28c4f99c72056b5a66a54398a0c7edd4847b, an evidence-only descendant of implementation f3c3683bc24674914b5d52499efa9b8e743615a5. Current Development DLL and archive character-overview-f3c3683b-20261123T223506Z both hash to 0659e7aa4988516e3955ba33b120330cb039cdd154c2413a059fd6cab5195e27. No newer installed build was found. Historical regression evidence reports 816 application checks, authenticated browser acceptance and provenance preservation.

Implementation is on an isolated worktree/branch so the pre-existing untracked canonical-manuscript assessment and Context workspace audit are preserved. The qualified candidate must include this phase's tooling, migrations 318/319/321/322 and deployment-only application changes, built from its own clean commit.

Independently verified web1 inventory

Strict SSH used the supplied dedicated identity and recorded ED25519 fingerprint. Administrator currently has passwordless administrative sudo. No remote changes were made. OS is Ubuntu 24.04.5 LTS. Both .NET/ASP.NET Core runtimes are 10.0.15; no SDK is listed. Approximately 21 GiB RAM was available, with 4 GiB swap and 555 GiB free on the root volume at inspection.

Native SQL Server reports 17.0.5065.9, Express Edition. It binds loopback 1433; configuration limits memory to 4096 MiB, disables SQL Agent and sets backup directory /srv/backups/sql. PlotLine is ONLINE, compatibility 170, SIMPLE recovery, owned by sa; data/log allocations are 200/264 MiB. The backup service's SQL principal has db_backupoperator. Its metadata visibility is limited: a complete live login/user and permissions inventory still requires a SQL security administrator or appropriate VIEW DEFINITION/server-security visibility. Do not infer absence of an application login/user from that restricted view. The recovered backup contains PlotLineApp as an orphaned user on Atlas, as expected for a restore to another server.

The hourly sql-backup.timer invokes a root-owned 0750 script with a root-protected credentials file; it backs up both PlotLine and CatherineLynwood with CHECKSUM to new timestamped 0600 files. It is not changed by the new deployment tooling. Existing backups, including the original recovered media, were not overwritten.

catherinelynwood.service, Nginx, SQL Server and Fail2ban were active. Catherine runs as catherinelynwood from /srv/catherinelynwood/current on 127.0.0.1:5002 with its own environment file, enabled virtual host and certificate. Ports 5001/5003 were free. UFW allows SSH/HTTP/HTTPS; SQL is not publicly listening. PlotDirector has no enabled virtual host, certificate or loaded application service yet. Fontconfig, FreeType, ICU 74 and libstdc++ are present; final native-library loading on web1 remains a Phase 2 smoke check.

Existing PlotDirector layout differs from the protected target: root/release directories are administrator-owned; shared uploads and key directories exist; logs are currently top-level; /etc/plotdirector is empty. The runtime account exists; deployment/migration accounts do not. The planned helper deliberately refuses this unprovisioned state. No ownership, accounts or services were changed.

Recovered private archives in /home/administrator contain uploads and the old environment file, service definition and two Data Protection key files. The config archive does not include appsettings.json. Shared configuration must be reconciled with the old effective configuration during provisioning. /srv/backups/{websites, configuration} existed but contained no files at inspection.

Atlas's default SSH include /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf is root-owned mode 0777, causing OpenSSH's ownership/permissions refusal. -F /dev/null avoids it. No system-wide SSH configuration was modified.

Old Production and recovered baseline

www remains inactive and unchanged. Installed helper and DLL still match the November archived hashes; release commit is 5d2e080539c10c3a2c6aed5c18c169abc8a55e77. The installed November helper, not the September README, informed preservation, active-work, backup, failure and SQL rules.

Original recovered media: web1:/srv/backups/sql/PlotLine-20261124.bak, 198261248 bytes, SHA-256 6cf9e6d4d340a222a48c43265582e45a0150b132ae6eeb2bb6cd112f97cb743c. It was read over SSH into mode-0700 private Atlas storage, with matching source and local checksums. It passed VERIFYONLY and actual isolated restores to the existing Atlas SQL Server 2025 container (17.0.4006.2 Developer Edition). Production data was never used as a live migration test target.

There is no existing migration/release ledger in the restored copy. The original schema has 163 tables and 659 modules. Historical comparison found 642 literal module matches, eight comment-only differences, one migration-160 dynamic patch and one trigger deliberately removed by 125. Eight additional modules are SSMS diagram support, retained without inventing PlotDirector migration identities. The stored active Problem Solver graph exactly matches the archived non-numeric publication script's UTF-16 SHA-256. Historical scripts before 208 are unchanged between 5d2e080 and the selected source baseline.

Baseline evidence distinguishes a verified cumulative final-state baseline from proof that an individual historical script executed. Baseline UTC is the actual verification time. The explicit ordered plan records individual identities/checksums, dependencies, baseline evidence, prerequisites and postconditions.

Important ordering/classification decisions:

  • 253 → 255 → 254 → 256, as documented in the geography implementation report. The first exploratory numeric rehearsal demonstrated the 254 truncation and a complete rollback of that script/history record. No automatic retry was made.
  • 301/302/303 are superseded by the standalone complete 304 definition; 302 also contains a known syntax error. Their files are preserved, never rewritten.
  • 286 refreshes Development reset procedures and is inapplicable to Production. Old reset definitions remain untouched; no reset procedure is executed.
  • 318 bootstraps history; 319 supplies local SQL health and 322 verifies the actual runtime permissions. Standalone 321 supplies the scoped runtime role, a bounded owner-context restore operation, and effective permission assertions. Isolated prototype 320 is retained but superseded because its DENY CONTROL also denied required EXECUTE/metadata. None changes business rows.
  • SQL performance/inline-SQL improvements are carried by 283–285, 287–289 and later included migrations. No blanket index maintenance or speculative tuning is added.

Architecture and qualification evidence

See the operational standard and Tools/Deployment for release preparation, Ed25519 authorisation, restricted transfer, root-owned activation, transactional history, versioned installation, atomic switching, health, evidence and rollback. Provisioning examples are prepared but not installed on web1.

Exploratory fresh-copy upgrades established the migration sequence, exact original business-data preservation and reproducible schema. Those rehearsals are not the final clean-commit qualification. Private data fingerprints cover all original columns, IDs, content, revision/synchronisation metadata and asset references in all 163 tables (139554 rows). New columns are excluded from old-column comparison so defaults cannot hide a change to existing data. No row content is published.

Actual SQL failure checks verify replay prevention, changed historical checksum, incorrect baseline, missing prerequisite and competing-session lock rejection. Filesystem/service-boundary tests cover package/signature/path/link integrity, space, backup verification, migration failure, installation permissions, HTTP failure and failed history recording. Service operations in these failure tests are mocked; they do not qualify web1's uninstalled service or Nginx configuration.

The final test-only host requires an isolated SQL database/login, a private request token and loopback binding; it verifies the actual application DLL hash. All app background services and external HTTP clients are disabled. Real SMTP, Stripe and OpenAI credentials are absent. Clone-only test authentication is in the test tool, not the deployed web application. Read-only clone requests supplement existing authentication/browser regression evidence; they are not a claim of physical Word or external-payment/email acceptance.

Application changes are limited to stable configurable Data Protection identity, trusted-loopback forwarded headers and the loopback deployment health endpoint. The health endpoint returns only binary/database identity and fails closed without leaking connection/SQL diagnostics. Existing Writer/Context/Companion functionality is retained. Synthetic key-ring tests establish the content-root discriminator and cross-root explicit identity behaviour; no real historical cookie is claimed valid.

Remaining gates before Production

The final results below establish a clean-commit signed candidate, two complete fresh-copy upgrades and matching regression/HTTP/failure evidence. Phase 2 must still provision accounts, trust, ownership, SQL permissions/mappings, shared data/secrets, service and independent TLS/vhost, verifies the live starting fingerprint, and obtains explicit activation authority.

Actual web1 login permissions, its initial service, certificate, public HTTPS, Catherine coexistence after later configuration changes, physical Windows Word behaviour and real-cookie continuity remain deployment/cutover checks. Production configuration, databases, files, services, firewall and DNS remain unchanged.

Development adoption adds the same history mechanism after a verified backup and an isolated clone rehearsal. Historical entries are final-state baselines, not invented original executions. The installed f3c3683b application is preserved; successful historical activation rows are not fabricated. Runtime permission deprivileging passed the actual export/restore round-trip (rolled back) and was adopted atomically. Development remains active at PID 7065 with its original f3c3683b DLL; local/public GETs returned 200, and runtime SQL health reports ledger-ready/restricted. No historical successful-activation row was fabricated.

Final Phase 1 result

READY for separately authorised Phase 2 provisioning; no Production deployment has been performed. The qualified source is clean commit 190c074d5202fdf8a94b3b7a70c94857f848aafd, application version 1.0.0. It descends from the current Development source/evidence baseline and contains this phase's deployment architecture. Subsequent report/evidence commits do not change the qualified application. Development still runs the original f3c3683b binary.

Machine-readable evidence, two fresh upgrades and package identity bind the source, application DLL, original backup and exact starting/resulting schema. The immutable signed candidate is retained privately on Atlas at /home/nick/plotdirector-phase1-20261125/plotdirector-production-190c074d-20261125/. Its signing key is outside Git in protected local storage. This is a Phase 1 candidate authority, not an installed or pre-approved Production trust anchor. Verify the public-key fingerprint independently before any Phase 2 trust decision.

Final qualification passed:

  • 817 application checks, 332 native companion checks and 33 deployment-tool tests.
  • Two independent original-backup restores and full manifest upgrades: 210 verified final-state baseline entries plus 110 executed migrations, 320 total. Five scripts are explicitly omitted; no directory-wide replay or numeric high-water assumption.
  • All 163 original tables / 139554 rows preserved across every original column; resulting schema identical on both runs. CHECKDB and referential checks passed. Post-functional fingerprints also match after browser/export/restore testing.
  • 80 real read requests across ten recovered books returned 200; all 30 recovered upload files served with identical bytes. Writer/Context tabs, independent windows, Hold/Follow and mobile overflow checks passed with no browser page errors.
  • Actual runtime export/encoding/SQL restore passed and rolled back, under the restricted role. The recovered account first correctly hit expired-entitlement error 51046. A temporary clone-only entitlement override enabled this test and was removed in finally; original subscription rows were never changed. The guard was neither disabled nor relaxed. See restore evidence.
  • Completed-manifest replay left all 320 history records unchanged; modified historical checksum, wrong baseline, missing prerequisite and competing SQL lock were rejected. A read-only SQL login failed backup with SQL_262 and no success row.
  • Actual Test success history recorded healthy activation, code-only repeated activation and Rollback with predecessor links; duplicate deployment ID was rejected. These use identical qualified binaries. Filesystem/service switching and failure handling were tested with mocks; web1 service, Nginx and cross-version binary rollback remain Phase 2 acceptance.

No unresolved migration classification remains in the selected manifest. The repository preparation plan intentionally remains qualification-pending: release preparation must explicitly supply matching passed evidence, rather than treating an editable plan as authority. The signed candidate carries the passed evidence. Do not edit its contents or reuse its release ID for different bytes.

Remaining prerequisites are operational: full SQL security visibility/SID mapping, reviewed restricted accounts and root-owned helper/trust installation, permission verification, complete effective configuration (the recovered archive lacks appsettings.json), persistent assets/keys and stable Data Protection identity, independent service/vhost/certificate and live starting-schema confirmation. Exact ownership, role and verification instructions are in the Phase 2 procedure. The migration SQL account requires PlotLine-only db_owner plus CREATE ANY DATABASE for VERIFYONLY; this sensitive server permission is explicit, not sysadmin or permission in CatherineLynwood. /srv on Atlas has only about 1.8 GiB free; packages and recovered data were kept on /home/nick and /sql instead.

Recovered secret names and paths, never values: the old effective configuration is /var/www/plotdirector/appsettings.json plus /etc/plotdirector/plotdirector.env; configuration groups include ConnectionStrings:DefaultConnection, EmailSettings, Stripe, OpenAI, StoryIntelligence, Storage, Site, Admin, Logging and feature/worker flags. External dependencies include SQL Server, SMTP, Stripe, OpenAI, geocoding/map/image services and Word/Windows Companion clients; qualification disabled external HTTP/email/payment/AI/background activity. Production shared configuration belongs under /etc/plotdirector; uploads, keys and logs belong under /srv/plotdirector/shared. Historical keys are not proof of cookie compatibility.

Final read-only checks found Catherine active at its original PID 13134, Nginx and SQL active, no PlotDirector current link or installed unit on web1, www inactive at PID 0, and Development still active at original PID 7065. No Production changes, recovery-backup overwrites, DNS changes or temporary administrator-key removals were performed. Temporary local qualification hosts/logins are stopped/disabled at completion; private databases, evidence and all recovery backups are retained.