@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
ts 43 lines 1.56 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import * as Effect from "effect/Effect";
3 import { httpApiHandlers, rpcHandlers } from "./handlers.ts";
4 import { TaskApi, TaskRpcs } from "./schema.ts";
5
6 // Every class here ships the same module; `handler` names the export each
7 // image runs.
8
9 /** Sidecar serving Effect RPC. */
10 export class RpcSidecar extends GCP.Run.Container<RpcSidecar>()(
11 "RpcSidecar",
12 { main: import.meta.url, handler: "RpcSidecar", port: 3000, startupProbe: { tcpSocket: {} } },
13 Effect.gen(function* () {
14 return { fetch: GCP.Run.ServeRpc(TaskRpcs, rpcHandlers("rpc sidecar")) };
15 }),
16 ) {}
17
18 /** Sidecar serving an HttpApi. */
19 export class ApiSidecar extends GCP.Run.Container<ApiSidecar>()(
20 "ApiSidecar",
21 { main: import.meta.url, handler: "ApiSidecar", port: 3001, startupProbe: { tcpSocket: {} } },
22 Effect.gen(function* () {
23 return { fetch: GCP.Run.ServeHttpApi(TaskApi, httpApiHandlers("api sidecar")) };
24 }),
25 ) {}
26
27 /** Private service serving Effect RPC. */
28 export class RpcBackend extends GCP.Run.Service<RpcBackend>()(
29 "RpcBackend",
30 { main: import.meta.url, handler: "RpcBackend", location: "us-central1" },
31 Effect.gen(function* () {
32 return { fetch: GCP.Run.ServeRpc(TaskRpcs, rpcHandlers("rpc service")) };
33 }),
34 ) {}
35
36 /** Private service serving an HttpApi. */
37 export class ApiBackend extends GCP.Run.Service<ApiBackend>()(
38 "ApiBackend",
39 { main: import.meta.url, handler: "ApiBackend", location: "us-central1" },
40 Effect.gen(function* () {
41 return { fetch: GCP.Run.ServeHttpApi(TaskApi, httpApiHandlers("api service")) };
42 }),
43 ) {}