Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
79e6463
dylib
danielgerlag Feb 25, 2026
78c37db
wip
danielgerlag Feb 25, 2026
b18d730
wip
danielgerlag Feb 25, 2026
1f0d425
cdylib
danielgerlag Feb 26, 2026
8c809dd
Add ffi-primitives patch for local development
danielgerlag Feb 26, 2026
c7479dc
copilot eish
danielgerlag Feb 26, 2026
3f67929
cargo fmt
danielgerlag Feb 26, 2026
1f2a344
makefile
danielgerlag Feb 27, 2026
6b8fed6
build
danielgerlag Feb 27, 2026
556a715
build
danielgerlag Feb 27, 2026
d5fa86c
build
danielgerlag Feb 27, 2026
a59d7f7
openapi discrimonator
danielgerlag Feb 27, 2026
6bd027f
namespaced dtos
danielgerlag Feb 27, 2026
9c74351
build
danielgerlag Feb 27, 2026
d9a0cc4
build
danielgerlag Feb 27, 2026
4e8e795
build
danielgerlag Feb 27, 2026
cd25cb9
plugin registry
danielgerlag Feb 27, 2026
dadb85e
plugins
danielgerlag Feb 28, 2026
2a21a7d
plugin directory
danielgerlag Feb 28, 2026
1f08619
plugin upgrades
danielgerlag Feb 28, 2026
17e7be3
plugin command
danielgerlag Mar 2, 2026
0898e83
pr feedback
danielgerlag Mar 2, 2026
af2a600
simplify build
danielgerlag Mar 3, 2026
bdc4377
update examples
danielgerlag Mar 3, 2026
b5892c9
examples
danielgerlag Mar 3, 2026
18d5a48
plugin signing
danielgerlag Mar 3, 2026
fc56894
plugin sigs
danielgerlag Mar 3, 2026
efef564
plugin signing
danielgerlag Mar 3, 2026
48172f1
cargo fmt
danielgerlag Mar 3, 2026
7223b3e
clippy
danielgerlag Mar 3, 2026
1bc542d
Merge remote-tracking branch 'origin/main' into component-plugins
danielgerlag Mar 3, 2026
aaefd26
fix tests
danielgerlag Mar 3, 2026
f1e7647
signature tampering
danielgerlag Mar 4, 2026
adfa15b
plug list
danielgerlag Mar 4, 2026
53b08ba
organize plugin commands
danielgerlag Mar 4, 2026
63b7bf8
windows build
danielgerlag Mar 4, 2026
3528ab8
build scripts
danielgerlag Mar 4, 2026
0951f78
windows build
danielgerlag Mar 5, 2026
f11f7c0
gitignore
danielgerlag Mar 5, 2026
108bab6
windows build
danielgerlag Mar 5, 2026
433b6e1
windows build
danielgerlag Mar 5, 2026
edbb900
build
danielgerlag Mar 5, 2026
cd0c3b4
plugin integrity check
danielgerlag Mar 5, 2026
976b6da
tests
danielgerlag Mar 5, 2026
1edf50f
fix yaml
danielgerlag Mar 5, 2026
377a3af
pr feedback
danielgerlag Mar 5, 2026
b134b9b
plugin wildcards
danielgerlag Mar 6, 2026
722be9d
pr feedback
danielgerlag Mar 6, 2026
f5000e7
lint
danielgerlag Mar 9, 2026
b96d606
bump versions
danielgerlag Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Cargo configuration for drasi-server
#
# cargo xtask alias — run `cargo xtask vendor push/pull/list`
[alias]
xtask = "run --package xtask --"

# To use local path-based dependencies for development:
# 1. Uncomment the [patch.crates-io] section in Cargo.toml
# 1. Uncomment the [patch.crates-io] section
# 2. Run: cargo build
#
# To use published crates from crates.io:
# 1. Keep the [patch.crates-io] section commented out in Cargo.toml
# 1. Keep the [patch.crates-io] section commented
# 2. Run: cargo build

# Cross-compilation target flags (used by `cross` tool)
Expand All @@ -17,3 +21,40 @@ rustflags = ["-C", "target-feature=-crt-static"]

[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "target-feature=+crt-static"]

# Vendored native library overrides for Windows MSVC
# These override the jq-sys and openssl-sys build scripts to use pre-built
# static libraries from vendor/x86_64-pc-windows-msvc/lib/.
# On non-MSVC targets, these overrides are ignored and the -sys crates
# use their normal discovery (pkg-config, vendored build, etc.).
[target.x86_64-pc-windows-msvc.jq]
rustc-link-lib = ["static:-bundle=jq"]
rustc-link-search = ["native=vendor/x86_64-pc-windows-msvc/lib"]

[target.x86_64-pc-windows-msvc.openssl]
rustc-link-lib = ["static:-bundle=libssl", "static:-bundle=libcrypto", "dylib=crypt32", "dylib=ws2_32", "dylib=advapi32", "dylib=user32"]
rustc-link-search = ["native=vendor/x86_64-pc-windows-msvc/lib"]
rustc-cfg = ["openssl", "ossl101", "ossl102", "ossl102f", "ossl102h", "ossl110", "ossl110f", "ossl110g", "ossl110h", "ossl111", "ossl111b", "ossl111c", "ossl111d", "ossl300", "ossl320", "ossl330", "ossl340", "ossl350"]
version_number = "30600000"
include = "vendor/x86_64-pc-windows-msvc/include"

