| 1 | import * as Fly from "alchemy/Fly"; |
| 2 | import * as Redacted from "effect/Redacted"; |
| 3 | |
| 4 | export const VOLUME_PATH = "/data"; |
| 5 | export const MARKER_FILE = `${VOLUME_PATH}/hello.txt`; |
| 6 | export const MARKER = "hello-from-fly-worker"; |
| 7 | export const API_PORT = 3000; |
| 8 | export const SECRET_NAME = "FLY_EXAMPLE_MARKER"; |
| 9 | |
| 10 | /** |
| 11 | * Parent App both Services share. Each Service is its own Machine |
| 12 | * (not systemd-on-a-box). Name is generated; `enableSubdomains` is |
| 13 | * create-only. |
| 14 | */ |
| 15 | export const Site = Fly.App("Site", { |
| 16 | enableSubdomains: true, |
| 17 | }); |
| 18 | |
| 19 | /** |
| 20 | * App secret {@link Api} reads via {@link Fly.GetSecret}. Fly also |
| 21 | * injects it into Machines as an env var named {@link SECRET_NAME}. |
| 22 | */ |
| 23 | export const Marker = Fly.Secret("Marker", { |
| 24 | app: Site, |
| 25 | name: SECRET_NAME, |
| 26 | value: Redacted.make(MARKER), |
| 27 | }); |
| 28 | |
| 29 | /** |
| 30 | * Shared IPv4 so `{app}.fly.dev` answers. Dedicated IPv4 is billed. |
| 31 | */ |
| 32 | export const PublicIp = Fly.IpAssignment("Shared", { |
| 33 | app: Site, |
| 34 | type: "shared_v4", |
| 35 | }); |