Files
matrix-authentication-service/docs/setup/installation.md
T
Quentin Gliech 66e73f9910 Pin the Rust toolchain with a rust-toolchain.toml
Until now only the clippy CI job and the Dockerfile named a Rust version (kept in sync by hand), while every other CI job, the release binaries and the docs build ran on whatever `stable` happened to be that day. Rust 1.98.0 landing on 2026-08-20 broke `build-binaries` overnight because of that (#5935).

`rust-toolchain.toml` pins 1.96.0 with the `minimal` profile plus clippy, and every `rustup toolchain install stable ...` in CI becomes a bare `rustup toolchain install`, which reads the file. Starting at 1.96.0 (the version clippy is already clean against) keeps this change free of lint churn; catching up to 1.98.0 is a follow-up.

rustfmt stays on nightly because `.rustfmt.toml` uses nightly-only options, so that job now invokes `cargo +nightly fmt` explicitly instead of setting a rustup directory override, which would silently take precedence over the toolchain file.

The file does not list the linux cross-compilation targets on purpose: that would make every developer and CI job download `rust-std` they never use. The two consumers that cross-compile add the targets themselves.
2026-08-26 12:01:34 +02:00

114 lines
3.8 KiB
Markdown

# Installation
## Pre-built binaries
Pre-built binaries can be found attached on each release, for Linux on both `x86_64` and `aarch64` architectures.
- [`mas-cli-aarch64-linux.tar.gz`](https://github.com/element-hq/matrix-authentication-service/releases/latest/download/mas-cli-aarch64-linux.tar.gz)
- [`mas-cli-x86_64-linux.tar.gz`](https://github.com/element-hq/matrix-authentication-service/releases/latest/download/mas-cli-x86_64-linux.tar.gz)
Each archive contains:
- the `mas-cli` binary
- assets needed for running the service, including:
- `share/assets/`: the built frontend assets
- `share/manifest.json`: the manifest for the frontend assets
- `share/policy.wasm`: the built OPA policies
- `share/templates/`: the default templates
- `share/translations/`: the default translations
The location of all these assets can be overridden in the [configuration file](./configuration.md).
---
Example shell commands to download and extract the `mas-cli` binary:
```sh
ARCH=x86_64 # or aarch64
OS=linux
VERSION=latest # or a specific version, like "v0.1.0"
# URL to the right archive
URL="https://github.com/element-hq/matrix-authentication-service/releases/${VERSION}/download/mas-cli-${ARCH}-${OS}.tar.gz"
# Create a directory and extract the archive in it
mkdir -p /path/to/mas
curl -sL "$URL" | tar xzC /path/to/mas
# This should display the help message
/path/to/mas/mas-cli --help
```
## Using the Docker image
A pre-built Docker image is available here: [`ghcr.io/element-hq/matrix-authentication-service:latest`](https://ghcr.io/element-hq/matrix-authentication-service:latest)
The `latest` tag is built using the latest release.
The `main` tag is built from the `main` branch, and each commit on the `main` branch is also tagged with a stable `sha-<commit sha>` tag.
The image can also be built from the source:
1. Get the source
```sh
git clone https://github.com/element-hq/matrix-authentication-service.git
cd matrix-authentication-service
```
1. Build the image
```sh
docker build -t mas .
```
## Building from the source
Building from the source requires:
- The [Rust toolchain](https://www.rust-lang.org/learn/get-started) pinned by `rust-toolchain.toml` (installed automatically by rustup)
- [Node.js (24 and later)](https://nodejs.org/en/), with [corepack](https://nodejs.org/api/corepack.html) enabled so pnpm@11 is provisioned automatically
- the [Open Policy Agent](https://www.openpolicyagent.org/docs/latest/#running-opa) binary (or alternatively, Docker)
1. Get the source
```sh
git clone https://github.com/element-hq/matrix-authentication-service.git
cd matrix-authentication-service
```
1. Build the frontend
```sh
corepack enable
pnpm install # installs deps for the workspace; run from the repo root
cd frontend
pnpm run build
cd ..
```
This will produce a `frontend/dist` directory containing the built frontend assets.
This folder, along with the `frontend/dist/manifest.json` file, can be relocated, as long as the configuration file is updated accordingly.
1. Build the Open Policy Agent policies
```sh
cd policies
make
cd ..
```
OR, if you don't have `opa` installed and want to build through the OPA docker image
```sh
cd policies
make DOCKER=1
cd ..
```
This will produce a `policies/policy.wasm` file containing the built OPA policies.
This file can be relocated, as long as the configuration file is updated accordingly.
1. Compile the CLI
```sh
cargo build --release
```
1. Grab the built binary
```sh
cp ./target/release/mas-cli ~/.local/bin # Copy the binary somewhere in $PATH
mas-cli --help # Should display the help message
```
## Next steps
The service needs some configuration to work.
This includes random, private keys and secrets.
Follow the [configuration guide](./general.md) to configure the service.