Rust is booming in popularity, thanks in large part to the core team’s penchant for challenging the status quo of existing systems such as C/C++. Most Rust programmers rave about the productivity, optimization, performance, and reliability benefits, making it a premier choice for performance-focused apps and modules/packages for existing languages.
It’s no surprise, then, that companies are scrambling to migrate their web apps and systems to Rust. Deployment can be a major speed bump in this process.
In this guide, we’ll introduce you to some deployment libraries and services that are currently available for Rust. We’ll evaluate each tool according to three criteria:
- Deployment procedures
Before we dive in, let’s quickly review some software deployment basics to make sure we’re on the same page.
What is deployment ?
Software deployment refers to the activities, procedures, and steps that are necessary to make a software system available for the consumption of end users. The word deployment could also mean moving or migrating a software system or app to a remote server.
Software deployment could refer to updates, patches, or new apps with either automated or manual processes, including but not limited to installation, builds, testing, release, and performance monitoring.
Innovation has flourished over the past few decades, with software development teams building new systems, architectures, and principles and patterns for software delivery to improve the speed and accuracy of product release. For instance, today a feature could be pushed and instantly made available on production, provided the code/feature passes the deployment phases. This process brings about various deployment options, including infrastructure-as-a-service (IaaS), platform-as-a-service (Paas), virtualisation servers, etc.
As Rust grows in popularity, hosting companies and services have been channeling their resources toward supporting Rust for the web. Developers are chomping at the bit to have their full-fledged performance apps on the web.
Before we proceed, it’s important to understand a few key terms.
- Platform-as-a-service (PaaS) — Cloud-based computing services that provide a platform to help developers/users handle complex aspects of app deployment, such as infrastructure (automation scripts, run, manage, monitor, etc.)
- Infrastructure-as-a-service (IaaS) — An instant online computing platform that provides infrastructure (firewall, security, scaling, location, resources, etc.) to simplify owning and managing physical servers or datacenters. Some of the infrastructure includes Oracle VirtualBox, Oracle VM, VMware, etc.
- Virtual private server (VPS) — Equivalent to a dedicated physical server, which is the process of providing users with a copy of an OS instance with the full access to install almost anything that is compatible — however, the underlying physical hardware is shared with other users
Without further ado, let’s explore what deployment tools the Rust community has to offer.
Heroku is a cloud PaaS tool that supports collections of languages, such as PHP, Python, Go, Closure, Node.js, Scala, etc. In the past two years, Heroku released a build pack for deploying Rust with support for cargo and Rustup, making it easier to easily deploy Rust web apps using Rocket and Actix.
- Price: Free to start
- Production-ready: No
Heroku recommends installing Heroku CLI to start.
Benefits of deploying Rust on Heroku include:
- Auto-updates Rust to the latest stable version
- Easy Rust version switch
- Export is supported to allow other buildpacks to access the Rust toolchain
- Easy compiling of Rust extensions for projects written in another language, such as C/C++
The build pack is called emk/rust or EMK, though it’s not yet official since Rust is not supported on their main site. That said, you could try it out for testing by adding the build pack to your existing project.
Docker is a PaaS service that uses virtualization to deliver resources such as software, libraries, and other configuration files in packages as containers.
Docker enables you to build and ship any software because it helps you keep track of packages using
Dockerfile. The official image has more than 10 million downloads on Docker Hub.
- Pricing: Relative (based on the VPS in use)
- Production-ready: Yes
There are several nightly containers/images built for Rust, but the official Docker image is managed by the Rust team. Also, using Docker’s multistage build could help you avoid toolchain compilation, which requires you to copy the app’s compiled binary files to the container.
Render is a cloud-based Paas company that offers immense power and scalability and handles apps of all sizes.
- Price: $7
- Production-ready: Yes
Render has full-fledged support for the Rocket and Actix frameworks. It could also be set up using
Cargo since it provides easy deployment with simple clicks and minimal configuration.
Vercel, formerly known as ZEIT Now, is a deployment tool that empowers developers to effortlessly deploy their apps. It provides custom domains, continuous development, high performance, and serverless functions in Go, Node.js, etc.
- Price: Free for beginners; pay-as-you-grow plan
- Production-ready: No
The now builder allows Rust code to be run as lambdas on the now platform. The community-based builder for deploying Rust on ZEIT now is still in progress.
NGINX is a popular web server that offers features such as load balancing, reverse proxy, mail proxy, and more.
Deploying Rust using NGINX is as easy as proxy passing the web framework server and creating a system service that monitors the Rust web framework server status.
6. Clever Cloud
Clever Cloud is a PaaS company based in Europe that offer services closely related to Heroku to help developers deploy and run their apps in a snap.
- Price: ~$5
- Production-ready: Yes
Clever Cloud makes deploying, building, and scaling Rust apps easy. It provides the platform services integrated with git. It also helps ease the stress of build packs because it handles the app builds via clicks and selection on its dashboard. It supports
Cargo and major Rust web frameworks.
Head to the official docs for a step-by-step guide to deploying your Rust app on Clever Cloud.
In this guide, we explored the basic conceptual idea of deployment and described six libraries and services that are available for deploying Rust apps on the web.
LogRocket: Full visibility into production Rust appsDebugging Rust applications can be difficult, especially when users experience issues that are difficult to reproduce. If you’re interested in monitoring and tracking performance of your Rust apps, automatically surfacing errors, and tracking slow network requests and load time, try LogRocket.
LogRocket is like a DVR for web and mobile apps, recording literally everything that happens on your Rust app. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app’s performance, reporting metrics like client CPU load, client memory usage, and more.
Modernize how you debug your Rust apps — start monitoring for free.