Shuttle v0.4.0 is out! (Serverless Rust)

69 points openquery

Hey r/Rust!

For anyone who wants to get into Rust web dev - Shuttle v0.4.0 is out!

Just to remind everyone, Shuttle is an open-source serverless platform for Rust which makes it really easy to deploy your web-apps (1 annotation on your main function). If you're curious as to how it works, check out this hello world example.

We have a new feature at your disposal:

  • Services can now opt into an AWS RDS Postgres, MySql or MariaDB instance rather than the previously shared Postgres instance

This release also comes with some highly requested changes:

  • cdylib now gets set automatically at build time so you no longer have to specify it explicitly in your Cargo.toml
  • Improved error messages (e.g. invalid API keys now have a helpful error message and suggestion)
  • Major quality of life improvements for local development
  • Rewrite of the shuttle_service::Service to make it easier for users to implement custom services
  • Improved exit codes for the cargo-shuttle binary for a better scripting experience

There’s also a breaking change worth pointing out:

Any service that used the (shared Postgres) PgPool defines a main function like this:

async fn rocket(pool: PgPool) -> shuttle_service::ShuttleRocket {
    // Create service here
}

And a sqlx-postgres feature flag for shuttle-service. With the support of more databases, this PgPool needs to explicitly define what kind of database instance it will connect to using argument attributes. This can be done by adding #[shared::Postgres] to the attribute:

async fn rocket(#[shared::Postgres] pool: PgPool) -> shuttle_service::ShuttleRocket {
    // Create service here
}

If you want to get started with shuttle, take a look at the docs or come join the Discord server and say hello!

A special thank you to all our contributors and the community for forging the future of Shuttle! There's more exciting changes coming so stay tuned!