@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.47 KB
Raw
1 ---
2 title: SolidStart
3 description: Deploy a SolidStart app to Cloud Run with GCP.Website.SolidStart — SSR in a container, prerendered pages served as static files.
4 sidebar:
5 order: 17
6 ---
7
8 import PackageManagers from "../../../../components/PackageManagers.astro";
9
10 export const devDeps = "@alchemy.run/frontend-frameworks";
11
12 `GCP.Website.SolidStart` deploys a [SolidStart](https://start.solidjs.com)
13 app to Cloud Run. The server renders pages in the container, and
14 prerendered pages are served as static files.
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.SolidStart("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.SolidStart("Website");
53 +export const Website = GCP.Website.SolidStart("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 ## Prerender routes
63
64 Alchemy adds the nitro plugin to your build, so nitro options go on
65 the `nitro` prop. Remove `nitroV2Plugin()` from `vite.config.*`:
66
67 ```typescript
68 export const Website = GCP.Website.SolidStart("Website", {
69 nitro: { prerender: { routes: ["/", "/about"] } },
70 });
71 ```
72
73 ## Tune Cloud Run
74
75 ```typescript
76 export const Website = GCP.Website.SolidStart("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#solidstart) — every prop.