@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
mdx 95 lines 2.33 KB
Raw
1 ---
2 title: Waku
3 description: Deploy a Waku (React Server Components) app to Cloud Run with GCP.Website.Waku.
4 sidebar:
5 order: 18
6 ---
7
8 import PackageManagers from "../../../../components/PackageManagers.astro";
9
10 export const devDeps = "@alchemy.run/frontend-frameworks";
11
12 `GCP.Website.Waku` deploys a [Waku](https://waku.gg) app to Cloud Run.
13 The React Server Components server runs in the container. Static pages
14 are served without their extension (`/about`).
15
16 ## Install
17
18 The build integration ships separately. It only runs at deploy time,
19 so a dev dependency is enough:
20
21 <PackageManagers dev={devDeps} />
22
23 Docker has to be running when you deploy. The image is built on your
24 machine.
25
26 ## Deploy the site
27
28 ```typescript
29 // alchemy.run.ts
30 import * as Alchemy from "alchemy";
31 import * as GCP from "@alchemy.run/gcp";
32 import * as Effect from "effect/Effect";
33
34 export const Website = GCP.Website.Waku("Website");
35
36 export default Alchemy.Stack(
37 "MySite",
38 { providers: GCP.providers(), state: GCP.state() },
39 Effect.gen(function* () {
40 const site = yield* Website;
41 return { url: site.url };
42 }),
43 );
44 ```
45
46 Run `alchemy deploy`. `site.url` is the Cloud Run service URL.
47
48 ## Pass environment variables
49
50 ```diff lang="typescript"
51 // alchemy.run.ts
52 -export const Website = GCP.Website.Waku("Website");
53 +export const Website = GCP.Website.Waku("Website", {
54 + env: {
55 + GREETING: "Hello from Cloud Run!",
56 + },
57 +});
58 ```
59
60 Server code reads the value from `process.env.GREETING`.
61
62 ## Configure Waku
63
64 Your `waku.config.*` loads as-is. The `waku` prop overrides `srcDir`,
65 `distDir`, or `basePath` for a deploy:
66
67 ```typescript
68 export const Website = GCP.Website.Waku("Website", {
69 waku: { basePath: "/app/" },
70 });
71 ```
72
73 ## Tune Cloud Run
74
75 ```typescript
76 export const Website = GCP.Website.Waku("Website", {
77 scaling: { minInstanceCount: 1 },
78 resources: { limits: { cpu: "1", memory: "1Gi" } },
79 });
80 ```
81
82 One warm instance means no cold start for the first visitor. See
83 [Websites](/gcp/frontend/websites#tune-cloud-run) for the other
84 settings.
85
86 ## Local development
87
88 `alchemy dev` runs the framework's dev server with hot reload and
89 creates nothing in the cloud. Wrap the site in `Alchemy.remote()` to
90 deploy it for real during dev.
91
92 ## Where next
93
94 - [Websites](/gcp/frontend/websites) — the settings every site shares.
95 - [Website reference](/providers/gcp/website#waku) — every prop.