DocsDeploying
snapwake.toml
Most apps need no config file: an image or a recognizable folder deploys as it is, and flags cover the rest. A snapwake.toml in the folder you deploy is useful when you want the settings in your repository, or when one folder holds several apps.
snapwake deploy FOLDER reads FOLDER/snapwake.toml. A flag on the command line wins over the same setting in the file.
One app
app = "shop" # the app's name
image = "ghcr.io/acme/shop:1.4" # deploy this image ...
# build = "." # ... or build this folder (relative to this file)
# dockerfile = "Dockerfile.prod" # build with this Dockerfile
[processes.web]
port = 9000 # the port your app listens on
command = "node server.js" # replaces the image's ENTRYPOINT and CMD
memory = "1gb" # memory ceiling of each VM
[env]
NODE_ENV = "production" # stored as sealed secrets, like --env-file
[build_args]
NODE_VERSION = "22" # values for the Dockerfile's ARGsKeys
| Key | Meaning | Default |
|---|---|---|
app |
the app's name (or use [apps.<name>] tables) |
required |
image |
a Docker image to deploy instead of building | none |
build |
the folder to build, relative to snapwake.toml |
. |
dockerfile |
build with this Dockerfile, relative to the build folder | detect a framework, else Dockerfile |
[processes.web] port |
the port to send requests to | see Which port |
[processes.web] command |
the start command; replaces ENTRYPOINT and CMD for images, the detected command for frameworks |
the image's or the framework's |
[processes.web] memory (or size) |
memory per VM: "512mb", "1gb", a number of MB, or "auto" |
512 MB ("auto" means 512 MB for now) |
[env] |
environment variables, stored as sealed secrets | none |
[build_args] |
values for the Dockerfile's ARGs |
none |
port, command and memory may also sit at the top level of the file instead of under [processes.web].
How settings combine:
[env]is applied first and--env-filesecond, so a line in the env file wins.[build_args]is applied first and--build-argsecond.--port,--start,--memand--dockerfilewin over the file.- Values in
[env]are stored in the app's secrets on every deploy. A variable you remove from[env]stays in the app's secrets until yousnapwake secret <app> unset NAME.
Don't put real secrets in [env] if the file is committed to a repository. Use snapwake secret or --env-file with an uncommitted file.
Several apps in one file
A folder with a web app and a separate API, or what snapwake import writes from a docker-compose.yml:
[apps.web]
build = "frontend"
port = 3000
[apps.api]
build = "backend"
dockerfile = "Dockerfile"
[apps.api.env]
LOG_LEVEL = "info"
[apps.cache]
image = "redis:7-alpine"snapwake deploy . deploys each app in turn and stops at the first failure. Each [apps.<name>] table takes the same keys as a one-app file. The top-level [env] and [build_args] do not apply to [apps.*] tables; give each app its own.
Keys that are not available yet
The CLI refuses these with a message, so a deploy never silently does something other than what the file says:
| Key | What it will do |
|---|---|
[release] command |
run a command (migrations) once per deploy, before the new version takes traffic |
ready = "tcp" |
wait for a TCP port instead of an HTTP answer (databases, caches) |
warm = ["/", "/health"] |
paths to request before the snapshot is taken |
[processes.<name>] other than web |
worker and scheduled processes from the same image |
org |
deploy into another organization |
These keys are accepted but ignored for now: sleep (apps sleep after a fixed idle time; see Sleep and wake), instances, health and [[volumes]]. Use snapwake scale, snapwake health and snapwake deploy --volume for now.
To run a worker next to a web app today, deploy it as a second app; see Background workers.
Importing from another platform
snapwake import . # writes ./snapwake.toml and prints it
snapwake import . --force # replaces an existing snapwake.tomlimport looks for, in this order, fly.toml, docker-compose.yml (or .yaml, compose.yaml, compose.yml) and Procfile, and uses the first it finds. It writes what it can translate and leaves a comment in the file for everything it can't. Read the file before you deploy.
| From | Translated | Left as a comment |
|---|---|---|
fly.toml |
app; [build] image or Dockerfile; [env]; http_service.internal_port; auto_stop_machines (as sleep); [deploy] release_command; [[vm]] memory; the web or app entry of [processes]; for [[services]] without an HTTP handler, ready = "tcp" |
buildpacks, min_machines_running, other processes, [[mounts]], checks, primary_region |
docker-compose.yml |
each service becomes an app: image or build (context and Dockerfile), the first port, command, environment, a memory limit; databases and caches get ready = "tcp" |
entrypoint, env_file, depends_on, volumes, healthcheck |
Procfile |
web: as the start command, release: as the release command |
other process types |
Some translated keys are among those not available yet (release, ready = "tcp"). Remove them, or the deploy will refuse the file. For what to do about each comment, see Moving from another platform.