# [patch.crates-io]
# drasi-plugin-sdk = { path = "../drasi-core/components/plugin-sdk" }
# drasi-ffi-primitives = { path = "../drasi-core/components/ffi-primitives" }
# drasi-core = { path = "../drasi-core/core" }
# drasi-lib = { path = "../drasi-core/lib" }
# drasi-query-ast = { path = "../drasi-core/query-ast" }
# drasi-query-cypher = { path = "../drasi-core/query-cypher" }
# drasi-query-gql = { path = "../drasi-core/query-gql" }
# drasi-functions-cypher = { path = "../drasi-core/functions-cypher" }
# drasi-functions-gql = { path = "../drasi-core/functions-gql" }
# drasi-middleware = { path = "../drasi-core/middleware" }
# drasi-source-application = { path = "../drasi-core/components/sources/application" }
# drasi-bootstrap-application = { path = "../drasi-core/components/bootstrappers/application" }
# drasi-bootstrap-noop = { path = "../drasi-core/components/bootstrappers/noop" }
# drasi-reaction-application = { path = "../drasi-core/components/reactions/application" }
# drasi-index-rocksdb = { path = "../drasi-core/components/indexes/rocksdb" }
# drasi-index-garnet = { path = "../drasi-core/components/indexes/garnet" }
# drasi-state-store-redb = { path = "../drasi-core/components/state_stores/redb" }
# drasi-mssql-common = { path = "../drasi-core/components/mssql-common" }
# drasi-host-sdk = { path = "../drasi-core/components/host-sdk" }
61 changes: 57 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,53 @@ jobs:
path: drasi-server-x86_64-windows.exe
if-no-files-found: error

# Windows MSVC native build (uses vendored static libs for jq and OpenSSL)
build-windows-msvc:
name: Build Windows MSVC (x86_64)
runs-on: windows-latest
needs: determine-version
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Pull vendored native libraries
shell: bash
run: cargo xtask vendor pull x86_64-pc-windows-msvc --tag v1

- name: Build binary
shell: bash
run: |
cargo build --release --target x86_64-pc-windows-msvc --bin drasi-server

SRC_BINARY="target/x86_64-pc-windows-msvc/release/drasi-server.exe"
ARTIFACT_NAME="drasi-server-x86_64-windows-msvc.exe"

echo "=== Build output ==="
ls -lh "$SRC_BINARY" || true
file "$SRC_BINARY" || true

if [[ -f "$SRC_BINARY" ]]; then
cp "$SRC_BINARY" "$ARTIFACT_NAME"
echo "✓ Built $ARTIFACT_NAME ($(du -h "$ARTIFACT_NAME" | cut -f1))"
else
echo "Error: Built binary not found at $SRC_BINARY"
echo "=== release directory listing ==="
ls -la "target/x86_64-pc-windows-msvc/release/" || true
exit 1
fi

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: drasi-server-x86_64-windows-msvc
path: drasi-server-x86_64-windows-msvc.exe
if-no-files-found: error

# ─── SSE CLI builds (pure Rust, no C dependencies) ───

