Skip to content

Part 5: Ship to Production

So far every deploy went to your own stage. A stage is a separate copy of the whole Stack: its own App, bucket and database.

Terminal window
pnpm alchemy deploy --stage staging

Each stage gets its own resources, with the stage in their generated names. alchemy deploy without --stage keeps deploying to yours.

A stage decides what you deploy; the profile’s token decides which team it goes to. Create a team for production in the control panel, a token for it, and a profile that holds that token:

Terminal window
pnpm alchemy profile create prod
pnpm alchemy profile edit --profile prod --add DigitalOcean
Terminal window
pnpm alchemy deploy --stage prod --profile prod

Production now has its own team: its own members, its own Container Registry and its own bill.

Alchemy.localState() keeps Alchemy’s record on your machine, so nobody else can deploy the Stack. Before a teammate or CI deploys, move it to a shared store, like Cloudflare.state() or AWS.state(). See State Store.

With CI=true, Alchemy skips profiles and reads the token from the DIGITALOCEAN_TOKEN environment variable. Store the production team’s token as a CI secret, expose it under that name, and run alchemy deploy --stage prod. See CI.

Terminal window
pnpm alchemy destroy --stage staging

destroy deletes everything the stage created: the App, its image repository, the bucket and the database cluster. Run it for each stage you’re done with, and for your own when you finish this tutorial.