Skip to content

Atomic prod deploy: release-dir + symlink swap to end in-place node_modules/.next churn#1703

Draft
pulzzejason wants to merge 1 commit into
mainfrom
goal/333d7ed7
Draft

Atomic prod deploy: release-dir + symlink swap to end in-place node_modules/.next churn#1703
pulzzejason wants to merge 1 commit into
mainfrom
goal/333d7ed7

Conversation

@pulzzejason

Copy link
Copy Markdown
Contributor

Integration PR for this goal — its tasks commit onto this branch (one PR per goal). Opened automatically by the engine on first push; left as a draft until the goal completes.

…otstrap

On-box, Capistrano-style release construction for the self-hosted PM2 VPS
(root@DEPLOY_HOST, /opt/product-manager). Foundational unit for moving off
the in-place mutation of /opt/product-manager/app; the deploy.yml wiring task
depends on it.

Subcommands (idempotent), so CI can SCP prebuilt artifacts BETWEEN steps:
- bootstrap: create releases/ + shared/, migrate app/.env.local into
  shared/.env.local once (copy if absent); re-running is a no-op.
- prepare <id> [ref]: build releases/<id> as a detached git worktree at the
  target SHA (its own prisma/, migrations, src/) reusing app/.git (or a shared
  clone) as source of truth, symlink shared/.env.local in, and print the
  release dir path on stdout as the SCP target (git chatter kept off stdout).
- migrate <id>: from the release dir, source shared/.env.local and run
  prisma migrate deploy + the schema-drift check BEFORE any swap. Drift WARN
  mode by default (DRIFT_GATE_BLOCK=true to fail); a check ERROR never blocks.
- prune [keep] [id]: keep the newest N (default 5); never remove the deploy
  target or the currently-live (current-linked) release; unregisters worktree
  metadata.

Nothing runs from a fresh release dir, so SCPing node_modules/ never hits the
"Text file busy" problem — no worker prestop. Deliberately does NOT flip the
`current` symlink or touch PM2 (kept in the dedicated wiring task) so this
stays independently reviewable. set -euo pipefail, shellcheck-clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant