levelrail-cli apps deploy-compose. There is no separate template deploy path, so a template-deployed app behaves like any other Compose app.
Some templates also come with an install manifest: a short list of settings (generated secrets, values with defaults, required values) and the services you can put behind a domain. Their template page shows an Install form, and levelrail-cli templates install <id> does the same from the CLI. See Compose apps.
This page covers how to deploy templates, how $SERVICE_... variables work, and how to save your own apps as templates. To see what is in the catalog, read the template catalog. The seven multi-service wiring examples are described in Starter kit templates.
Deploy a template
- Dashboard
- CLI
- API
Open Apps, choose New app, then Browse templates. Search by name, slogan or category, or pick a category. Selecting a card pre-fills the app name (the template ID) and an editable Compose body. Review it, replace any
$SERVICE_... token you want to set yourself, and deploy. The result lists each deployed service with a link to its app page.Keep a trial deployment
An app started with the one-click Deploy now route is a trial: its pages show a banner offering Stop & delete. To keep it instead, choose Keep this app in that banner. The dialog says what changes (the app stops being flagged as throwaway and shows like any other app, with every service of the same app; nothing restarts) and lists what a permanent app should have, each with its current status and a link: a custom domain, a backup schedule for its volumes, an alert rule, and a project and environment. From the CLI,levelrail-cli apps keep <name>; from the API, POST /api/v1/apps/{name}/keep (write ability, audited). Keeping an app twice answers the same result; an app that never was a trial answers 409.
How templates are defined
The built-in catalog is compiled into the control plane binary and served from memory: there is no catalog table and no admin screen. Adding or changing a built-in template means shipping a new control plane build. New entries are two files underinternal/catalog/manifests/<id>/, described in Add a template. Each entry has an ID, name, slogan, category, documentation link, a Compose body, and two optional hints:
- Recommended memory: a static hint shown as a badge (for example “~6 GiB RAM recommended”). It is a rule of thumb and is not checked against any node’s free memory. When you deploy a template, the container memory limit is set to twice this value so the app has headroom for peaks; you can change it under Resources.
- Requires GPU: the entry reserves an NVIDIA GPU through
deploy.resources.reservations.devices. It needs a node with a GPU and the NVIDIA container runtime; see AI models.
resources.reservations.devices and replicas keys of a Compose deploy: block are read. Other Swarm-only keys are reported rather than silently ignored.
Magic variables
Templates use$SERVICE_<KIND>_<NAME> tokens in place of literal secrets. At deploy time:
PASSWORD,USER,BASE64,HEX,REALBASE64andBASE64BYTEStokens are generated and stored as secrets. Every reference to the same name gets the same value, so an app and its database agree on$SERVICE_PASSWORD_DB. A generated value is never written into the stored Compose body.BASE64BYTESis standard padded base64 of N random bytes (default 32), written$SERVICE_BASE64BYTES_<N>_<NAME>. There is no prefix option: a framework key such as a LaravelAPP_KEYis composed asbase64:$SERVICE_BASE64BYTES_32_APPKEY.BASE64andREALBASE64instead produce N characters, not N bytes.$SERVICE_FQDN_<NAME>resolves to the service’s own assigned domain as a bare host, and$SERVICE_URL_<NAME>tohttps://plus that host. The suffix is ignored: both always mean this service’s own domain. With no domain assigned, write a default such as${SERVICE_URL_APP:-http://localhost:5678}. Adding, changing or removing a domain re-renders these values and recreates the service.- Any token written with a default (
${SERVICE_FOO:-value}) uses that default.
Start order with depends_on
depends_on is honoured in list and map form. A service is created only after its dependencies are ready:
service_started(and the list form): a container of the dependency is running.service_healthy: the dependency’s health check has passed. The dependency needs ahealthcheck; shell-less images cannot useCMD-SHELL, useCMDwith the binary’s own check.service_completed_successfully: the one-shot dependency exited 0. A nonzero exit fails the deploy and names the dependency.
compose.depends_on_timeout (default 120s, 5s to 1h, env seed APP_COMPOSE_DEPENDS_ON_TIMEOUT, applies live) fails the service with the dependency’s name; it still starts if the dependency comes up later. Services without depends_on start as before. Recreating one member does not wait for dependencies that are already up.
Variable interpolation in env values
Environment values (notcommand: or healthcheck:, which the container shell expands itself) accept the standard compose forms for variables the app knows. The scope is exactly the plain env keys already saved on the app’s own services (set with apps env set or the Env tab, merged across its services). It never includes the control plane’s own environment, another app’s env, or secret-typed values, which stay out of plain desired state. A template’s install-form values are written into the compose body at render time, so they need no lookup. The stored revision keeps the original ${...} text, so the next deploy re-resolves it against the then-current env:
${VAR}the value;${VAR:-d}the default when unset or empty;${VAR-d}the default only when unset.${VAR:+alt}and${VAR+alt}the alternative when set;${VAR:?msg}and${VAR?msg}fail the import withmsgwhen missing.$$is a literal$.
DB_PASSWORD missing from the app env the deploy fails with set a database password; once it is set, the next deploy uses it. Messages and warnings name variables only, never values.
A plain ${VAR} with no value is left as written and reported as a warning (names only, never values). SERVICE_* tokens behave exactly as before.
- Anything else has no value and is reported as unresolved. A template with an unresolved token is marked
requires_configuration, and the one-click route refuses it. Deploy it through the dashboard’s Compose editor, or withapps deploy-compose, after filling the value in.
Save an app as a template
Custom templates turn an app you already run into a reusable one-click template. They are stored in the database, not in the binary.1
Save the app
On the app’s detail page, open the overflow menu and choose Save as template, or run:Levelrail derives a Compose body from the app’s current desired state (one service, or every service of a multi-service app) and saves it with an ID of the form
custom- plus 16 hex characters.2
Find it
In the dashboard it appears under Your templates in the same template grid. From the CLI,
levelrail-cli templates list --custom.3
Deploy or delete it
A custom ID works anywhere a catalog ID does:Deleting removes only the saved template. The source app and apps already deployed from it are untouched.
${SERVICE_SECRET_<key>} placeholder. SECRET is not a generated kind, so such a template always has requires_configuration set and must be deployed through the Compose editor, where you supply the real values.
The saved Compose body does not capture everything about the app:
- Domains stay with the source app. A new app starts with none, as with
apps clone. - Host port, bind address and bind mounts are specific to the source machine.
- Resources and health checks have no Compose representation Levelrail can read back, so they are dropped.
Static sites
An app whoseapp.yaml sets build.type: static has no container. The control plane copies the built output to a directory on its own host and Caddy serves it directly. These sites are created only by a git push to such an app. levelrail-cli static-sites list (and GET /api/v1/static-sites) lists their names and domains, and the Apps page shows a read-only Static sites card when any exist. See app.yaml reference for the build types.
API and CLI reference
templates delete only removes custom templates; the built-in catalog is read-only.
Limits
- There is no versioning. A template’s Compose body can change between control plane releases, and nothing records what an already-deployed app was created from.
- Importing a catalog from an external source is not supported: the built-in set is the one in the template catalog. The reasoning is in ADR 015.
Next steps
Template catalog
Every built-in template by category.
Starter kit templates
Seven multi-service wiring patterns.
Deploying apps
Roll out, roll back and operate what you deployed.
app.yaml reference
Build types and service settings.