Launch Rust Apps

In order to make the fly launch process smoother for Rust users we’ve added a Rust scanner to flyctl.

Under the hood we generate a Dockerfile for you based on the wonderful cargo chef project. This is compatible with most rust web frameworks. The first build will generally take longer, but thanks to the cargo chef image every subsequent build/deploy cycle will be much faster. In addition the image size is very small, often coming in at around ~80MB.

You can check out speedruns for some of the more downloaded frameworks:

You can upgrade your fly version using fly version upgrade

10 Likes

Can I do this if my app is in a cargo workspace which depends on my other crates in the same workspace ?

Yes. I took an Axum example from SeaORM’s repo that had multiple workspaces with a one line main in the root. Got it all running.

Note, the Docker.ignore didn’t seem to generate much for me. I had to add the targets/ folder to the ignore or else it would try to upload over a GB of build artifacts and never finish. I also had to learn a little Docker in general, like copy and paste SSL cert code into the Dockerfile and copy some static files into an /app folder that I could access during runtime using an ENV variable.

I’m very happy with the final result, super excited to be getting away from Azure C# MSSQL to use Fly.io Rust and Postgres, but it certainly took some tweaks to get it right. Not great for a beginner dev.

Unless your application is very unique, you shouldn’t need to do this.

Yes, we need to do better here. It is still work in progress, but my current focus is on implementing a small app that uses PostgreSQL, Tigris, Redis, and WebSockets across various frameworks and using that experience to drive improvements. So far:

If you (or anybody) is interested, I would love to collaborate on adding whatever frameworks you like best.