Rustlift
Rustlift is a typestate-driven deployment tool that builds and deploys the Axum server in this repository to Azure App Service.
This repository is distributed as a source-available project under a non-commercial license.
Init -> Authenticated -> InfraReady -> ArtifactReady -> Live
Each transition is encoded in the type system, so invalid stage order is rejected at compile time.
Quickstart
What Rustlift does
Running cargo run --bin rustlift performs one deployment pipeline:
- Authenticates using your Azure CLI session.
- Ensures Azure infrastructure exists:
Resource Group (
{APP_NAME}-rg), Linux App Service Plan ({APP_NAME}-plan, SKUB1), and Web App (APP_NAME). - Builds
serverforx86_64-unknown-linux-muslusingcross. - Creates
deploy.zipcontainingserverandstartup.sh. - Deploys the zip with
az webapp deployment source config-zip. - Verifies
https://{APP_NAME}.azurewebsites.net/health.
Prerequisites
| Tool | Why it is needed | Install |
|---|---|---|
| Rust (stable) | Build and run binaries | rustup.rs |
| Docker | Required by cross images |
Get Docker |
| cross | Cross-compile Linux musl binary |
cargo install cross |
Azure CLI (az) |
Auth and zip deployment | Install Azure CLI |
First-time setup:
Configuration
Rustlift is configured only through environment variables:
| Variable | Required | Default | Used for |
|---|---|---|---|
AZURE_SUBSCRIPTION_ID |
yes | none | Azure subscription ID |
APP_NAME |
no | rust-enterprise-api |
Web App name and DNS prefix |
AZURE_LOCATION |
no | eastus |
Region for Resource Group and App Service |
RUST_LOG |
no | info |
Log level for rustlift |
PORT |
no | 8080 |
Local/server runtime port for server binary |
Derived names:
- Resource Group:
{APP_NAME}-rg - App Service Plan:
{APP_NAME}-plan - Binary inside zip:
server
Feature flags
This project currently defines no Cargo feature flags.
Usage
Deploy with defaults:
Deploy with custom app and region:
AZURE_SUBSCRIPTION_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
APP_NAME=my-api \
AZURE_LOCATION=westeurope \
RUST_LOG=debug \
Run the Axum server locally:
PORT=3000
Endpoints:
| Route | Method | Response | Purpose |
|---|---|---|---|
/ |
GET | Hello, Azure! |
Basic service endpoint |
/health |
GET | OK |
Health probe used by deployment verification |
Infrastructure details
The Web App is configured with:
linux_fx_version = "DOTNETCORE|8.0"app_command_line = "sh startup.sh"- App settings:
WEBSITES_PORT=8080WEBSITE_RUN_FROM_PACKAGE=1
https_only = true
Repository layout
| Path | Purpose |
|---|---|
src/main.rs |
Deployment CLI entrypoint (rustlift) |
src/pipeline.rs |
Typestate pipeline and Azure operations |
src/errors.rs |
Error taxonomy used across stages |
src/resilience.rs |
Retry wrapper and backoff policy |
src/bin/server.rs |
Axum app that is deployed |
Cross.toml |
Cross image config for Linux musl builds |
startup.sh |
Startup command wrapper executed on Azure |
examples/probe_deps.rs |
Azure SDK dependency probe example |
Reliability model
- Errors are strongly typed via
DeployErrorinsrc/errors.rs. - Fatal errors (for example missing config or build failures) stop immediately.
- Transient errors (for example network/infra failures) are retried by
reliable_opinsrc/resilience.rs. - Retry policy:
- Max elapsed time: 5 minutes
- Max retry interval: 30 seconds
- Backoff multiplier: 1.5x
Testing
Community
- Contribution guide:
CONTRIBUTING.md - Code of Conduct:
CODE_OF_CONDUCT.md - Security policy:
SECURITY.md - Support policy:
SUPPORT.md - Changelog:
CHANGELOG.md - Release process:
RELEASE.md
Troubleshooting
Missing AZURE_SUBSCRIPTION_ID: export a valid subscription ID before running.Azure CLI ('az') not found: install Azure CLI and ensure it is onPATH.- Auth failures: run
az loginagain and retry. crossbuild failures: verify Docker is running andcrossis installed.- Health check failures: inspect Azure logs for startup or binding issues.
Licence
This project uses a dual-licence model:
- Non-commercial use (learning, hobby, and non-commercial contributions): Rustlift Non-Commercial Licence v1.0.
- Commercial use: separate paid commercial licence.
See LICENSE for full terms.
Note: the current non-commercial licence is not OSI-approved.
If you plan a public source-available release, follow RELEASE.md.
Contributing
By submitting a pull request, you agree to license contributions under the same non-commercial terms and grant rights described in LICENSE.