The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { defineScene } from "../capture/scene.ts"; |
| 2 | |
| 3 | export default defineScene({ |
| 4 | title: "Ship it", |
| 5 | chapter: "08-dashboard", |
| 6 | notes: |
| 7 | "The service is built and tested. Now, and only now, deploy it: one command stands up the whole architecture as a new stage.", |
| 8 | async run(s) { |
| 9 | s.step( |
| 10 | "Deploy to production with alchemy deploy", |
| 11 | "Everything so far ran under alchemy dev and in throwaway test stages. alchemy deploy --stage prod plans the whole Stack for a new stage, asks to confirm, and applies it.", |
| 12 | ); |
| 13 | const url = await s.terminal(async (t) => { |
| 14 | await t.type("deploy", "alchemy deploy --stage prod"); |
| 15 | await t.waitFor("deploy", /Deploy\?/, { timeout: 180_000 }); |
| 16 | await t.sleep(1500); |
| 17 | await t.key("deploy", "Enter"); |
| 18 | const text = await t.waitFor("deploy", /Stack deployed[\s\S]*❯\s*$/, { timeout: 600_000 }); |
| 19 | await t.sleep(1500); |
| 20 | const found = text.match(/https:\/\/shorty-web-[a-z0-9-]+\.[a-z0-9-]+\.workers\.dev/)?.[0]; |
| 21 | if (!found) throw new Error("deployed web URL not found in the terminal output"); |
| 22 | return found; |
| 23 | }); |
| 24 | |
| 25 | s.step( |
| 26 | "The same architecture, now in the cloud", |
| 27 | "Every resource from the talk, now really deployed to the prod stage.", |
| 28 | ); |
| 29 | await s.diagram({ |
| 30 | stage: "prod", |
| 31 | nodes: ["Web", "Api", "LinkRoom", "Clicks", "Postgres", "Dashboard"], |
| 32 | }); |
| 33 | s.pause(1.5); |
| 34 | |
| 35 | s.step("Shorty is live"); |
| 36 | await s.browser.open(url, { waitFor: /Your links/ }); |
| 37 | s.pause(0.5); |
| 38 | s.step("Shorten a link in production"); |
| 39 | await s.browser.fill("form input", "https://alchemy.run"); |
| 40 | await s.browser.click("form button", { waitFor: /alchemy\.run/ }); |
| 41 | s.pause(1.5); |
| 42 | }, |
| 43 | }); |