1import * as Fly from "@/Fly";
2import * as Effect from "effect/Effect";
3import * as HttpServerResponse from "effect/http/HttpServerResponse";
4import { API_PORT } from "./shared.ts";
5
6export const UnhealthySite = Fly.App("UnhealthySite");
7
8export default class UnhealthyApi extends Fly.Service<UnhealthyApi>()(
9 "UnhealthyApi",
10 {
11 app: UnhealthySite,
12 main: import.meta.url,
13 region: "iad",
14 port: API_PORT,
15 count: 2,
16 services: [
17 {
18 protocol: "tcp",
19 internalPort: API_PORT,
20 autostart: true,
21 autostop: "off",
22 ports: [{ port: 80, handlers: ["http"] }],
23 checks: [
24 {
25 type: "http",
26 port: API_PORT,
27 path: "/health",
28 interval: "5s",
29 timeout: "2s",
30 gracePeriod: "1s",
31 },
32 ],
33 },
34 ],
35 },
36 Effect.gen(function* () {
37 yield* Fly.MountVolume({ path: "/data", sizeGb: 1 });
38 return {
39 fetch: Effect.succeed(HttpServerResponse.empty({ status: 503 })),
40 };
41 }).pipe(Effect.provide(Fly.MountVolumeLive)),
42) {}