2.1 Installing the runtime and the rs2 CLI
RS2 publishes Linux server binaries and is also a Rust workspace you can build
from source. The rs2 CLI is built from the workspace. After installation you
run a node (the server) and use the rs2 CLI for development and a
small set of admin tasks.
Prerequisites
- The repo-pinned Rust toolchain (
rustup,cargo) when building from source.rust-toolchain.tomlselects the supported version for you. - Node.js on your PATH — only if you'll bundle custom JavaScript services
with
rs2 deploy --bundle(it shells out tonpx esbuild). Not needed to run the server or the prebuilt services. - The
wasm32-wasip2target — only if you'll build WebAssembly custom services:rustup target add wasm32-wasip2.
Building
From the workspace root:
cargo build # the whole workspace, native engine only
The default build deliberately excludes the optional engines so it stays quick. Turn them on with Cargo features when you need them:
cargo build --features wasm # + the WebAssembly (Wasmtime) engine
cargo build --features js # + the JavaScript (V8) engine
Whether an engine is compiled in matters at runtime: a server built without the
js feature will accept a JavaScript code: mount in config but answer requests
to it with 501 engine_unavailable. Build with the engines you intend to run.
For an Ubuntu production node, the repository's deploy/ directory contains a
release installer, hardened systemd unit, Apache reverse-proxy template, and a
build-from-source runbook. Production binaries come in a Wasm-capable variant
and a larger JS variant; choose JS when you use JavaScript services, templates,
or loadable adapters. Section 10.7 covers the network and filesystem layout.
The two things you'll run
| Tool | Crate | What it's for |
|---|---|---|
rs2-server |
rs2-server |
The production-style node: a real HTTP listener |
rs2 |
rs2-cli |
Scaffold, run locally, validate, deploy, migrate, and perform focused admin tasks |
During development you can run either — rs2 dev starts a node using the same
server library, so it's interchangeable with rs2-server for local work. Use
rs2-server when you want the supported binary; use rs2 dev when you're
already living in the CLI.
You can invoke the CLI two ways:
cargo run -p rs2-cli -- <args> # from the workspace, without installing
rs2 <args> # if you've put the built binary on PATH
Throughout this manual we'll write rs2 <verb> for brevity; substitute
cargo run -p rs2-cli -- if you haven't installed the binary.
With a build in hand, the next section starts a node.
← Part 1 — Orientation · Manual home · Next: 2.2 Running your first node →