Deployment files
How to handle files and folder for deployment
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 in deployment
When you run shuttle deploy
, all source files in your cargo workspace that are not ignored by .gitignore
or .ignore
rules are packed into a zip archive and uploaded to Shuttle, where they are then extracted, built, and hosted.
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 deployment upload, 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 deployment files
You can double check which files are included in your deployment 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:
Build assets
Serving a web project often means that there are static HTML, CSS, or JavaScript files to serve.
To serve them on Shuttle, make sure they are included in the deployment (if they are gitignored, see above).
Then, add [build]
configuration in Shuttle.toml
to copy them from the builder to the final runtime image:
Lastly, set up your project’s web framework to serve them from their directory.
An example on how to do this with Axum can be found here.
Files at runtime
You app can use the file system like normal, but files in the deployment container are deleted after the deployment shuts down.