Axum Adapter
The Axum adapter runs Mocktioneer as a native Rust HTTP server. It's the recommended choice for local development and integration testing.
Overview
| Property | Value |
|---|---|
| Crate | mocktioneer-adapter-axum |
| Target | Native (no WASM) |
| Default Port | 8787 |
| Use Case | Development, testing, CI/CD |
Quick Start
# One-time: create the local config and push it (auction/APS are fail-loud)
cp mocktioneer.toml.example mocktioneer.toml
cargo run -p mocktioneer-cli -- config push --adapter axum --yes
cargo run -p mocktioneer-adapter-axumThe server starts at http://127.0.0.1:8787. Axum reads the pushed blob from ./.edgezero/local-config-mocktioneer_config.json once at startup, so re-run config push and restart after changing bid_cpm. (Static/pixel/sizes endpoints work without a pushed config.)
Using the CLI
edgezero-cli serve --adapter axum
# or, in-repo (no external install):
cargo run -p mocktioneer-cli -- serve --adapter axumThis executes the command defined in edgezero.toml:
[adapters.axum.commands]
serve = "cargo run -p mocktioneer-adapter-axum"Configuration
Build Settings
[adapters.axum.build]
target = "native"
profile = "dev"The Axum adapter uses:
- Native compilation (not WASM)
- Dev profile for faster builds during development
Logging
[adapters.axum.logging]
level = "info"
echo_stdout = trueLogs are written to stdout. Adjust level for more or less verbosity:
trace- Most verbosedebug- Debug informationinfo- Normal operation (default)warn- Warnings onlyerror- Errors only
Docker Deployment
The repository ships a multi-stage Dockerfile (also built and pushed to ghcr.io/stackpop/mocktioneer by CI). The build seeds the default typed-config blob into /app/.edgezero/, so the OpenRTB/APS endpoints work out of the box (they read bid_cpm via the fail-loud AppConfig extractor and would otherwise 503 until a blob is pushed):
# Build the image
docker build -t mocktioneer:latest .
# Run on default port
docker run -p 8787:8787 mocktioneer:latest
# Run on custom port
docker run -p 3000:8787 mocktioneer:latestTo override the baked-in config, mount your own blob over the seeded file:
docker run -p 8787:8787 \
-v "$PWD/.edgezero/local-config-mocktioneer_config.json:/app/.edgezero/local-config-mocktioneer_config.json:ro" \
mocktioneer:latestDevelopment Workflow
Hot Reloading
For automatic rebuilds during development, use cargo-watch:
cargo install cargo-watch
cargo watch -x 'run -p mocktioneer-adapter-axum'Running Tests
# All tests
cargo test
# Core tests only
cargo test -p mocktioneer-core
# Specific test
cargo test handle_openrtb_auctionDebugging
Standard Rust debugging works with the Axum adapter:
# With RUST_BACKTRACE
RUST_BACKTRACE=1 cargo run -p mocktioneer-adapter-axum
# With debug logging
RUST_LOG=debug cargo run -p mocktioneer-adapter-axumPerformance Testing
The Axum adapter is suitable for local performance testing:
# Using wrk
wrk -t4 -c100 -d30s http://127.0.0.1:8787/
# Using hey
hey -n 10000 -c 100 http://127.0.0.1:8787/openrtb2/auction \
-m POST \
-H "Content-Type: application/json" \
-d '{"id":"test","imp":[{"id":"1","banner":{"w":300,"h":250}}]}'Differences from Edge Adapters
The Axum adapter behaves identically to edge adapters for request handling, but:
| Feature | Axum | Edge (Fastly/Cloudflare) |
|---|---|---|
| Startup time | Instant | Cold start possible |
| Debugging | Full access | Limited |
| KV stores | Not available | Platform-specific |
| Logging | stdout | Platform logging |
Customization
To customize the Axum adapter behavior, edit:
crates/mocktioneer-adapter-axum/src/main.rs- Entrypointcrates/mocktioneer-adapter-axum/axum.toml- Adapter-specific config
Example: changing the listen address would require modifying the adapter code.
Next Steps
- Try the Fastly adapter for edge deployment
- Try the Cloudflare adapter for Workers deployment
- Check the API reference for testing endpoints