Deploy Rust Axum to Production Server (Debian 11)

Seto Elkahfi
SmbPndk
Published in
2 min readApr 14, 2023

This is the list of processes I took to deploy a Rust API to production. The app uses Axum, the server is Debian 11. Why Debian? Because Ubuntu is just Debian under the hood. Besides, why not?

The Debian logo
The Debian logo

Below is the link to the entire playlist on YouTube.

The push-to-deploy has been my defacto deployment method since I got introduced to Heroku by my friend. This is how I set up such a push-to-deploy method in a Debian server.

#1 Deploy Rust Axum API to Production Server — Setup Git Post-receive Hooks

This is how I set up the remote git repository that I will push my local changes to and then do the deploy-ment by listening to the post-receive hooks event. Hence the term push-to-deploy.

#2 Deploy Rust Axum API to Production Server — Setup Cargo Run Command

This step is how I set up the post-receive hooks script.

Deploy Rust Axum API to Production Server with garust-debian GitHub Action

This step is the final iteration after trying out different methods to set up a CI/CD pipeline for a Rust project. I set up a garust-debian GitHub Action that utilizes SSH public/private keys. Check out the complete tutorial on how to deploy a Rust Axum project to production in the article. A YouTube video will come soon.

--

--

Seto Elkahfi
SmbPndk
Editor for

Software developer. Rust, Ruby on Rails, AWS, iOS, tvOS,