Compiling Stalwart
Compiling Stalwart from the source has the main advantage that binaries are built with optimizations specific to your hardware which may result in better performance. Another advantage is that you may enable or disable features to suit your needs, thus reducing the size of the binary and the memory footprint.
Install Rust
Section titled “Install Rust”To compile Stalwart you need the latest version of Rust. The fastest way to install rust is with rustup. On Unix systems run the following in your terminal, then follow the onscreen instructions
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shIf you are running Windows 64-bit, download and run rustup‑init.exe, then follow the onscreen instructions.
Clone the repository
Section titled “Clone the repository”Clone the Stalwart repository:
$ git clone https://github.com/stalwartlabs/stalwart.git$ cd stalwartFind and then check out the latest tagged release, for example:
$ git tag --sort=-version:refname | head -1v0.13.0$ git checkout tags/v0.13.0Install any required dependencies
Section titled “Install any required dependencies”If you are compiling the Foundation DB backend, download and install the Foundation DB client library.
Compile
Section titled “Compile”For example, to compile Stalwart with the RocksDB, ElasticSearch support and Enterprise features:
$ cargo build --release -p stalwart --no-default-features --features "rocks elastic redis enterprise"Or, to compile the FoundationDB backend:
$ cargo build --release -p stalwart --no-default-features --features "foundationdb enterprise"Once the compilation process is completed, the Stalwart binary will be available under target/release/stalwart.
Available Features
Section titled “Available Features”You can enable the following features when compiling Stalwart by using the --features flag:
Data store backends
Section titled “Data store backends”rocks: RocksDB backendsqlite: SQLite backendfoundationdb: FoundationDB backendpostgres: PostgreSQL backendmysql: MySQL backend
Blob store backends
Section titled “Blob store backends”s3: S3 backendazure: Azure backend
FTS backends
Section titled “FTS backends”elastic: ElasticSearch backend
In-memory backends
Section titled “In-memory backends”redis: Redis backend
Message queue backends
Section titled “Message queue backends”nats: NATS backendzenoh: Eclipse Zenoh backendkafka: Kafka backend
Other features
Section titled “Other features”enterprise: Enterprise features