Deploy a Rust Actix Web app
Deploy an Actix Web app on LILY from a GitHub repository, with the CLI or the console.
This guide deploys a minimal Actix Web server. LILY detects Rust apps by their Cargo.toml and finds the port in your code.
Before you start
- A LILY account with GitHub connected, and the
llyCLI installed and signed in. See the Quickstart. - Rust and Cargo, to run the app locally.
1. Create the app
Create a project with cargo new actix-demo and replace these two files:
[package]
name = "actix-demo"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"use actix_web::{get, App, HttpServer, Responder};
#[get("/")]
async fn hello() -> impl Responder {
"Hello from Actix Web on LILY\n"
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(hello))
.bind(("0.0.0.0", 8080))?
.run()
.await
}Bind to 0.0.0.0, not 127.0.0.1. Run it locally:
cargo run
curl localhost:8080Hello from Actix Web on LILY2. Push it to GitHub
LILY builds from GitHub, not from your local files.
git init -b main
git add -A && git commit -m "First commit"
gh repo create actix-demo --private --source=. --pushAny way of creating the GitHub repository works. LILY needs your GitHub account connected to read a private repository.
3. Deploy
Run this in the project directory:
lly deployNo flags are needed.
lly detects the app, builds it and follows the build until it is live. The output, shortened:
Repository acme/actix-demo @ main (origin)
Project actix-demo (new)
✓ Source 1 root detected
Detected roots
Root Framework Status Hint
* . rust ok Cargo.toml
✓ Analyzed
copperfox deployed 5m41s
Apps
App Phase URL Since Note
copperfox deployed https://copperfox.lilylabs.app in 0sStart a new project, pick the repository and follow the steps in Deploy an app. LILY lists the app with the framework rust.
What LILY detected
| Setting | Value | From |
|---|---|---|
| Framework | rust | Cargo.toml |
| Port | 8080/http | .bind(("0.0.0.0", 8080)) in src/main.rs |
| Public access | Yes | An app with a detected port is public |
| Environment variables | None | The app reads none |
Check that it worked
curl https://copperfox.lilylabs.appHello from Actix Web on LILYUse the address from the summary in place of copperfox.lilylabs.app.
Known limits
None found with this app. Actix Web pulls in more dependencies than Axum, so the first build takes longer.
Use an agent
Deploy this Actix Web project to LILY with the lly CLI.
Check that the server binds to 0.0.0.0 with a fixed port and that the branch is pushed to GitHub.
Run `lly deploy -y --json` from the project root. When it is live, request the URL and show me the response.
If it exits with code 7, show me the build log with `lly attach <slug> --build`.