floor.toml
Every key of floor.toml: the project, the [backend], [[sites]] and [[apps]], their defaults and limits, and how environments use the file.
floor.toml sits at the top of a repo, next to the backend's Cargo.toml. It says what
floor build and floor deploy build and ship to the project: a backend written with the
framework, static sites, and other apps. Each is a target, packed into one .floor release
file.
project = "sac"
version = "1.5.0"
[backend]
mount = "sac.example.com/api"
health = "/api/health"
memory_mb = 128
cpu = 0.5
idle = "15m"
outbound = ["api.github.com"]
[[sites]]
name = "dashboard"
build = "bun install --frozen-lockfile && bun run build"
dir = "web/dist"
hostname = "sac.example.com"
spa = true
[[apps]]
name = "edge"
build = "bun build src/index.ts --compile --outfile dist/edge/edge"
dir = "dist/edge"
run = "./edge"
hostname = "edge.sac.example.com"
memory_mb = 128An unknown key anywhere is an error, so a typo doesn't pass silently.
Top level
project
project = "sac"Required. The project's slug. In an environment, the release goes to <project>-<environment>;
see Environments.
version
version = "1.5.0"Optional. The release's version. Without it, the backend crate's version from Cargo.toml. The
commit is added: the release file is sac-1.5.0+3f2c1ab.floor.
[backend]
The crate next to floor.toml, a backend written with the framework. floor deploy builds it,
packs its binary, and Floor runs it connected to the project's engine. Before the new version
starts, Floor runs <binary> --migrate as a step of the deploy; if that fails, the deploy stops
and the old version keeps serving.
mount
mount = "sac.example.com/api"Required. Where it answers: one of the project's hostnames, and the path it serves under. The
backend sees the whole path (/api/visits), so its routes in api/ line up with a mount at
/api. Under the dashboard's hostname, the dashboard calls it without CORS.
A path is lower-case letters, digits, -, _ and ., in segments, up to 100 characters.
name
name = "api"The target's name. Default api. Lower-case letters, digits and dashes, starting with a
letter, up to 40 characters.
build
build = "cargo build --release --locked"The build command, run in the folder of floor.toml. Default cargo build --release --locked.
When the crate has a .sqlx/ folder (from floor prepare), the build runs with
SQLX_OFFLINE=true, so checked queries need no database.
The binary is the one Cargo makes for the crate's package name, under CARGO_TARGET_DIR or the
nearest target/release. Floor runs Linux binaries: build on Linux or in CI.
health
health = "/api/health"The path that must answer below 500 before the new version goes live. Default /. Every
backend also answers /_floor/health.
memory_mb
memory_mb = 128The most memory it may use, in MB. Default 256; 32 to 8192.
cpu
cpu = 0.5Cores. Default 1; 0.05 to 16.
idle
idle = "15m"Optional. Stop after this long with no request or trigger, and start again on the next one. 1 minute to 7 days. Without it, the backend keeps running.
outbound
outbound = ["api.github.com"]Optional. The only hosts it may reach: host names, addresses or CIDR ranges, at most 32. Without it, it may reach anywhere. See Sandbox and limits.
[[sites]]
Static files served on a hostname. Repeat the table for each site.
name
Required. The target's name: lower-case letters, digits and dashes, starting with a letter, up to 40 characters.
build
Optional. The build command, run in the folder of floor.toml with the environment's build
variables (VITE_API_URL, say).
dir
Required. The built files, relative to floor.toml. It must hold at least one file.
hostname
One of the project's hostnames. A site serves a whole hostname, not a path. Required in production.
spa
spa = trueDefault false. With true, unknown paths get index.html, for a single-page app.
[[apps]]
Any other app: a built folder and how to start it. It listens on $PORT. Repeat the table for
each app.
| Key | Required | |
|---|---|---|
name | yes | the target's name, as for a site |
build | no | the build command |
dir | yes | the built app (a binary, or a bundle with its runtime), relative to floor.toml |
run | yes | how to start it, run in that folder with sh -c: ./edge |
hostname | yes, for production | a hostname (edge.sac.example.com), or a hostname and a path to mount it under (sac.example.com/edge) |
health | no | as for the backend; default / |
memory_mb | no | as for the backend; default 256, 32 to 8192 |
cpu | no | as for the backend; default 1, 0.05 to 16 |
idle | no | stop after this long with no request; 1 minute to 7 days |
outbound | no | as for the backend |
What a running target gets
The backend and apps get the environment's variables (floor deployments set-var) and secrets
as environment variables, plus:
| Variable | |
|---|---|
PORT | where to listen |
FLOOR_PROJECT | the project, sac or sac-staging |
FLOOR_ENVIRONMENT | production, staging, … |
FLOOR_DEPLOYMENT | the deployment's id |
DATABASE_URL | when the project has a database |
FLOOR_LINK, FLOOR_LINK_TOKEN | the engine's link, for the backend |
Environments
There is no environments section in floor.toml. The file names production's addresses, and
each environment is a project of its own, <project>-<environment> (sac-staging), with its own
data.
- Make one with
floor projects add-env sac staging, and link its branch withfloor deployments link sac-staging <owner>/<repo> --branch staging. - Deploy to one with
floor deploy --env staging. In GitHub Actions the branch decides: each environment is linked to its own. - Its addresses: each target serves at
staging.<hostname>(staging.sac.example.com/api), unlessfloor.tomlnames one of the environment's own hostnames. - Builds get that environment's build variables.
See Environments and Deploy.