What does the deploy command do?
levelrail-cli deploy packs a directory on your machine, uploads it to the control plane, builds it there and follows the deploy until the app is healthy. You need no git remote, no registry and no SSH access. It is the quickest way to try an app that is not in a repository yet.
The directory needs a Dockerfile or a stack Levelrail detects (Node, Go, Python, Java and others, built with Railpack). Docker Compose projects are not supported by this command yet. For a static site, see Drop deploy: levelrail-cli deploy ./site --static or a .zip.
How do I deploy a directory?
1
Sign in once
- Device code
- API token
2
Deploy from the project folder
3
Verify the app is up
The command prints the app URL on stdout when the deploy is healthy. Open it, or check it from a shell:
EXPOSE line or the detected framework. Running it again uploads the new contents and deploys them to the same app. Pass a path to deploy another folder, --app NAME to pick the app name, and --port N to override the port.
Before anything is sent you see what will be uploaded:
live on <url> (certificate is being issued, usually under a minute) on stderr, and --json carries "certificate": "pending". Pass --wait-url to block until it is issued (limit APP_DEPLOY_CERT_WAIT, default 2m).
An upload is a one-off build: pushing to the repository afterwards does not deploy it. When the directory is a git checkout whose origin remote is a repository URL and the app has no git source yet, a healthy deploy (here and in up) ends with one line on stderr naming the exact apps git-source set APP --repo URL --branch BRANCH command to connect it. Nothing is connected for you. Set APP_GIT_SOURCE_HINT=off to hide the line.
The exit code is 0 for a healthy deploy, 7 when the deploy failed or rolled back and a timeout code when --timeout (default 15 minutes) ends before the deploy finishes. The deploy itself keeps running after a timeout.
What is uploaded?
Everything in the directory except:- files matched by
.gitignore(the root one and nested ones), .git,node_modules,.next,.nuxt,.turbo,.venv,venv,__pycache__,target,coverage,.terraformand.DS_Store,- secret-looking files:
.env,.env.*(except.env.example,.env.sampleand.env.template),*.pem,*.key,id_rsa*andid_ed25519*.
.gitignore rule that starts with ! cannot bring a secret file back. Symbolic links and special files are never uploaded. To send an ignored path on purpose, name it with --include, for example --include .env. Editor and agent config (.claude, .cursor, .idea, .windsurf, .codex, .fleet, .history, .aider*, .vscode/settings.json, *.local.json, *.local.yaml, settings.local.*) is also skipped by default, and --include sends any of it.
--dry-run lists the files that would be uploaded and changes nothing:
How do I set environment variables and build arguments?
--env sets runtime variables on the app and is repeatable. --build-env passes Dockerfile ARG values to the build and is repeatable. It is refused up front, before anything is created or uploaded, for a build that has no Dockerfile; those builds read --env at build time (for example NEXT_PUBLIC_* values are inlined). For secrets use levelrail-cli apps secrets set, not --env, because env values are visible in the app’s env list.
What are the size limits and how long are uploads kept?
When the directory is over the cap the CLI stops before uploading and says which variable to raise. Excluding build output in
.gitignore is usually the better fix.
The control plane keeps each uploaded archive under its data directory for the retention period, then deletes it. Uploading identical content again reuses the stored archive. Deploy history shows each upload as “Uploaded” with the archive hash and file count, and no git commit.
How do I roll back or redeploy an earlier upload?
Every build is tagged with its archive hash, so the normal rollback works:What checks run on an upload?
- The upload endpoint needs the
deployability on the token or session, and every upload is written to the audit log. Archive contents are never logged. - Archives are checked before they are stored and again when extracted: absolute paths,
..segments, symbolic links, hard links, devices and other special files are rejected, and file count and expanded size are capped so a small archive cannot expand into a disk-filling bomb. - Stored archives live in the control plane data directory, never in a web-served path.
How do I retry safely in CI?
apps deploy, apps rollback and apps promote send an Idempotency-Key header, so a re-run of the same CI job is applied once and the first result is replayed. The key is derived from the app, the image (or target environment) and the run id: GITHUB_RUN_ID plus GITHUB_RUN_ATTEMPT, else CI_PIPELINE_ID, else the current minute. Pass --idempotency-key to set your own.
The CLI retries HTTP 429 and 503 only for idempotent requests or requests carrying an Idempotency-Key, waiting for Retry-After (seconds or HTTP date) plus a little jitter. Two environment variables bound it:
LEVELRAIL_RETRY_MAX: retries after the first attempt (default3,0turns retry off).LEVELRAIL_RETRY_MAX_WAIT: total time spent waiting, in seconds or a duration such as90s(default60s).
X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the budget is full again).
What if the deploy does not go as planned?
The URL refuses connections right after the first deploy
The URL refuses connections right after the first deploy
On the first deploy of a new domain the certificate is requested only when the app goes live, so the URL can refuse connections for up to a minute. Pass
--wait-url to block until it is issued.The CLI stops before uploading and names a variable
The CLI stops before uploading and names a variable
The directory is over the size cap. Raise the variable it names, or exclude build output in
.gitignore, which is usually the better fix.A .env or key file is missing from the app
A .env or key file is missing from the app
Secret-looking files are never uploaded. Send one on purpose with
--include, for example --include .env, or set secrets with levelrail-cli apps secrets set.The command exits with code 7
The command exits with code 7
The deploy failed or rolled back. Read the streamed build log, fix the cause and deploy again. A timeout ends the wait, not the deploy.
--build-env is refused
--build-env is refused
The build has no Dockerfile. Those builds read
--env at build time instead.Related
- Use any CI has GitLab CI, CircleCI, Jenkins and Buildkite templates that build elsewhere and deploy with
apps deploy --image. - Deploying apps covers git sources, images, rollbacks and promotion.
- Getting started installs the control plane and the CLI.