New greener region discount. Save 3% on Upsun resource usage. Learn how.
LoginFree trial
FeaturesPricingBlogAbout us
Blog

Up(sun) and running with Rust

rustconfiguration
05 March 2024
Rémi Lejeune
Rémi Lejeune
Product Manager

The popularity of different programming languages has changed throughout the years with each language offering its own unique strengths and limitations. In this article, we’ll dive a little deeper into a number of the most popular languages and their compatibility with our PaaS including Go, Ruby, Python, and who could forget the star of the show, Rust.

A tale of the programming languages

First up, with its low barrier to entry, very simple concurrency model, and maybe even more importantly, its very simple build chain and distribution model (as a single binary), Go displaced quite a few other languages when it came on the scene.

For those who remember, DevOps used to be a Ruby and Python world. Now most DevOps tooling is written in Go including almost all containers and container runtimes and many of the diverse reverse proxies and API gateways. Not to mention, Go probably displaced stuff that used to run on the JVM as well—there was no stopping it.

Then with the brand power (and actual support) of Google, Go became a popular and widespread programming language and has now become a very productive web application language. A lot of things that used to be written in PHP are projects that are now in Go—a sharp rise in popularity reminiscent of the wildfire growth of Ruby’s glory days.

Meanwhile, the programming language Rust, born in Mozilla but now its own thing, had a much slower uptake—resembling more that of Python’s growth—slow and steady. The reason for this could be that the barrier to entry is evidently much higher than that of Go as you need to learn several new concepts. And as a programming language, it both exposes higher-level abstractions but also more exposure to low-level details than you would get in Go.

Over the past few years, Rust started to establish itself as the de facto “other” system programming language—even slowly making its way into the Linux kernel. Its tooling and ecosystem have grown and become much more accessible. And of all the compiled programming languages out there, it has the most polite and useful compile-time error messages—and who doesn’t love that?

But now we are starting to see Rust in the wild as a reasonable programming language for web servers with frameworks such as Actix Web, Rocket, and Axum gaining in popularity. And there are some very interesting things happening around Rust being used to compile things to WebAssembly (WASM)—see for example MailCrab a very cool mail test server.

Turns out that Rust is a really good candidate for building high-performance backend servers, and for building and running it on your favorite PaaS, of course. We even threw in WASM as a compilation target for good measure.

How to start using Rust with Upsun

Now that Rust is supported on Upsun alongside other notable languages—such as PHP, Node.js, Python, Go, and many others—you can get to work using it right away.

Take a look at how to get up and running with Rust on Upsun below:

applications:
  app:
    type: 'rust:1'
    hooks:
      build:
        cargo build --release

    web:
      commands:
        start: './target/release/hello'

Don't worry, you don’t need to provide the full Rust version to get started. The “1” here means that you will get all compatible minors and patches of 1.X versions, starting with the current one, 1.74.0. As a modern programming language, Rust comes with a package manager, Cargo, which you can use in the build hook.

Want to build WASM?

The target wasm32-unknown-unknown can be used at build time to generate a WASMpackage. You can start with the following build command.

cargo build --target wasm32-unknown-unknown --release

You can also find more materials on rustwasm.github.io.

We look forward to your feedback

The support of Rust is currently in beta which means that we’re looking for plenty of feedback. So, please, feel free to share your successes, failures, suggestions, and feature ideas with us.

To do so, you can add a comment to the Rust feature card on our What’s Next portal. For now, stay tuned for more exciting updates coming soon!

Upsun Logo
Join the community