The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as GCP from "@alchemy.run/gcp"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { HttpServerRequest } from "effect/http/HttpServerRequest"; |
| 4 | import * as HttpServerResponse from "effect/http/HttpServerResponse"; |
| 5 | |
| 6 | /** |
| 7 | * Effect-native Cloud Run Service with an HTTP startup probe that starts |
| 8 | * after an nginx sidecar. Deployed from {@link ../Service.test.ts}. |
| 9 | */ |
| 10 | export default class SidecarService extends GCP.Run.Service<SidecarService>()( |
| 11 | "SidecarService", |
| 12 | { |
| 13 | main: import.meta.url, |
| 14 | location: "us-central1", |
| 15 | invokerIamDisabled: true, |
| 16 | template: { |
| 17 | containers: [ |
| 18 | { |
| 19 | startupProbe: { httpGet: { path: "/health" }, periodSeconds: 2, failureThreshold: 30 }, |
| 20 | dependsOn: ["sidecar"], |
| 21 | }, |
| 22 | { |
| 23 | name: "sidecar", |
| 24 | image: "docker.io/library/nginx:1.27-alpine", |
| 25 | startupProbe: { tcpSocket: { port: 80 }, periodSeconds: 2, failureThreshold: 30 }, |
| 26 | }, |
| 27 | ], |
| 28 | }, |
| 29 | }, |
| 30 | Effect.gen(function* () { |
| 31 | return { |
| 32 | fetch: Effect.gen(function* () { |
| 33 | const request = yield* HttpServerRequest; |
| 34 | if (request.url.startsWith("/health")) return HttpServerResponse.text("ok"); |
| 35 | return HttpServerResponse.text("hello"); |
| 36 | }), |
| 37 | }; |
| 38 | }), |
| 39 | ) {} |