Deployment files
How to add or ignore files in Shuttle deployments
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.
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:
"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:
or inspect the archive after writing it to disk:
Block dirty deployments
If you want the deploy
command to exit if there are uncommitted git changes:
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
.
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.