Skip to main content
Upsun supports building and deploying applications written in Rust.

Supported versions

You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden. Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.
  • 1

Deprecated versions

The following versions are still available in your projects, but they’re at their end of life and are no longer receiving security updates from upstream. No deprecated versions. To ensure your project remains stable in the future, switch to a supported version.

Retired versions

The following versions have been retired and are no longer available. If your project uses a retired version, you must update to a supported version. No retired versions.

Dependencies

The recommended way to handle Rust dependencies on Upsun is using Cargo. Commit a Cargo.toml and a Cargo.lock file in your repository so the system automatically downloads dependencies using Cargo.

Building and running your app

Assuming your Cargo.toml and Cargo.lock files are present in your repository, you can build your app using the cargo build command to produce a working executable. You can then start it from the web.commands.start directive. Note that the start command must run in the foreground. If the program terminates for any reason it is automatically restarted. The following basic app configuration is sufficient to run most Rust apps. See the complete example below for more details.
.upsun/config.yaml
Note that there is still an Nginx proxy server sitting in front of your application. If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily) or you may route all requests to the Rust app unconditionally, as in the example above.

Built-in variables

Upsun exposes relationships and other configuration as environment variables. To get the PORT environment variable (the port on which your app is supposed to listen), use the following snippet:
Note that some of the environment variables are in JSON format and are base64 encoded. For example, to decode the PLATFORM_RELATIONSHIPS environment variable, use the following snippet:

Complete example

Here is a basic hello world app to illustrate how you can use Rust with Upsun. It builds from a hello.rs file to serve a static index.html. Follow these steps:
  1. Install Rust and Cargo.
  2. Create a repository for your app and add the following Cargo.toml file:
  3. Add the following app configuration:
    .upsun/config.yaml
  4. To generate a Cargo.lock file, run the following command:
  5. Add the following hello.rs file:
Last modified on July 17, 2026