@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 47 lines 1.86 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import * as Effect from "effect/Effect";
3 import { HttpServerRequest } from "effect/http/HttpServerRequest";
4 import * as HttpServerResponse from "effect/http/HttpServerResponse";
5 import { isolatedProject } from "../../../IsolatedProject.ts";
6
7 /**
8 * The isolated consumer project this service is bundled from (see
9 * `test/IsolatedProject.ts`): `main` lives outside the repository, so the
10 * bundle `cwd` resolves none of alchemy's dependencies and the bun
11 * bootstrap's own imports must be anchored by the bundler.
12 */
13 export const project = isolatedProject("apprunner-service", import.meta.filename, [
14 "@alchemy.run/aws",
15 ]);
16
17 /**
18 * Minimal Effect-native `AWS.AppRunner.Service` served from an isolated
19 * project. `/health` answering 200 proves the generated bootstrap booted —
20 * with its imports left external the container dies at module load and App
21 * Runner never reaches RUNNING.
22 */
23 export default class IsolatedProjectService extends AWS.AppRunner.Service<IsolatedProjectService>()(
24 "AppRunnerIsolatedProjectService",
25 {
26 main: project.main,
27 serviceName: "alchemy-test-apprunner-isolated-project",
28 port: 3000,
29 instanceConfiguration: { cpu: "256", memory: "512" },
30 healthCheckConfiguration: { protocol: "HTTP", path: "/health" },
31 // Docker Hub's `oven/bun` image; the public.ecr.aws default mirror
32 // aggressively rate-limits anonymous pulls (429) during local builds.
33 docker: { base: "oven/bun:1" },
34 },
35 Effect.gen(function* () {
36 return {
37 fetch: Effect.gen(function* () {
38 const request = yield* HttpServerRequest;
39 const url = new URL(request.url, "http://service");
40 if (url.pathname === "/health") {
41 return yield* HttpServerResponse.json({ ok: true });
42 }
43 return HttpServerResponse.text("hello from isolated project");
44 }),
45 };
46 }),
47 ) {}