main builds your image, deploys it to your own server, and turns the workflow red if the rollout fails. Levelrail’s deploy action does the last step; you keep your existing build step.
Before you start
- A running Levelrail instance with an existing app to deploy to (Deploy a Docker app creates one).
- A container registry the server can pull from. This example uses GitHub’s
ghcr.io. - Permission to add secrets to your GitHub repository.
1
Create a deploy-only token
CI should not hold your admin credentials. Mint a token that can read and deploy, and nothing else:The command asks for your admin username and password, because a token can only be created from a live session. The token prints once and cannot be shown again.
deployer means the read and deploy abilities. See Identity and access for the full list.2
Store the URL and token as secrets
3
Let the server pull your image
If the image is public, skip this. For a private
ghcr.io package, give Levelrail pull credentials once. See Registry credentials, and test them with levelrail-cli registry-credentials test <id> before the first deploy.4
Add the workflow
Create The action installs the CLI (with its checksum verified), runs
.github/workflows/deploy.yml:apps deploy, then runs apps wait and fails the job if the rollout fails or times out. Without cli-version it picks the newest release. Pin it, as above, if you want builds that never change underneath you.Tag the image with the commit SHA, not latest. A SHA tag is immutable, so the deploy history tells you exactly which commit each release is, and rollback has a precise target.5
Push and watch
Push to and the deploy appears in
main. The workflow’s last step prints:levelrail-cli apps deploys list my-app and on the dashboard’s Deployments page.Useful inputs
The action’s
status output is succeeded, failed, or skipped.
Not on GitHub?
The action is a thin wrapper over two commands, so any CI works. Install the CLI with the install script, exportAPP_API_URL and APP_API_TOKEN, then run levelrail-cli apps deploy my-app --image "$IMAGE" and levelrail-cli apps wait my-app. Both exit non-zero on failure.
Where to go next
- Deploying from GitHub Actions: the full action reference.
- Zero-downtime deploys with health checks: make a bad release fail the job before it replaces a good one.
- Pipelines: run builds and tests on your own nodes instead of GitHub’s.