@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 89 lines 2.18 KB
Raw
1 ---
2 title: Octane
3 description: Deploy an OctaneJS app to Cloud Run with GCP.Website.Octane.
4 sidebar:
5 order: 20
6 ---
7
8 import PackageManagers from "../../../../components/PackageManagers.astro";
9
10 export const devDeps = "@alchemy.run/frontend-frameworks";
11
12 `GCP.Website.Octane` deploys an [OctaneJS](https://octanejs.dev) app
13 to Cloud Run. Octane's server runs in the container, and static assets
14 are served from the same image.
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.Octane("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.Octane("Website");
53 +export const Website = GCP.Website.Octane("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 Octane
63
64 Keep compiler and route settings in `octane.config.ts`. You don't need
65 an adapter.
66
67 ## Tune Cloud Run
68
69 ```typescript
70 export const Website = GCP.Website.Octane("Website", {
71 scaling: { minInstanceCount: 1 },
72 resources: { limits: { cpu: "1", memory: "1Gi" } },
73 });
74 ```
75
76 One warm instance means no cold start for the first visitor. See
77 [Websites](/gcp/frontend/websites#tune-cloud-run) for the other
78 settings.
79
80 ## Local development
81
82 `alchemy dev` runs the framework's dev server with hot reload and
83 creates nothing in the cloud. Wrap the site in `Alchemy.remote()` to
84 deploy it for real during dev.
85
86 ## Where next
87
88 - [Websites](/gcp/frontend/websites) — the settings every site shares.
89 - [Website reference](/providers/gcp/website#octane) — every prop.