30 releases (15 breaking)

new 0.17.0 May 22, 2023
0.15.0 Apr 27, 2023
0.13.0 Mar 27, 2023
0.8.1 Dec 14, 2022
0.2.5 Mar 31, 2022

#68 in Cargo plugins

Download history 134/week @ 2023-02-03 263/week @ 2023-02-10 166/week @ 2023-02-17 283/week @ 2023-02-24 260/week @ 2023-03-03 251/week @ 2023-03-10 315/week @ 2023-03-17 325/week @ 2023-03-24 215/week @ 2023-03-31 323/week @ 2023-04-07 166/week @ 2023-04-14 237/week @ 2023-04-21 287/week @ 2023-04-28 304/week @ 2023-05-05 211/week @ 2023-05-12 257/week @ 2023-05-19

1,125 downloads per month

Apache-2.0

300KB
7K SLoC

cargo-shuttle

docs language build status discord

cargo-shuttle is your commandline tool for deploying web apps on shuttle, the stateful serverless web platform for Rust.

README Sections: InstallationSubcommandsDevelopment


cargo-shuttle brings shuttle, the open source serverless platform for Rust web applications, into your terminal. With a dedicated focus on productivity, reliability, and performance, cargo-shuttle makes deploying your code to the cloud as easy as deriving a trait.


cargo-shuttle is available for macOS, Linux, and Windows. To install the commandline tool, run:

cargo install cargo-shuttle

Distro Packages

Packaging status

Packaging status

Arch Linux

cargo-shuttle can be installed from the community repository using pacman:

pacman -S cargo-shuttle

cargo-shuttle's subcommands help you build and deploy web apps from start to finish.

Run cargo shuttle help to see the basic usage:

Usage: cargo-shuttle [OPTIONS] <COMMAND>

Commands:
  deploy      deploy a shuttle service
  deployment  manage deployments of a shuttle service
  init        create a new shuttle service
  generate    generate shell completions
  status      view the status of a shuttle service
  logs        view the logs of a deployment in this shuttle service
  clean       remove artifacts that were generated by cargo
  stop        stop this shuttle service
  secrets     manage secrets for this shuttle service
  login       login to the shuttle platform
  logout      log out of the shuttle platform
  run         run a shuttle service locally
  feedback    Open an issue on github and provide feedback
  project     manage a project on shuttle
  help        Print this message or the help of the given subcommand(s)

Options:
      --api-url <API_URL>                      run this command against the api at the supplied url (allows targeting a custom deployed instance for this command only) [env: SHUTTLE_API=]
      --working-directory <WORKING_DIRECTORY>  Specify the working directory [default: .]
      --name <NAME>                            Specify the name of the project (overrides crate name)
  -h, --help                                   Print help
  -V, --version                                Print version

Subcommand: init

To initialize a shuttle project with boilerplates, run cargo shuttle init [OPTIONS] [PATH].

Currently, cargo shuttle init supports the following frameworks:

  • --actix-web: for actix web framework
  • --axum: for axum framework
  • --poem: for poem framework
  • --poise: for poise discord bot framework
  • --rocket: for rocket framework
  • --salvo: for salvo framework
  • --serenity: for serenity discord bot framework
  • --thruster: for thruster framework
  • --tide: for tide framework
  • --tower: for tower library
  • --warp: for warp framework

For example, running the following command will initialize a project for rocket:

cargo shuttle init --rocket my-rocket-app

This should generate the following dependency in Cargo.toml:

rocket = "0.5.0-rc.2"
shuttle-rocket = { version = "0.17.0" }
shuttle-runtime = { version = "0.17.0" }
tokio = { version = "1.26.0" }

The following boilerplate code should be generated into src/lib.rs:

#[macro_use]
extern crate rocket;

#[get("/")]
fn index() -> &'static str {
    "Hello, world!"
}

#[shuttle_runtime::main]
async fn rocket() -> shuttle_rocket::ShuttleRocket {
    let rocket = rocket::build().mount("/", routes![index]);

    Ok(rocket.into())
}

Subcommand: run

To run the shuttle project locally, use the following command:

# Inside your shuttle project
cargo shuttle run

This will compile your shuttle project and start it on the default port 8000. Test it by:

$ curl http://localhost:8000
Hello, world!

Subcommand: login

Use cargo shuttle login inside your shuttle project to generate an API key for the shuttle platform:

# Inside a shuttle project
cargo shuttle login

This should automatically open a browser window with an auto-generated API key for your project. Simply copy-paste the API key back in your terminal or run the following command to complete login:

cargo shuttle login --api-key <your-api-key-from-browser>

Subcommand: deploy

To deploy your shuttle project to the cloud, run:

cargo shuttle project start
cargo shuttle deploy

Your service will immediately be available at {crate_name}.shuttleapp.rs. For instance:

$ curl https://my-rocket-app.shuttleapp.rs
Hello, world!

Subcommand: status

Check the status of your deployed shuttle project with:

cargo shuttle status

Subcommand: logs

Check the logs of your deployed shuttle project with:

cargo shuttle logs

Subcommand: stop

Once you are done with a deployment, you can stop it by running:

cargo shuttle stop

Thanks for using cargo-shuttle! We’re very happy to have you with us!

During our alpha period, API keys are completely free and you can deploy as many services as you want.

Just keep in mind that there may be some kinks that require us to take all deployments down once in a while. In certain circumstances we may also have to delete all the data associated with those deployments.

To contribute to cargo-shuttle or stay updated with our development, please open an issue, discussion or PR on Github and join our Discord! 🚀

Dependencies

~73–110MB
~2.5M SLoC