Develop your Shuttle app locally
Secrets.toml
with string interpolation:
docker pull postgres:16
) can help resolve it.docker ps
to find the postgres container, then docker stop
and docker rm
to delete it. On the next run, a new one will be created.--external
flag:
0.0.0.0:8000
, and you will now be able to connect to it
using your computer’s local IP. If you’d also like to change the port, you can do so with the --port
argument:
bacon
shuttle run
when you save a file.
To customize this behavior, you can set up your own jobs in bacon.toml
.
Shuttle’s default bacon config can be found here.
cargo watch
cargo-watch
is no longer maintained, but still works.ignore
will also affect the behaviour of shuttle deploy
.
See the documentation on including ignored files for more info.
tower-livereload
bacon
or cargo watch
will only reload the “backend” Shuttle process.
If you are developing a frontend in the browser that is hosted by your Shuttle app,
you might also want the web page to reload when files change.
If you are using Axum or other Tower-compatible frameworks, the Tower layer tower-livereload can help you.
First, add it to your project:
cargo watch
!
If you want to exclude this functionality from the release build, add this:
cargo-shuttle
uses the bollard crate to interact with the Docker engine on local runs.
If you are using a non-standard Docker engine, you might get this error:
unix:///var/run/docker.sock
unless the DOCKER_HOST
env variable overrides it.
If you end up using a DOCKER_HOST
like below, you can add the export DOCKER_HOST=...
line to your shell’s config file to have it automatically set in new shell sessions.
DOCKER_HOST
environment variable: