moorage.toml

Every setting of the app manifest.

On this page

moorage.toml, at the top of an app's directory, says how Moorage builds and runs the app. It is optional: without it, Moorage detects the kind of app (see Detection), and moor manifest explain shows what it detected. This page describes the manifest as Moorage 0.10.1 implements it; the design describes what later releases add.

moor manifest validate      # checks the file, reporting every problem at once
moor manifest explain       # shows how the app will be built and run
moor manifest schema        # prints a JSON Schema for editors

Rules#

An example#

[app]
name = "tasks"

[python]
version = "3.13"

[processes.web]
command = "uvicorn tasks.main:app --host 127.0.0.1 --port $PORT --proxy-headers"
health = { path = "/healthz" }

[processes.worker]
command = "python -m tasks.worker"

[release]
command = "python -m tasks.migrate"

[deploy]
keep_releases = 10

[env]
LOG_LEVEL = "info"

[app]#

KeyDefaultDescription
name—The app's name, used when moor deploy is not given --app: 3 to 40 lowercase letters, digits and hyphens, starting with a letter. It is also the first part of the app's hostname.
runtime"auto"auto (detect), go, python, node, static, command (your own build), binary (run the files as they are), or dockerfile or image (run in a container).
toolchains[]More toolchains on the PATH while building and running, as name@version: go, node, python and uv are installed by Moorage, and name@system uses the server's own ("java@system"). Versions may be partial ("24", "3.13"); the exact version is recorded in the build.

watch lists the paths that matter, as globs, whose * crosses slashes: a push that touches none of them, nor this file, is kept and not deployed.

strip_prefix, with path routing, takes the path the app is served at away from what it hears.

[go]#

KeyDefaultDescription
versionthe toolchain line of go.mod, or else the newest patch release of its go lineThe Go that builds the app. Builds run with GOTOOLCHAIN=local.
main. when it is package main, or else the single ./cmd/*The main package.
binarythe last element of the module path (or of main)The binary's name, in $MOORAGE_BIN.
ldflags"-s -w"Linker flags.
tags[]Build tags.
cgofalseSets CGO_ENABLED; the server then needs a C compiler.

The build is go build -trimpath -ldflags="…" -o "$MOORAGE_BIN/<binary>" <main>, and the web process runs the binary. See Go.

[python]#

KeyDefaultDescription
version.python-version, or else requires-python, or else the newest releaseInstalled with uv; a partial version means its newest patch release.
manageruv with a pyproject.toml, uv-pip with only a requirements.txtuv runs uv sync --locked --no-dev (uv sync --no-dev, with a warning, without a uv.lock); uv-pip makes a virtual environment and runs uv pip install -r requirements.txt.
groups[]More dependency groups to install.
extras[]Optional extras to install.

The virtual environment's bin comes first on the PATH, and VIRTUAL_ENV and PYTHONUNBUFFERED=1 are set. See Python.

[node]#

KeyDefaultDescription
version.nvmrc, or else .node-version, or else engines.node, or else the current LTS releasePartial versions and ranges ("24", ">=22", "lts/*") mean the newest matching release.
package_managernpmOnly npm in this release: npm ci with a package-lock.json, npm install (with a warning) without one.
build_script"build", when package.json has oneThe script run after the install.
prunetrueRemoves development dependencies after the build.

The web process runs the start script directly, not through npm, so that the stop signal reaches the app; NODE_ENV=production is set. Without a start script, the build's dist/, build/ or out/ is served as a static site. See Node.js.

[build]#

KeyDefaultDescription
commandthe runtime's buildReplaces the runtime's build. moor manifest explain shows the build it replaces.
pre—Runs before the build (code generation, for instance).
post—Runs after the build (a front end, for instance).
env{}Variables for the build only.
timeout"20m"The build fails after this long.
exclude[]Patterns, in .gitignore syntax, removed from the build's output.

Builds run in the directory the app will run from. The upload leaves out what .gitignore and .moorignore exclude, and node_modules, .venv and .git.

[processes]#

Each entry is a long-running process. web receives the app's HTTP traffic. An entry is a command (worker = "python -m tasks.worker") or a table:

KeyDefaultDescription
commandthe runtime's, for webWhat to run.
instances1How many instances run (0 to 20; 0 turns the process off). Requests are spread over the healthy ones. moor scale overrides it, on the server.
exposetrue for webThe process listens on $PORT (and $HOST).
healtha TCP check of $PORTSee below.
stop_signal"TERM"The signal that asks the process to stop: TERM, INT, QUIT, HUP, USR1 or USR2.
stop_timeout"30s"How long the process may take to stop before it is killed.
sleeptrueWhether it stops while its environment sleeps.
restart"always"When an exited process is restarted: always, on-failure or never. Restarts slow down when a process keeps failing.
protocol"http"For web, what it speaks on $PORT: http, or h2c for cleartext HTTP/2, which gRPC needs.
stickyfalseFor web, keeps a browser with the instance it first reached. See Scaling.

health:

KeyDefaultDescription
path—An HTTP GET path; a 2xx or 3xx answer is healthy. Without it, a TCP connection to $PORT is the check.
expect—Text the answer must contain.
startup"60s"How long a new instance may take to become healthy during a deploy.
interval"10s"Time between checks while the instance runs.
timeout"3s"Each check's time limit.
threshold3Failed checks in a row before an instance is unhealthy: it gets no traffic and is restarted.
min_uptime"5s"For a process that does not listen: how long a new instance must keep running to count as healthy.

Without [processes], a Procfile (name: command lines) is used, and then the runtime's own web process.

[container]#

For runtime = "dockerfile" and "image". See Running apps in containers.

KeyDefaultDescription
fileContainerfile, else DockerfileWhat to build the image from (dockerfile).
context"."The build's context, in the app's directory (dockerfile).
target—The stage of a multi-stage build to stop at (dockerfile).
args{}Build arguments (dockerfile); [build].env adds to them.
image—The image to run (image): ghcr.io/acme/api:1.4. moor deploy --image overrides it.
portthe lowest the image exposes, else 8080Where the app listens inside the container. $PORT is set to it.
userthe image'sWho to run as: 1000, 1000:1000 or a name the image knows.

Of [build], a container build uses env and timeout. Without [processes], web runs what the image says to, and a command replaces the image's entrypoint and command.

[resources]#

Limits for each instance of an app, and [environments.NAME.resources] for one environment's. A container's engine enforces them. For an app outside a container, it depends on the server.

KeyDescription
memoryMemory: "512MiB". An instance that goes over it is killed and restarted, and it says that it ran out of memory.
cpuCPU, in cores: 0.5, 2.
pidsThe most processes and threads.

[storage]#

KeyDefaultDescription
mount"/data"Where the environment's data directory appears inside a container.

[release]#

KeyDefaultDescription
command—Runs once per deployment, after the build and before the new release takes traffic, with the release's variables: database migrations go here. If it fails, the deployment fails and the previous release keeps serving. It does not run on a rollback or a change of variables.
on_create—Runs once, after an environment's first release (to seed data).
timeout"10m"Each command's time limit.

[deploy]#

KeyDefaultDescription
strategy"rolling"rolling starts the new instances, waits until they are healthy, moves the traffic, then stops the old ones. recreate stops the old instances first, for apps that cannot run twice at once.
drain"30s"How long old instances may finish their requests after the traffic moves.
keep_releases5Builds kept for rollbacks.

[static]#

How a static site is served (runtime = "static", or a Node.js build without a start script).

KeyDefaultDescription
dirthe first of dist, build, out, public, _site, site and . with an index.htmlThe directory served.
spafalseServes index.html for paths that are not files (client-side routing).
clean_urlstrue/about serves about.html, and /about.html redirects to /about.
not_found"404.html", when there is oneThe page served, with status 404, for paths that are not files.
trailing_slash"auto"auto (directories end in a slash, pages do not), always or never.
listingfalseLists the files of directories without an index.html.
dotfilesfalseServes files and directories whose names start with a dot. .well-known is served either way.

[[static.headers]] adds headers to the paths that match for:

[[static.headers]]
for = "/assets/*"
values = { "Cache-Control" = "public, max-age=31536000, immutable" }

[[static.redirects]] redirects (status 301, 302, 307 or 308) or rewrites (status = 200) paths, the first rule that matches winning. * matches the rest of a path (:splat in to) and :name matches one segment. A file that exists is served rather than redirected unless force = true.

[[static.redirects]]
from = "/blog/:year/*"
to = "/posts/:year/:splat"
status = 301

Pages get strong ETags and ranges; files whose names carry a content hash (app.3f2a9c1b.js) are cached as immutable, and HTML is revalidated; .br and .gz files next to a file are served to browsers that accept them. See Static sites.

[previews]#

Previews are on unless this says otherwise.

KeyDefault
enabledtrueA preview for each branch pushed.
branchesevery branchGlobs of the branches that get one; ! leaves some out: ["*", "!dependabot/*"].
ttl"7d"Destroyed after this long without a deployment or a request.
sleep_after"30m"Sleeps after this long without a request; "off" never.
accessthe server'sWho can reach them: password, login or share; public only if the server's default is.

[environments.NAME]#

What is different about an environment, which deploying the manifest makes if it is not there. NAME is production, a name such as staging, or preview, which applies to every preview.

Key
branchThe branch whose pushes deploy to it.
envVariables, over those of [env].
processes.web.instancesHow many instances of that process run.
sleep_afterSleeps after this long without a request. By default a preview does after 30 minutes, and others never do; "off" says never.
accessWho can reach it: password, login or share; public only if the server's default is.

[[cron]]#

Cron jobs: name, schedule, command, timezone, timeout, overlap and environments.

[vars.NAME]#

What the app expects, with no values in the repository.

KeyDefault
descriptionShown in the console and by moor env.
requiredfalseA deployment fails, early, if nothing sets it.
secretfalseA deployment fails if it is set, and not as a secret.
generatesecret or uuid: a value is made once for each environment, and kept as a secret.

[services.NAME]#

A database or an object store for each environment, which Moorage runs and connects the app to. It takes a container engine, for those who use it and nobody else. Services says it all.

[services.db]
type = "postgres"             # postgres or s3
version = "18"                # postgres: 15 to 19. What is made stays at what it was made with
# image = "pgvector/pgvector:pg18"   # postgres: another image, with a tag other than latest
# env = "ANALYTICS_DATABASE_URL"     # another name for what it gives, needed for a second of one type
# memory = "512MiB"
# previews = "own"            # or "none"
# seed = "production"         # a preview starts with a copy of production's latest dump, behind a gate
# sanitize = "scripts/sanitize.sql"  # with seed: what removes what should not be copied, or "none"

[env]#

Variables for the app, at build and run time, such as LOG_LEVEL = "info". Variables set on the server with moor env set override them.

What Moorage sets#

Every process gets these variables; they cannot be overridden.

VariableExampleDescription
PORT24817Where the process listens (exposed processes). In a container: the container's port.
HOST127.0.0.1The address to listen on. In a container: 0.0.0.0.
MOORAGE_APP, MOORAGE_ENVtasks, productionThe app and its environment.
MOORAGE_RELEASEv8The release.
MOORAGE_BUILD_IDbld_…The build.
MOORAGE_URLhttps://tasks.apps.example.comThe app's public address.
MOORAGE_PROCESS, MOORAGE_INSTANCE, MOORAGE_INSTANCE_IDweb, 1, ins_…Which instance this is.
MOORAGE_DATA_DIR…/data/tasks/productionA directory of the environment's that survives deploys, for the app's own files. In a container: where it is mounted.
MOORAGE_BIN…/.moorage/binWhere builds put binaries. Not in a container.
TMPDIRA temporary directory of the instance's own, removed when it stops. Not in a container.

The app's directory is read-only once built: write to $MOORAGE_DATA_DIR or $TMPDIR.

Detection#

With runtime = "auto", or without a manifest, the first match wins:

OrderSignalRuntime
1go.modgo
2pyproject.toml, uv.lock or requirements.txtpython
3package.jsonnode
4Containerfile or Dockerfiledockerfile
5index.html at the top or in a common output directorystatic

The web process of a Python app is the project's single [project.scripts] entry, or else a FastAPI or Starlette app run with uvicorn, or a Django or Flask app run with gunicorn, found in main.py, app.py, server.py, asgi.py, wsgi.py or api.py (at the top or in a package at the top). When nothing matches, the deploy says what it looked at and which lines to add.

Accepted, not acted on yet#

These parts of the design are read and checked, and moor manifest validate warns that they have no effect yet:

SettingArrives
app.roota later release
[storage] outside a containera later release; $MOORAGE_DATA_DIR is always there
[[routes]]later releases
previews.dataa later release
runtime = "bun" or "deno", [bun], [deno]a later release
[static] beside [processes]with [[routes]]; until then the processes serve the app

Suggest a change to this page