Skip to main content
After this guide one command deploys the current directory to your Levelrail server, builds it there, and prints the app URL once it is healthy.

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

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:
The first run creates an app named after the directory, with the port taken from the Dockerfile 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:
After you confirm, the CLI uploads the archive, streams the build log, waits for the deploy and prints the app URL on stdout:
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. When the certificate is not issued yet, the summary adds 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, .terraform and .DS_Store,
  • secret-looking files: .env, .env.* (except .env.example, .env.sample and .env.template), *.pem, *.key, id_rsa* and id_ed25519*.
A .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:
To rebuild an earlier upload from the stored archive without sending the directory again, pass its digest, or a unique prefix of at least 8 characters (the full digest is printed after every upload):
This only works while the archive is still within the retention period; after that, deploy the directory again.

What checks run on an upload?

  • The upload endpoint needs the deploy ability 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 (default 3, 0 turns retry off).
  • LEVELRAIL_RETRY_MAX_WAIT: total time spent waiting, in seconds or a duration such as 90s (default 60s).
Responses also carry 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?

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 directory is over the size cap. Raise the variable it names, or exclude build output in .gitignore, which is usually the better fix.
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 deploy failed or rolled back. Read the streamed build log, fix the cause and deploy again. A timeout ends the wait, not the deploy.
The build has no Dockerfile. Those builds read --env at build time instead.
  • 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.
Last modified on November 27, 2026