PlotDirector/Docs/Codex/Deployment.md

4.3 KiB

PlotDirector Development Deployment

The authoritative release/package and migration-history contract is now Production deployment standard, implemented under Tools/Deployment. The environment details below describe the existing Development layout; conversion of its physical current directory is an explicit provisioning operation. Use the same manifest, checksums, SQL worker, history and health gates for Development/Test; do not return to untracked manual SQL on later deployments. The root activation entry point has a production target profile and must not be pointed at Development by replacing credentials alone.

Read this document only when deployment or detailed development-service operation is part of the task.

Current Production

Production is live on web1 (85.190.124.132) at https://plotdirector.com/. Use the restricted manifest-driven helper, never the legacy www helper. See the operational standard and actual installation/acceptance and worker holds. www is an inactive recovery fallback.

Environment

  • Development host: Atlas.
  • Repository: /srv/repos/PlotDirector.
  • Development files: /srv/apps/plotdirector-dev/current.
  • Release archive: /srv/apps/plotdirector-dev/releases/.
  • Service: plotdirector-dev.
  • Service user: plotdirector:plotdirector.
  • Environment file: /etc/plotdirector/plotdirector.env.
  • Persistent uploads: /srv/apps/plotdirector-dev/uploads.
  • Default deployed data-protection keys: /srv/apps/plotdirector-dev/App_Data/DataProtectionKeys.
  • Local endpoint: http://127.0.0.1:5050.
  • Public development endpoint: https://dev.plotdirector.com/.

current is a physical directory, not a symlink.

Use sudo -n for protected service/configuration paths where appropriate.

Before Deployment

Confirm the intended commit:

git status --short --branch
git log -1 --oneline

If the change involves database migration, qualify an explicit manifest and let the worker back up, verify and apply it before activating dependent code; do not bypass migration history with manual SQL.

Before stopping the service, confirm there is no active import, Story Intelligence run, synthesis or character enrichment work. Check queued and processing work as well as core imports.

Do not deploy while such work is active unless interruption has explicitly been accepted.

Publish

Use a fresh temporary publish directory. Set fail-fast shell behaviour and derive a release name from the short commit SHA and UTC timestamp.

Publish with:

dotnet publish PlotLine/PlotLine.csproj -c Release -o "$publish_dir"

The standard paths are:

release_dir="/srv/apps/plotdirector-dev/releases/$release"
backup_dir="/srv/apps/plotdirector-dev/current-before-$release"

Install

Copy the fresh publish into the release archive and ensure ownership is plotdirector:plotdirector.

Stop plotdirector-dev before replacing the physical live directory.

Back up the existing current directory to the timestamped current-before path.

Use rsync -a --delete from the release directory into current, preserving:

  • appsettings*.json
  • .env*
  • App_Data/
  • wwwroot/uploads/
  • uploads/
  • logs/
  • Logs/

Restore plotdirector:plotdirector ownership and start plotdirector-dev.

If installation or startup fails, stop and diagnose. Do not continue blindly or claim successful deployment.

An application rollback does not undo SQL migrations and must remain compatible with the migrated schema.

Verification

Verify:

  • systemctl is-active plotdirector-dev
  • service status and recent warning/error logs;
  • local GET to http://127.0.0.1:5050/;
  • public HTTPS GET to https://dev.plotdirector.com/;
  • deployed PlotLine.dll metadata;
  • SHA-256 of published and deployed PlotLine.dll;
  • the changed authenticated route when applicable.

Timestamps alone do not prove the intended build is running.

Use a real GET for public smoke testing. HEAD may return 405.

Normal verification must validate TLS. Use -k only for certificate diagnosis.

Review configuration changes separately because deployment preserves deployed appsettings files.

Keep the release directory and current-before backup named with the deployed short SHA and UTC timestamp for traceability.