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.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. 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.Dependencies
The recommended way to handle Rust dependencies on Upsun is using Cargo. Commit aCargo.toml and a Cargo.lock file in your repository
so the system automatically downloads dependencies using Cargo.
Building and running your app
Assuming yourCargo.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
Built-in variables
Upsun exposes relationships and other configuration as environment variables. To get thePORT environment variable (the port on which your app is supposed to listen),
use the following snippet:
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 ahello.rs file to serve a static index.html.
Follow these steps:
- Install Rust and Cargo.
-
Create a repository for your app and add the following
Cargo.tomlfile: -
Add the following app configuration:
.upsun/config.yaml
-
To generate a
Cargo.lockfile, run the following command: -
Add the following
hello.rsfile: