| 1 | import * as Fly from "@/Fly"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as HttpServerResponse from "effect/http/HttpServerResponse"; |
| 4 | import { API_PORT } from "./shared.ts"; |
| 5 | |
| 6 | export const UnhealthySite = Fly.App("UnhealthySite"); |
| 7 | |
| 8 | export 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 | ) {} |