Skip to content

Fly site

FlySite declares a Fly app that serves one app’s releases. It returns the App and the Machine that serves, and a Volume mounted into the Machine, a public IP and Secrets when they are asked for. Fly’s proxy sends ports 443 (TLS) and 80 to the Machine’s port.

import { Fly, FlySite } from "@intentius/chant-lexicon-fly";
export const flySite = FlySite({
app: "notes",
org: Fly.OrgSlug,
region: "iad",
image: "node:22-slim",
env: { PORT: "8080", APP_DATA: "/data" },
volume: { name: "data", sizeGb: 1, path: "/data" },
ip: "shared_v4",
secrets: { APP_SECRET: process.env.APP_SECRET || undefined },
});

chant build --lexicon fly serializes the site into a plan with exactly one Machine, so the fly-release steps find the Machine a release ships to without being told its name. image is what the Machine runs until a release puts its own image, or its files and start command, on it.

A component that names FlySite in its composites deploys the site. chant workspace graph --composites then lists the instance (flySite above) with that component.

chant workspace upgrade’s chud-lexicon-exit-fly-site migration declares a chud template’s Fly site this way, in place of chud’s FlySite marker and ChudLocalSite composite.

PropDefaultMeaning
apprequiredThe App’s name. Fly app names are global
orgFly.OrgSlugThe owning org, resolved from FLY_ORG at build time
regionFly.RegionRegion of the Machine and the Volume, resolved from FLY_REGION
machinewebThe Machine’s name
imagerequiredThe image the Machine runs until a release replaces it
port8080The port the app listens on inside the Machine
envnoneThe Machine’s env
cpuKind, cpus, memoryMbshared, 1, 256Guest size
volumenone{ name, sizeGb, path }: a Volume for the app’s data, mounted at path
ipnoneA public IP of this type, such as shared_v4
secretsnoneSecrets by name. An undefined value declares the Secret without one
defaultsnoneOverrides for the app, machine and volume members

The members are app, machine, and volume, ip and one per Secret when declared. A Secret’s member is its name in camel case (APP_SECRET is appSecret).