On this page

Defined in cli/commands/stage.ts. create and remove manage this machine's own AWS stage in the dev account, named after the machine and recorded in its secrets bundle. Setup's stage step runs create for you; Your AWS stage explains what it is. env is different: it manages the deploy configuration of the two shared stages, dev and prod.

ds stage create#

ds stage create --member <wt1|wt2> [--stage <name>] [--refresh] [--session <name>] [--profile <profile>] [--region <region>] [--dry-run]

Makes the stage, or finishes making it: a Neon database branch stage-<stage> from golden-data (with the team's NEON_API_KEY), the stage's keys in the machine bundle, its config, its first deploy (sst dev, run from the pool checkout you hold, which must be clean), migrations, the demo logins and today's dates. Run again, it picks up where it stopped and never rebuilds a finished stage.

With --refresh it brings a finished stage current with the held checkout's code: it starts sst dev once, which deploys whatever stacks changed since (and nothing when none did), then applies new migrations, re-creates the demo logins, moves the demo dates to today, and stops sst dev. It never runs sst deploy. ./setup runs it for you when the stage's database is behind develop's migrations.

Flag Description
--member <wt1|wt2> The pool checkout you hold, where the deploy runs
--stage <name> The stage name. Default: the one the machine bundle records, else the machine's name. Name a stage made by hand to adopt it
--refresh Bring a finished stage current: deploy any stack that changed (sst dev), apply new migrations, remake the demo logins, move the demo dates to today
--session <name> Who holds that checkout. Default: DEVSTRIDE_SESSION
--profile <profile> The dev-account profile. Default: the bundle's DEVSTRIDE_DEV_PROFILE, else this shell's
--region <region> Default us-east-1
--dry-run Say what it would do; change nothing

ds stage remove#

ds stage remove [--machine <name>] [--profile <profile>] [--region <region>] [--dry-run]

Removes this machine's stage, or with --machine a retired machine's: its stacks, its config, its Neon branch, the stage's keys in that machine's bundle, and its signing key in AWS (the sign-in stack's KMS key, which that stack keeps when it is deleted). AWS holds a deleted key for 30 days, during which it can be restored, and then deletes it; the dry run names the key. Permanent: the stage's data and sign-in users go with it. A person retypes the stage name to confirm; no flag skips that, and an agent's session is refused. It also refuses while a checkout on this machine is running against the stage (ds pool cloud).

The stacks go first, by sst remove, in up to three passes: CloudFormation refuses to delete a stack while another stack still uses what it shares (the API stack while the workflow stack uses it, say), so one pass can leave some behind, and the next pass finds them free. The run keeps going while each pass removes at least one stack. A successful run ends with The stage <name> is removed. If stacks remain, it ends with one line, NOT removed: the stage <name> still has N stack(s): …, naming each stack, its status and CloudFormation's reason, deletes nothing else, and exits non-zero; run the same command again.

ds stage env#

ds stage env list <dev|prod>
pbpaste | ds stage env set <dev|prod> <KEY>
ds stage env diff <dev|prod>
ds stage env seed-from-blob <dev|prod> [--replace]
ds stage env guard <dev|prod> [--allow-db-host-change]

A shared stage's deploy configuration, stored in that stage's own AWS account as one Secrets Manager secret, devstride/<stage>/stage-env (I14094). It holds every key set-config packs into DEVSTRIDE_CONFIG plus the keys the build reads itself, so the GitHub Actions deploy workflows read it with their deploy role and GitHub holds no application secret. Only dev and prod have a store; a personal stage keeps its config in the machine's .env. Each subcommand takes --profile <name> for that stage's account, defaulting to the account's usual profile.

Subcommand What it does
list The stored keys, never their values
set Sets one key from standard input (never an argument) and reads it back
diff Compares the store with the live DEVSTRIDE_CONFIG and the build's key list; exit 1 on drift
seed-from-blob The one-time import: copies every field of the stage's live DEVSTRIDE_CONFIG into the store. --replace overwrites keys the store already holds
guard Run before a deploy: refuses a store that names another stage or points at a different database host than the live config, unless --allow-db-host-change marks a deliberate move
export GitHub Actions only: puts every stored key into the job's environment, each value masked

Changing a shared stage's configuration this way is an owner or admin step; a developer's own stage never needs it.


Powered by DevStride