# Build all Linux SSE CLI binaries using cross
Expand Down Expand Up @@ -565,7 +612,8 @@ jobs:
echo "Binary artifacts are available as workflow artifacts for the following targets:" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-aarch64-apple-darwin\` (macOS ARM64 / Apple Silicon)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-x86_64-apple-darwin\` (macOS x86_64 / Intel)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-x86_64-windows.exe\` (Windows x86_64)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-x86_64-windows.exe\` (Windows x86_64 MinGW)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-x86_64-windows-msvc.exe\` (Windows x86_64 MSVC)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-aarch64-linux-gnu\` (Linux ARM64 glibc)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-x86_64-linux-gnu\` (Linux x86_64 glibc)" >> $GITHUB_STEP_SUMMARY
echo "- \`drasi-server-aarch64-linux-musl\` (Linux ARM64 musl)" >> $GITHUB_STEP_SUMMARY
Expand All @@ -584,7 +632,7 @@ jobs:
# Smoke-test each binary with the hello-world (mock source) config
test-binaries:
name: Test ${{ matrix.artifact_suffix }}
needs: [build-linux, build-macos, build-windows]
needs: [build-linux, build-macos, build-windows, build-windows-msvc]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
Expand All @@ -606,10 +654,14 @@ jobs:
- artifact_suffix: aarch64-linux-gnu
runner: ubuntu-24.04-arm
binary_name: "drasi-server-aarch64-linux-gnu"
# Windows x86_64
# Windows x86_64 (MinGW)
- artifact_suffix: x86_64-windows
runner: windows-latest
binary_name: "drasi-server-x86_64-windows.exe"
# Windows x86_64 (MSVC)
- artifact_suffix: x86_64-windows-msvc
runner: windows-latest
binary_name: "drasi-server-x86_64-windows-msvc.exe"
# Linux x86_64 (musl) — tested inside Alpine container
- artifact_suffix: x86_64-linux-musl
runner: ubuntu-latest
Expand Down Expand Up @@ -746,7 +798,8 @@ jobs:
- x86_64 (Intel) - `drasi-server-x86_64-apple-darwin`

### Windows
- x86_64 - `drasi-server-x86_64-windows.exe`
- x86_64 (MinGW) - `drasi-server-x86_64-windows.exe`
- x86_64 (MSVC) - `drasi-server-x86_64-windows-msvc.exe`

### Linux (glibc)
- ARM64 - `drasi-server-aarch64-linux-gnu`
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ logs/
# Cargo install metadata
.crates.toml
.crates2.json

# Vendored native libraries (downloaded from OCI registry)
vendor/
26 changes: 24 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ This is the Drasi Server repository - a standalone server wrapper around DrasiLi
### Build and Run
- Build: `cargo build`
- Build release: `cargo build --release`
- Cross-compile: `make build-cross TARGET=x86_64-pc-windows-gnu`
- Run server: `cargo run` or `cargo run -- --config config/server.yaml`
- Run with custom port: `cargo run -- --port 8080`
- Run with plugin verification: `cargo run -- --verify-plugins --config config/server.yaml`
- Check compilation: `cargo check`

### Plugin Loading
Plugins (sources, reactions, bootstrap providers) are loaded at runtime as cdylib shared libraries (`.so`/`.dylib`/`.dll`) from a `plugins/` directory next to the binary. Each plugin is self-contained with its own tokio runtime, communicating via a stable C ABI. Plugin building is managed by drasi-core, not this repository.

### Testing
- Run all tests: `cargo test`
- Run unit tests only: `cargo test --lib`
- Run specific test: `cargo test test_name`
- Run integration tests: `./tests/run_working_tests.sh`
- Run plugin smoke tests: `make test-smoke`
- Run with logging: `RUST_LOG=debug cargo test -- --nocapture`
- Run host-sdk integration tests: `cd ../drasi-core && cargo test -p drasi-host-sdk --test integration_test`

### Code Quality
- Format code: `cargo fmt`
Expand All @@ -42,6 +49,7 @@ This repository contains only the server wrapper functionality:
- `mappings/` - DTO to domain model conversions
3. **Builder** (`src/builder.rs`) - Builder pattern for server construction
4. **Main** (`src/main.rs`) - CLI entry point for standalone server
5. **Dynamic Loading** (`src/dynamic_loading.rs`) - Runtime plugin loading from shared libraries

### Core Components (External Dependency)

Expand Down Expand Up @@ -94,6 +102,12 @@ port: 8080
logLevel: "info"
persistConfig: true # Enable persistence (default)
persistIndex: false # Use RocksDB for persistent indexing (default: false, uses in-memory)
verifyPlugins: true # Enable cosign signature verification for downloaded plugins (default: false)

# Optional trusted identities for plugin signature verification
# trustedIdentities:
# - issuer: "https://accounts.google.com"
# subjectPattern: "builder@my-org.iam.gserviceaccount.com"

# Optional state store for plugin state persistence
# stateStore:
Expand Down Expand Up @@ -252,6 +266,11 @@ server.run().await?;
- API tests: `tests/api/`
- Protocol tests: `tests/grpc/`, `tests/http/`, `tests/postgres/`
- End-to-end tests: Files ending with `_e2e_test.rs`
- Host-SDK integration tests: `../drasi-core/components/host-sdk/tests/integration_test.rs`
- Tests load real cdylib plugins (mock source, log reaction) and exercise the full
dynamic loading pipeline including metadata validation, callbacks, factory invocation,
and lifecycle management through FFI vtables.
- Prerequisites: build plugins in drasi-core with `make build-cdylib-plugins`

### Running Tests
- Always run `cargo test` before committing
Expand Down Expand Up @@ -404,7 +423,10 @@ server.run().await?;

### Important Notes
- The core functionality is provided by the external `drasi-lib` library
- Sources and reactions are plugins that must be provided as instances (no YAML configuration)
- Queries can be created via the builder pattern
- Plugins (sources, reactions, bootstrappers) use `cdylib` crate-type and export `drasi_plugin_init()` / `drasi_plugin_metadata()` entry points
- Plugins are loaded as self-contained cdylib `.so`/`.dylib`/`.dll` files at runtime via `drasi-host-sdk`
- Each cdylib plugin has its own tokio runtime and communicates with the host via `#[repr(C)]` vtable structs (stable C ABI)
- Plugin metadata validation checks SDK version (major.minor match) and target triple at load time
- All data processing logic resides in drasi-lib
- This repository focuses on API and server lifecycle management
- Plugin signature verification is available via `--verify-plugins` CLI flag or `verifyPlugins: true` in config. Uses Sigstore/cosign keyless verification against the Rekor transparency log.
Loading
Loading