What this does
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.
Deploy a directory
Sign in once (levelrail-cli login --device, or set APP_API_URL and APP_API_TOKEN), then run this in the project folder:
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).
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:
Environment 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.
Size limits and retention
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.
Roll back or redeploy an earlier upload
Every build is tagged with its archive hash, so the normal rollback works:Security
- 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.
Safe retries 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).
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.