Deploying an Axum App


You can find the step-by-step deployment guide here.

This guide covers the build process and explains how the Hostman App Platform selects the runtime binary and what requirements your Axum application must meet before deployment.

Building the Application
Copy link

The application is built using the following environment:

  • Rust
  • Cargo

The build process runs in the root of the repository or in the directory specified in the Project directory path field.

The template uses a multi-stage build process. During the first stage, the application binary is compiled in release mode. During the second stage, the final runtime image starts the compiled application.

By default, the following build command is executed:

cargo build --locked --release

Make sure your project includes a valid Cargo.toml file with all required dependencies correctly defined.

The --locked flag forces Cargo to use dependency versions from Cargo.lock. Ensure that the Cargo.lock file is up to date and committed to the repository.

If your application requires additional system packages during the build process, such as OpenSSL libraries, specify them in the Dependencies field. These packages are installed before the cargo build command runs.

Selecting the Binary to Run
Copy link

After the build is completed, App Platform selects the runtime binary using the following logic:

  1. If the build command explicitly includes the --bin <name> or --bin=<name> flag, that binary is used.
  2. If the --bin flag is not provided, the template attempts to detect the binary using the default-run value from Cargo.toml through cargo metadata.
  3. If default-run is not defined, the template scans the target/release directory.
  4. If exactly one executable binary is found, it is selected automatically.
  5. If multiple executable binaries are found, the build fails with an error. In this case, specify the binary explicitly in the build command:
cargo build --locked --release --bin <name>

Application Requirements
Copy link

Make sure your application listens on 0.0.0.0 instead of 127.0.0.1. Otherwise, external connections will not be able to reach the application.