Build from Source
3 minute read
Building Drasi Server Drasi Server A standalone Data Change Processing server running as a process or Docker container. Learn more from source gives you full control over the build process and allows you to contribute to the project or create custom builds.
Prerequisites
- Rust 1.88 or later
- Git
- C compiler (for native dependencies)
Install Rust
Install Rust using rustup, the official Rust toolchain installer. Follow the instructions for your platform on the rustup website.
After installation, verify Rust is available:
rustc --version
cargo --version
Native Dependencies
Building drasi-server requires several native C libraries. Install the dependencies for your platform:
macOS
Xcode Command Line Tools provide clang and perl. Install the remaining dependencies with Homebrew:
brew install protobuf
Debian / Ubuntu
perl is pre-installed. Install everything else with:
sudo apt-get install -y libssl-dev pkg-config clang libclang-dev libjq-dev libonig-dev protobuf-compiler
Windows
Building natively on Windows requires MSYS2, LLVM, Strawberry Perl, and protoc.
1. Install MSYS2
MSYS2 provides Unix-like build tools and C libraries needed for native dependencies (OpenSSL, RocksDB, etc.).
winget install MSYS2.MSYS2
Then install the required packages:
pacman -S --noconfirm `
make `
perl `
mingw-w64-ucrt-x86_64-gcc `
mingw-w64-ucrt-x86_64-pkg-config `
mingw-w64-ucrt-x86_64-clang
2. Install LLVM
winget install LLVM.LLVM
3. Install Strawberry Perl
Note: MSYS2’s
perlmust appear before Strawberry Perl on PATH. OpenSSL’s build requires Unix-like paths that only MSYS2’s perl provides.
winget install StrawberryPerl.StrawberryPerl
4. Install Protocol Buffers Compiler
winget install Google.Protobuf
If protoc is not on your PATH after installation:
$env:PROTOC = "C:\path\to\protoc.exe"
5. Switch to the GNU Toolchain
This project’s rust-toolchain.toml pins Rust 1.88.0 and defaults to the MSVC target.
Since we link against MSYS2 libraries, we need the GNU toolchain. Setting $env:RUSTUP_TOOLCHAIN
overrides rust-toolchain.toml (note: rustup default alone is not sufficient).
rustup toolchain install 1.88.0-x86_64-pc-windows-gnu
$env:RUSTUP_TOOLCHAIN = "1.88.0-x86_64-pc-windows-gnu"
6. Set PATH
MSYS2 paths must come before Strawberry Perl so that OpenSSL uses MSYS2’s Unix-like perl:
$env:PATH = "C:\msys64\ucrt64\bin;C:\msys64\usr\bin;C:\Strawberry\perl\bin;" + $env:PATH
7. Set Tool Paths
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"
Clone the Drasi Server Repository
git clone https://github.com/drasi-project/drasi-server.git
cd drasi-server
Build Options
Debug Build
For development and debugging (faster compile, slower runtime):
cargo build
The binary will be at target/debug/drasi-server.
Release Build
For production use (optimized, faster runtime):
cargo build --release
The binary will be at target/release/drasi-server.
Configuration
Create Configuration File
Drasi Server requires a configuration file that defines your sources, queries, and reactions.
Create a configuration yaml file for Drasi Server. See the Configuration Reference for details on all available configuration options.
Alternatively, use the init command to create a starter configuration file:
cargo run --release -- init --output config/server.yaml
Validate Configuration
Check your configuration file without starting the server:
cargo run --release -- validate --config config/server.yaml
# Show resolved environment variables
cargo run --release -- validate --config config/server.yaml --show-resolved
Check System Dependencies
cargo run --release -- doctor
# Include optional dependencies
cargo run --release -- doctor --all
Run Drasi Server
Using Cargo
# Debug mode
cargo run -- --config config/server.yaml
# Release mode
cargo run --release -- --config config/server.yaml
Using the Binary Directly
# After building
./target/release/drasi-server --config config/server.yaml
Feedback
Was this page helpful?
Glad to hear it! Please tell us what you found helpful.
Sorry to hear that. Please tell us how we can improve.