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

main
ts 44 lines 1.41 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import * as Effect from "effect/Effect";
3 import { serveProbes } from "../../bindingHost.ts";
4 import { CAPACITY_REGION, CAPACITY_ZONE } from "../../zones.ts";
5
6 /** BASIC_HDD instance: draws on the standard-storage quota and supports backups. */
7 export const Nfs = GCP.Filestore.Instance("Nfs", {
8 location: CAPACITY_ZONE,
9 tier: "BASIC_HDD",
10 fileShares: [{ name: "share1", capacityGb: 1024 }],
11 });
12
13 export const Nightly = Effect.gen(function* () {
14 const instance = yield* Nfs;
15 return yield* GCP.Filestore.Backup("Nightly", {
16 sourceInstance: instance.name,
17 sourceFileShare: "share1",
18 location: CAPACITY_REGION,
19 });
20 });
21
22 /**
23 * Effect-native Cloud Run service exercising the instance and backup
24 * bindings as its own runtime service account. Deployed from
25 * {@link ../Bindings.test.ts}.
26 */
27 export default class FilestoreBindingsHost extends GCP.Function<FilestoreBindingsHost>()(
28 "FilestoreBindingsHost",
29 { main: import.meta.url, invokerIamDisabled: true },
30 Effect.gen(function* () {
31 const getInstance = yield* GCP.Filestore.GetInstance(yield* Nfs);
32 const getBackup = yield* GCP.Filestore.GetBackup(yield* Nightly);
33
34 return {
35 fetch: serveProbes({
36 getInstance: getInstance(),
37 getBackup: getBackup(),
38 }),
39 };
40 }).pipe(
41 Effect.provide(GCP.Filestore.GetInstanceHttp),
42 Effect.provide(GCP.Filestore.GetBackupHttp),
43 ),
44 ) {}