Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Building from Source

This guide covers building job-orchestrator from source code.

Prerequisites

Rust Toolchain

Install Rust via rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Minimum version: Rust 1.88 (edition 2024, uses let chains)

Verify installation:

rustc --version
cargo --version

System Dependencies

Only a C compiler is needed. SQLite is compiled from source and linked statically through sqlx’s bundled SQLite, and TLS uses rustls, so no system SQLite or OpenSSL libraries are required.

Debian/Ubuntu

apt-get update
apt-get install -y build-essential

Fedora/RHEL

dnf install gcc

macOS

xcode-select --install

Windows

The code compiles with the Visual Studio Build Tools, but client mode runs jobs through bash and the kill command, so it is not supported on Windows. Use WSL or a Linux container.

Clone Repository

git clone https://codeberg.org/rvhonorato/job-orchestrator.git
cd job-orchestrator

Build Commands

Debug Build

Fast compilation, includes debug symbols:

cargo build

Binary location: target/debug/job-orchestrator

Release Build

Optimized for performance:

cargo build --release

Binary location: target/release/job-orchestrator

Check (No Build)

Verify code compiles without producing binary:

cargo check

Running

From Cargo

# Server mode
PORT=5000 cargo run -- server

# Client mode
PORT=9000 cargo run -- client

From Binary

# After release build
PORT=5000 ./target/release/job-orchestrator server

Build Options

Features

Currently no optional features. All functionality is included by default.

Target Platforms

Cross-compile for different targets:

# Add target
rustup target add x86_64-unknown-linux-musl

# Build for target
cargo build --release --target x86_64-unknown-linux-musl

Common targets:

  • x86_64-unknown-linux-gnu - Linux (glibc)
  • x86_64-unknown-linux-musl - Linux (static)
  • x86_64-apple-darwin - macOS Intel
  • aarch64-apple-darwin - macOS Apple Silicon
  • x86_64-pc-windows-msvc - Windows (builds, but client mode does not work there)

Docker Build

Using Dockerfile

# Build the job-orchestrator image (server, and base for clients)
docker build -t job-orchestrator .

# Build the example client image (adds gdock on top of the local image)
docker build --build-arg BASE_IMAGE=job-orchestrator -t job-orchestrator-client example/

Multi-stage Build

The Dockerfile produces a minimal Alpine image with the binary, bash, and sqlite. Where the binary comes from is picked with the BINARY_SOURCE build argument:

  1. build (default): compiles job-orchestrator from source with the full Rust toolchain
  2. prebuilt: copies an already compiled static (musl) binary from dist/job-orchestrator. CI uses this: it compiles the binary in a separate job (with caching) and only packages it with buildah
cargo build --release --target x86_64-unknown-linux-musl
mkdir -p dist && cp target/x86_64-unknown-linux-musl/release/job-orchestrator dist/
docker build --build-arg BINARY_SOURCE=prebuilt -t job-orchestrator .

The image has no application in it. example/Dockerfile builds a client image on top of it with the example application (gdock) compiled from source.

See Also