github shuttle-hq/shuttle v0.27.0

latest releases: v0.51.0, v0.50.0, v0.49.0...
16 months ago

Shuttle: v0.27.0 update

We're excited to release shuttle v0.27.0! 🚀

shuttle-static-folder deprecated

It is now much easier to include and serve files in your deployment. The main change is that binaries are now executed with the working directory set to your project’s workspace root, the same way that cargo runs it locally. This means that all relative paths in your code will work correctly, and that shuttle-static-folder is no longer needed. Check out how the Axum static folder example is simplified:

// Before 0.27.0
#[shuttle_runtime::main]
async fn axum(
    #[shuttle_static_folder::StaticFolder(folder = "assets")] static_folder: PathBuf,
) -> shuttle_axum::ShuttleAxum {
    let router = Router::new()
        .nest_service("/assets", ServeDir::new(static_folder));
    // ...
}

// After 0.27.0
// shuttle-static-folder can be removed from Cargo.toml
#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {
    let router = Router::new()
        .nest_service("/assets", ServeDir::new(PathBuf::from("assets")));
    // ...
}

Including files in deployments

When you deploy, all source files that are not ignored by .gitignore or .ignore are uploaded to Shuttle. If you have ignored files that you want to upload as well, you would previously have had to add a !-rule to .ignore. This approach had a few caveats and was a bit convoluted.

Now, you can tell Shuttle which files to include in Shuttle.toml in the project/workspace root:

### Shuttle.toml
# Declare ignored files that should be included in deployment:
assets = [
  "file.txt", # include file.txt
  "frontend/dist/*", # include all files and subdirs in frontend/dist/
  "static/*", # include all files and subdirs in static/
]

Deploying build artifacts & build environment variables

The changes above make it easier to add arbitrary binaries/libraries/files that your app needs during compile or run time. They also allow for easier customization of the build process. By including the file .cargo/config.toml in your deploy, you can set cargo or rustc options to use during compile time. For example, using the env field lets you set env vars during compile time.

shuttle-persist now persists data between project restarts

This refactor also makes it easier for adding other file-based persistent storage, such as SQLite. Let us know on Discord if you are interested in this type of feature.

More metadata in shuttle-metadata

The new struct returned now contains the fields env, project_name, service_name, storage_path.

Other updates

  • The image used for local runs with the shuttle-shared-db resource now uses PostgreSQL version 14, this matches the version used in deployment.
  • More cargo shuttle commands now give better suggestions for what to do if a command fails.
  • With this release, we are testing out a new builder service behind the scenes. We will try to build every deployment with the new builder in parallel with the normal deployment to see how well it builds projects. This builder will eventually allow more build customization, and faster builds.

Contributions

  • @beyarkay added a helpful error message when Docker is not running during a local run that needs it.
  • @lecoqjacob updated the postgres version for local runs with shuttle-shared-db.
  • @DitherWither added CI for clippy and fmt to shuttle-examples.

Upgrading

Refer to the upgrading docs for how to upgrade your projects.

Commits for this release

  • feat(cargo-shuttle): add suggestions in case of cmd failures by @iulianbarbu in #1245
  • feat: builder service by @chesedo in #1244
  • feat: execute projects from within workspace, deprecate shuttle-static-folder, make persist persistent, more metadata by @jonaro00 in #1050
  • feat(deployer): connect deployer to builder service by @oddgrd in #1248
  • fix(cargo-shuttle): secrets project requires a Secrets.toml by @iulianbarbu in #1250
  • feat(builder): update tracing logs by @jonaro00 in #1252
  • Add helpful error message on docker container error by @beyarkay in #951
  • fix: default network subnet overlap by @oddgrd in #1254
  • fix: metadata re-export by @jonaro00 in #1255
  • chore: bump local pgsql from 11 to 14 by @lecoqjacob in #1073
  • bug: project entering a state loop by @chesedo in #1260
  • feat(deployer): send deployment archive to the builder by @iulianbarbu in #1253
  • chore: v0.27.0 by @oddgrd in #1261

Full Changelog: v0.26.0...v0.27.0

Don't miss a new shuttle release

NewReleases is sending notifications on new releases.