1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) 2026 Hamze Ghalebi. All rights reserved.
// Licensed under the Rustlift Non-Commercial Licence v1.0.
// See the LICENSE file in the repository root for full terms.
//! # Rustlift
//!
//! A typestate-driven deployment agent for Azure Web Apps.
//!
//! Rustlift automates the full lifecycle of deploying the Rust
//! [Axum](https://docs.rs/axum) server to Azure App Service:
//!
//! 1. **Authenticate** against the Azure CLI session.
//! 2. **Provision** a Resource Group, App Service Plan, and Web App.
//! 3. **Cross-compile** via [`cross`](https://github.com/cross-rs/cross)
//! targeting `x86_64-unknown-linux-musl`.
//! 4. **Deploy** the zip artefact and verify the `/health` endpoint.
//!
//! ## Architecture — the Typestate Pattern
//!
//! The pipeline enforces a strict progression through compile-time states:
//!
//! ```text
//! Init ──▸ Authenticated ──▸ InfraReady ──▸ ArtifactReady ──▸ Live
//! ```
//!
//! Each transition consumes the previous state and produces the next.
//! **Invalid call sequences are compile-time errors**, not runtime panics.
//!
//! > **Why is this useful?**
//! >
//! > In most deployment tools, forgetting a step (e.g. deploying before
//! > building) results in a confusing runtime error deep in the call stack.
//! > The typestate pattern shifts that validation to *compilation time*.
//! > If the code compiles, the call order is correct.
//!
//! ## Module Overview
//!
//! | Module | Purpose |
//! |-----------------------------|------------------------------------------------|
//! | [`errors`] | Typed error taxonomy — fatal vs. transient |
//! | [`pipeline`] | Typestate machine driving the deployment flow |
//! | [`resilience`] | Exponential-backoff retry wrapper |
//!
//! ## Quick Start
//!
//! ```bash
//! # 1. Log in to Azure
//! az login
//!
//! # 2. Set your subscription
//! export AZURE_SUBSCRIPTION_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
//!
//! # 3. Deploy
//! cargo run --bin rustlift
//! ```
//!
//! ## Feature Flags
//!
//! Rustlift currently exposes no Cargo feature flags. All crate functionality
//! is available on the default build.
//!
//! ## Licence
//!
//! This project uses a **dual licence** model:
//!
//! - **Non-commercial use** (learning, hobby projects, source-available contributions) is free.
//! - **Commercial use** requires a separate paid licence.
//! - An **Enterprise Edition** with additional features is available under
//! a proprietary licence.
//!
//! See the `LICENSE` file for full terms.