This page answers:

  • Which files are uploaded to Shuttle when I deploy?
  • How do I change which files are uploaded?
  • How to serve static frontend assets on Shuttle?
  • What happens to files after I deploy?
  • What happens to files that I write to disk?

Files uploaded to the build stage

When you run shuttle deploy, all source files in your cargo workspace that are not ignored are packed into a zip archive and uploaded to Shuttle, where they are then extracted and built.

The archive POST request (after compression) has a size limit of 100 MB.
To access files at runtime, they need to be copied from the build stage. Read more below.

Ignore files

Ignoring files can be done by adding rules to .gitignore or .ignore files, depending on if you want to exclude them from version control or not.

Include ignored files

If you have ignored files that you want to include in the upload to the build stage, declare those files in the Shuttle.toml file in the root of your workspace:

Shuttle.toml
# Declare ignored files that should be included in the upload:
[deploy]
include = [
  "file.txt", # include file.txt
  "frontend/dist/*", # include all files and subdirs in frontend/dist/
  "static/*", # include all files and subdirs in static/
]
Specifying only a folder name, like "static", does not work. Use "static/*" instead to include its contents.

Debug included files

You can double check which files are included in your archive by turning on detailed logging:

shuttle deploy --debug

or inspect the archive after writing it to disk:

shuttle deploy --output-archive deployment.zip

Block dirty deployments

If you want the deploy command to exit if there are uncommitted git changes:

Shuttle.toml
[deploy]
deny_dirty = true

Add files to the runtime image

To make your files available at runtime such as config files, static web files etc, they need to be copied into the runtime image at the end of the build stage. To do this, declare them as build assets in the [build] configuration in Shuttle.toml.

Shuttle.toml
# Declare files that should be copied to the runtime image:
[build]
assets = [
  "file.txt", # include file.txt
  "frontend/dist/*", # include all files and subdirs in frontend/dist/
  "static/*", # include all files and subdirs in static/
]

An example on how to upload and serve static files with Axum can be found here.

Files in the runtime container

You app can use the file system like normal, but files in the deployment container are deleted after the deployment stops.