levelrail-cli apply, and the control plane converges to it. This page is the entry point; the details live in the IaC section.
Everything goes through the ordinary REST API with your own token. If a policy denies you an app, that one item is reported as denied and nothing else is touched by it. There is no separate write path.
Quick start
Where to read next
Secrets
Documents never contain secret values.- Reference a secret by name:
API_KEY: { secretRef: API_KEY }orAPI_KEY: ${{ secrets.API_KEY }}. Secrets are stored per app under the env var name, so the reference must match it. - A literal value on a key that looks like a secret (
PASSWORD,TOKEN,API_KEY, and similar) or a value shaped like a known token is refused with an error. The error names the key and line and never echoes the value. - To create or update the value at apply time, pass it explicitly from the environment or a file:
NAME to apply to every app referencing that name, or app/NAME for one app. The plan only ever shows that a secret is set, never the value. A secret that is referenced but has no value yet is reported as a warning.
${{ env.NAME }}placeholders in plain values are filled at apply time from the sources described in Providing values safely. Export uses them when you pass--include-env-values=false.
secretRef, and a plain variable whose name or value looks like a secret is written as a ${{ env.NAME }} placeholder with a warning that also says how to supply it.
Providing values safely
A resource file can be written by someone else: a teammate, a template, a pull request. So the CLI never fills a${{ env.NAME }} placeholder from your shell unless you said it may. A placeholder is resolved from, in this order:
--var NAME=VALUE(repeatable).--var-file PATH(repeatable):KEY=VALUElines in dotenv format, with#comments, quotes and an optionalexportprefix. A line that is not a validNAME=VALUEis an error naming the line. Keep the file readable only by you (chmod 600), and out of the repository.--allow-env NAME[,NAME...](repeatable): reads exactly those names from your environment. A trailing*allows a prefix, for example--allow-env 'APP_*'.
# comments are ignored.
Names that look like credentials are never covered by a wildcard: cloud and CI prefixes (AWS_*, AZURE_*, GOOGLE_*, GCP_*, S3_*, SSH_*, ACTIONS_* and similar), GITHUB_TOKEN, GH_TOKEN, NPM_TOKEN, and any name containing TOKEN, SECRET, PASSW, CREDENTIAL, PRIVATE or _KEY. If a file really needs one, name it exactly: --allow-env AWS_REGION. A shared file that quietly asks for ${{ env.AWS_SECRET_ACCESS_KEY }} therefore fails instead of sending your key.
The control plane never reads its own environment for placeholders. The dashboard and the MCP tools cannot pass values at all, so files applied there must not use ${{ env.NAME }}.
Export
from references. Live settings the format cannot express (bind mounts, egress policies, vault env) are listed as warnings on stderr.
Apply
-f may be repeated and accepts a file, a directory (searched recursively for .yaml and .yml) or - for stdin.
How it runs
Everything is validated first, then planned against live state, then executed item by item. Apply is safe to repeat. The full flow is on How it works. The plan carries a hash so an apply only proceeds if live state still matches what was reviewed.- A plan that contains an error item (a missing project, a read you are not permitted to make) applies nothing unless
--continue-on-erroris set. - Lists and maps on an App (
domains,tags,env,labels, secret names) are additive. Live entries the files do not mention are kept and shown askeepin the plan. Everything else on a declared resource is authoritative.
Deploys
Apply saves desired state and the reconciler acts on it. A changed image is a deploy, by the same path as any other image change. When an env var or secret changes on a running app, apply restarts it so the change takes effect.--no-deploy skips that restart; the app keeps running with the old values until you restart it. It does not hold back an image change, which the control plane starts on save. An app is only touched when its plan is not empty.
Prune
--prune deletes things that are in the control plane but not in your files, and it is deliberately narrow:
- It requires
--source NAME. Apps created or updated by an apply with a source carry amanaged-by:NAMEtag. - Only apps carrying that source’s tag are ever deleted. Anything created by hand, or by another source, is never touched.
- On a managed app it also removes load balancers and extra domains, tags, env vars and labels that are absent from the files.
- Projects, environments, databases, pipelines and alert rules are never pruned.
--pruneasks for confirmation unless--yesis set.
Exit codes
Drift
levelrail-cli diff -f infra/ shows how live state differs from the files and exits 2 when it does. Run it on a schedule to catch hand edits.
Dashboard and MCP
Settings, Infrastructure as code lets you paste or upload YAML, see the plan with diffs, and apply with a confirmation. It also has an Export button per project and per app. MCP has two tools:plan_apply (read only, a dry run) and apply_resources (changes state, subject to the usual approval and IAM rules).
Git workflow
There is no sync engine to run. Keep the files in a repository and use the CLI from CI: a pull request shows the plan, merging applies it. Copy the workflow from IaC in CI.Adopting an existing project
--source infra-repo so the apps are tagged as managed by it.
Driving an install from a repo
This section covers the install-wide parts: values per environment, Node and Setting documents, and install stacks. The sections above cover apps, projects and the other resource kinds.Values per environment
--values reads a flat YAML map (IMAGE_TAG: v1.4.2) that fills ${{ env.NAME }} placeholders. It is repeatable, and a later file wins. A placeholder is filled from the first source that has its name, in this order:
--var NAME=VALUE--values FILE--var-file PATH--allow-env NAME[,NAME...], read from the environment
TOKEN, SECRET, PASSW, CREDENTIAL, PRIVATE, API_KEY or _KEY) is refused. The error names the key and the file, never the value. Pass such a value with --secret instead.
Existing secrets
existing: true points at a secret that is already stored for the app. Apply never writes, overwrites or deletes it, even when --secret is passed for the same name. The plan fails if the app has no secret with that name. Use it for values a person set in the dashboard. A stack token cannot pass --secret, so this is how a CI apply refers to a secret.
Node documents
- The document matches an existing node by its display name. A name that matches no node, or more than one, is a plan error.
- Labels and taints that the document leaves out are not managed.
labels: {}ortaints: []clears that set. - Apply saves them through the node routes, which need a root token. It never creates, deletes or prunes a node. Removing the document leaves the node as it is.
- Nodes join with an enrollment token, not with a document.
Setting documents
- The name is the runtime setting’s registry key. The value goes through the same validator as the API, so a value the dashboard refuses is a plan error.
- A declared setting is authoritative. A value that only comes from the environment or the default is saved, so a later env change does not move it.
- A restart setting warns that it takes effect after a restart. Apply never restarts the control plane.
- A setting that holds a credential is refused in files. Set it from the dashboard or the CLI.
- Removing the document keeps the saved value and only releases it from the stack.
- A change that weakens a security protection (turns one off, shortens a duration or raises a limit) is a plan error that names
allow_weaken. File applies do not acceptallow_weakenyet, so a human root operator makes that change in the dashboard or the CLI.
Install-scoped stacks
An install stack owns only Node and Setting documents and has no project. A project stack that holds either kind gets a warning.- Creating it needs a human root session. The API refuses a token for install scope. Create it with
levelrail-cli stack create NAME --scope install, run as a human root user. The install scope has no--project. - Approval is on by default. Applies wait as pending revisions until another administrator approves them. Change it with
levelrail-cli stack settings NAME --require-approval=false(root only). - Drift policy is
lockby default, the same mode described under Drift. Set--drift warnto relax it (root only).
Export as code and the Import YAML preview
Not supported yet
levelrail-cli exporthas no node option, so Node documents are not written out. The control plane’s export API takes one, but the CLI does not expose it yet.- Database placement is not part of a stack. The database API stores only a node selector, and no stack manages it.
- A file cannot set
allow_weaken, and a stack token cannot pass--secret. - Plain
applytakes a token fromAPP_API_TOKEN. The OIDC exchange (POST /api/v1/ci/stack-oidc-exchange) returns a stack token forstack planandstack applyonly.
Not in scope
Git sync is a recipe, not an engine. Backup schedules, egress policies, node placement, registry credentials and vault env references are not expressible yet and are left as they are.Next steps
app.yaml reference
The service fields an App document embeds.
Pipelines
The pipeline definition format.
Identity and access
Tokens and per resource policies.
Migrating from other platforms
Import from Coolify, Dokploy or CapRover.