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

main
ts 30 lines 1.05 KB
Raw
1 import * as Docker from "@alchemy.run/docker";
2 import * as Effect from "effect/Effect";
3 import { HttpServerRequest } from "effect/http/HttpServerRequest";
4 import * as HttpServerResponse from "effect/http/HttpServerResponse";
5 import { SERVICE_EXTERNAL_PORT } from "./service.ts";
6
7 /**
8 * A code change to `./service.ts`: same logical id and props, different
9 * program, so redeploying it rolls the existing service onto a new
10 * content-addressed image.
11 */
12 export default class TestServiceV2 extends Docker.Service<TestServiceV2>()(
13 "DockerPlatformService",
14 {
15 main: import.meta.filename,
16 port: 3000,
17 ports: [{ external: SERVICE_EXTERNAL_PORT, internal: 3000 }],
18 replicas: 1,
19 },
20 Effect.succeed({
21 fetch: Effect.gen(function* () {
22 const request = yield* HttpServerRequest;
23 const url = new URL(request.url, "http://service");
24 if (url.pathname === "/health") {
25 return yield* HttpServerResponse.json({ ok: true, version: 2 });
26 }
27 return HttpServerResponse.text("hello from docker service v2");
28 }),
29 }),
30 ) {}