The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 94 lines 4 KB
Raw
1 ---
2 title: deploy
3 description: Compute a plan, ask for approval, and create/update/delete resources to match the desired state.
4 ---
5
6 import Terminal from "../../../components/Terminal.astro";
7
8 ```sh
9 alchemy deploy [options]
10 ```
11
12 `deploy` computes a plan, asks for approval, and creates/updates/deletes resources to match the desired state.
13
14 <Terminal content={`[u]Plan[/u]: [g]2 to create[/g]
15
16 [g]+[/g] [b]Bucket[/b] [d](Cloudflare.R2.Bucket)[/d]
17 [g]+[/g] [b]Worker[/b] [d](Cloudflare.Worker)[/d] [c](1 bindings)[/c]
18 [s2][g]+[/g] [c]Bucket[/c]
19
20 Proceed?
21 ◉ Yes ○ No
22 [g]✓[/g] [b]Bucket[/b] [d](Cloudflare.R2.Bucket)[/d] [g]created[/g]
23 [g]✓[/g] [b]Worker[/b] [d](Cloudflare.Worker)[/d] [g]created[/g]
24 [s2][d]• Uploading worker (14.20 KB) ...[/d]
25 [s2][d]• Enabling workers.dev subdomain...[/d]
26 {
27 [s2]url: "https://myapp-worker-dev-you-abc123.workers.dev",
28 }`} />
29
30 On subsequent deploys, only changed resources are updated:
31
32 <Terminal content={`[u]Plan[/u]: [y]1 to update[/y]
33
34 [y]~[/y] [b]Worker[/b] [d](Cloudflare.Worker)[/d]
35
36 Proceed?
37 ◉ Yes ○ No
38 [g]✓[/g] [b]Worker[/b] [d](Cloudflare.Worker)[/d] [y]updated[/y]
39 [s2][d]• Uploading worker (15.10 KB) ...[/d]
40 {
41 [s2]url: "https://myapp-worker-dev-you-abc123.workers.dev",
42 }`} />
43
44 When the plan contains no changes, the approval prompt is skipped automatically.
45
46 ## Flags
47
48 | Option | Description |
49 | ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
50 | `--config, -c <file>` | Stack file to deploy (defaults to `alchemy.run.ts`) |
51 | `--stage <name>` | Stage to deploy to (defaults to `$ALCHEMY_STAGE` or `live_$USER`) |
52 | `--yes` | Skip the approval prompt |
53 | `--dry-run` | Show the plan without applying (same as `alchemy plan`) |
54 | `--detailed` | Show declared resource properties as YAML |
55 | `--force` | Force updates for resources that would otherwise no-op |
56 | `--adopt` | Adopt pre-existing cloud resources that conflict with this stack instead of failing. Useful for re-importing into a fresh state store. |
57 | `--profile <name>` | Auth profile to use (defaults to `$ALCHEMY_PROFILE` or `default`) |
58 | `--env-file <path>` | Load environment variables from a file |
59
60 How `--adopt` decides what to take over is covered in [Adopting Resources](/cli/adopting-resources).
61
62 `--dry-run` runs the exact same code path as [`alchemy plan`](/cli/plan) — see that page for the plan output format.
63
64 `--detailed` adds the YAML property view to the approval prompt, `--yes`
65 deploys, and `--dry-run` previews.
66
67 ## Examples
68
69 ```sh
70 # Deploy to production, skip the prompt
71 alchemy deploy --stage prod --yes
72
73 # Deploy a PR preview environment
74 alchemy deploy --stage pr-42
75
76 # Deploy a different stack file
77 alchemy deploy --config stacks/github.ts
78
79 # Preview what would change
80 alchemy deploy --dry-run
81
82 # Review declared inputs as YAML before applying
83 alchemy deploy --detailed
84
85 # Re-import existing cloud resources into a fresh state store
86 alchemy deploy --adopt
87 ```
88
89 ## Where next
90
91 - [plan](/cli/plan) — preview changes without applying
92 - [destroy](/cli/destroy) — delete everything in a stack
93 - [Adopting Resources](/cli/adopting-resources) — take over pre-existing infrastructure
94 - [Resource Lifecycle](/infrastructure-as-code/resource-lifecycle) — what happens inside a deploy