A production-grade, wire-compatible simulation of the Bacula Enterprise REST API
What it is
The Bacula Mock Server is a standalone Python server that speaks the same wire protocol as Bacula Enterprise’s REST API. It accepts the same requests, returns the same JSON field sets, and enforces the same OAuth2 token lifecycle — down to the 12-second token lifetime.
You get realistic catalog data out of the box: 30+ pre-built client profiles covering mail servers, databases, Kubernetes nodes, VMware hosts, SAP HANA systems, and more. Each profile generates historically accurate job records — ascending job IDs, realistic file counts, profile-specific error messages — matching exactly what a real Bacula Director would return.
No Director. No Storage Daemon. No File Daemon. No license. One command and you’re running a complete Bacula environment.
# Start the server bacula-mock start # Generate 100 clients, 10% failure rate bacula-mock init 100 0.10 # Query just like the real Bacula API bacula-mock clients ┌──────────────────────┬────────────┐ │ mail-srv-001 │ mail │ │ db-postgres-003 │ database │ │ k8s-node-05 │ kubernetes │ │ vmware-esxi-02 │ vmware │ └──────────────────────┴────────────┘ # Full test suite in ~25 seconds python3 tests/bacula_mock_test.py --local 247 tests passed · 0 failed
Why use it
Every team working with Bacula runs into the same friction. The mock server removes it.
Spin up a complete Bacula API environment in under 60 seconds. No Director setup, no storage pools, no daemon handshakes. Install, start, initialize — done.
247+ endpoint tests run in ~25 seconds with zero external dependencies. Each run is isolated — reset to a clean state in milliseconds. Your pipeline never touches production data.
Set any job failure rate from 0 % to 100 % at initialization time. Build and verify error-handling logic, alerting rules, and retry policies against realistic failure scenarios.
Every response matches Bacula Enterprise field names, field counts, and data types exactly. Code that passes here passes against production — no surprises at deployment time.
Give administrators hands-on Bacula API experience without any risk to production. Run commands, explore endpoints, make mistakes — everything is stateless and instantly reversible.
OAuth2 Bearer tokens with a 12-second lifetime, HTTP Basic Auth fallback, and TLS support — the same auth model as production, so your integration is production-ready from day one.
Use cases
Whether you’re shipping a monitoring dashboard, wiring up CI, or training a new administrator, there’s a workflow for you.
Build monitoring interfaces and admin portals against a full Bacula API with realistic data — without waiting for access to a development Director.
The server starts in-process, runs all 247 endpoint tests, and exits cleanly in under 30 seconds — no external cleanup, no external dependencies.
Set precise job failure rates and reproduce specific error patterns using profile-specific messages that match real Bacula output.
Pair it with BWeb Management Suite for a complete training setup — interface and API together, with zero risk to production systems.
Realistic client profiles covering mail servers, databases, Kubernetes clusters, VMware hosts, and SAP HANA systems. No production data, always available.
Benchmark your API client using ab, wrk, or hey against a fully thread-safe server — without load on your production Director.
Features
Full Bacula API surface area, a lean footprint, and an idempotent installer that handles every supported OS automatically.
Clients, Jobs, JobLogs, Pools, Storage, Media, JobTotals — with pagination, filtering, and sorting.
run, restore, cancel, estimate, label, purge, prune, delete — all respond realistically.
Director, client, and storage daemon status including running jobs and next scheduled jobs.
Virtual file system endpoints for restore simulation — browse directories and select files.
/res/ and /configure endpoints for reading and writing Director, FD, and SD configurations.
Auto-start on boot, auto-restart on failure, journald logging — ready for persistent dev environments.
Swagger UI at /docs and ReDoc at /redoc — explore and test every endpoint in the browser.
SQLite sync script mirrors mock data to the Bacula v1027 schema so BWeb Management Suite connects directly.
Debian, Ubuntu, RHEL, Fedora, macOS. Detects OS, sets up a Python venv, registers the service automatically.
Python test suite (13 parts) plus a pre-compiled C test binary for Linux, macOS, and OpenBSD.
Auto-generated self-signed certificate or bring your own CA-signed cert. One installer flag to enable.
Input validation, injection prevention, stack-trace suppression. CI scans every push with Trivy, pip-audit, and Grype.
Quick start
Works on Linux and macOS. Requires Python 3.8+. The installer handles everything else.
Run the installer as root for a system-wide service, or with -d ~/path for a user install.
git clone \
https://git.faaleoleo.io/\
faaleoleo-dev-team/\
Bacula-Mock-Server
cd Bacula-Mock-Server
sudo ./install.sh
Start the server, then generate realistic test data. The second argument sets the job failure rate (0.0 to 1.0).
bacula-mock start
bacula-mock init 100 0.10
Run the smoke test to confirm all endpoints respond. Open /docs for interactive Swagger exploration.
bacula-mock smoke-test
# 86/86 tests passed
# http://localhost:9101/docs
Released under the BSD 2-Clause license. Use it freely in commercial products, internal tooling, or customer training environments.
↓ Download from Forgejo