Development Setup
Development Setup
Section titled “Development Setup”This page covers everything you need to build, test, and iterate on Dwaar locally.
Quick Start
Section titled “Quick Start”The repository ships two helpers that compress the path from clone to a passing build:
# 1. Clone and entergit clone https://github.com/permanu/Dwaar.gitcd Dwaar
# 2. Verify toolchain + dry-run workspace check./scripts/check-dev-env.sh
# 3. Narrow parser test — compiles fastestjust test-crate dwaar-config
# 4. Full workspace testjust test
# 5. Lint before opening a PRjust lint./scripts/check-dev-env.sh confirms rustc, cargo, and openssl are on the PATH and runs a cargo check --workspace --all-targets dry run so broken toolchains fail here rather than halfway through a 10-minute test. The script emits no output on success — failure prints the missing tool and exits non-zero.
The Justfile at the repo root defines the common recipes used by CI and developers:
| Recipe | Command | Use for |
|---|---|---|
just test | cargo test --workspace | Full default-feature workspace test suite. |
just test-crate <crate> | cargo test -p <crate> | Narrow feedback loop on a single crate. |
just lint | cargo fmt && cargo clippy --workspace -- -D warnings | Format and zero-warnings lint. |
just build-release | cargo build --workspace --release | Release-profile workspace build. |
just ci | Format + lint + test + build. | What CI runs; run locally before opening a PR. |
just quick | Fastest-feedback test subset. | Sanity check between keystrokes. |
Install just with cargo install just if you do not already have it. The raw cargo commands below still work and produce the same result — just is a convenience, not a requirement.
For the complete onboarding walkthrough (prerequisites, commit convention, release workflow), see CONTRIBUTING.md in the repository root.
Prerequisites
Section titled “Prerequisites”| Requirement | Notes |
|---|---|
| Rust (stable) | Install via rustup. Dwaar tracks the current stable toolchain. |
| OpenSSL headers | libssl-dev (Debian/Ubuntu), openssl-devel (Fedora), or brew install openssl (macOS). |
| Docker | Required only if you want to run integration tests that exercise Docker label discovery. |
| MaxMind GeoLite2 DB | Optional. Needed to build/run with the geo feature enabled. Download from MaxMind. |
| Wasmtime | Optional. Needed to build/run with the wasm-plugins feature enabled. |
Building
Section titled “Building”Build the entire workspace:
cargo build --workspaceBuild with optional features:
# Enable GeoIP supportcargo build --workspace --features geo
# Enable WASM plugin supportcargo build --workspace --features wasm-plugins
# Enable bothcargo build --workspace --features geo,wasm-pluginsBuild a release binary:
cargo build --release -p dwaar-ingressThe resulting binary is at target/release/dwaar.
Running Tests
Section titled “Running Tests”Run the full unit test suite:
cargo test --workspaceRun tests for a single crate:
cargo test -p dwaar-configRun integration tests (requires Docker):
cargo test --workspace --test '*'CI deliberately excludes test suites that need external runtime dependencies:
dwaar-cli’s proxy_integration.rs requires a live Dwaar process on a fixed
port, and dwaar-ingress Kubernetes tests are gated behind the
k8s-integration feature because they require a reachable cluster such as
kind. Run those suites explicitly when you have the dependency available:
cargo test -p dwaar-cli --test proxy_integrationcargo test -p dwaar-ingress --features k8s-integration -- --test-threads=1Benchmarks (requires nightly for some):
cargo bench -p dwaar-logCode Style
Section titled “Code Style”All contributions must pass these checks before opening a PR:
# Formattingcargo fmt --all -- --check
# Lints (zero warnings policy)cargo clippy --workspace --all-targets -- -D warnings
# Testscargo test --workspaceThe CI pipeline enforces all three. Run them locally first to avoid round trips.
Additional standards:
- Every public function and type must have a doc comment.
- New async code must not call
tokio::spawnat request time; use aBackgroundServiceinstead. - Unsafe blocks require a
// SAFETY:comment explaining the invariant.
Project Structure
Section titled “Project Structure”Dwaar is a Cargo workspace. Each crate has a single, focused responsibility:
dwaar-ingress— binary entry point and Pingora server bootstrapdwaar-cli— CLI argument parsingdwaar-core— the hot-pathProxyHttpimplementationdwaar-config— Dwaarfile parsing and hot-reloaddwaar-tls— ACME and SNIdwaar-analytics— JS injection, beacon collection, Prometheusdwaar-plugins— plugin trait and built-in middlewaredwaar-admin— admin APIdwaar-docker— Docker label discoverydwaar-geo— GeoIP lookupsdwaar-log— async request logging
See the Crate Map for per-crate dependency graphs and interface details.
Related
Section titled “Related”- Architecture Overview
- Architecture for Contributors
- CONTRIBUTING.md — PR process, commit convention, release workflow