Deploy a Rust Rocket app
Deploy a Rocket app on LILY from a GitHub repository, with the CLI or the console.
This guide deploys a minimal Rocket app. LILY detects Rust apps by their Cargo.toml. It reads the port from Rocket.toml.
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 rocket-demo and add these three files:
[package]
name = "rocket-demo"
version = "0.1.0"
edition = "2021"
[dependencies]
rocket = "0.5"[default]
address = "0.0.0.0"
port = 8000#[macro_use]
extern crate rocket;
#[get("/")]
fn hello() -> &'static str {
"Hello from Rocket on LILY\n"
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![hello])
}The address 0.0.0.0 in Rocket.toml makes the app reachable inside LILY. Run it locally:
cargo run
curl localhost:8000Hello from Rocket 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 rocket-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/rocket-demo @ main (origin)
Project rocket-demo (new)
✓ Source 1 root detected
Detected roots
Root Framework Status Hint
* . rust ok Cargo.toml
✓ Analyzed
copperfox deployed 3m10s
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 | 8000/http | port = 8000 in Rocket.toml |
| 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 Rocket on LILYUse the address from the summary in place of copperfox.lilylabs.app.
Known limits
None found with this app. It deployed and answered without changes.
Use an agent
Deploy this Rocket project to LILY with the lly CLI.
Check that Rocket.toml sets the address 0.0.0.0 and 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`.