Bacula Mock Server
A production-grade, wire-compatible simulation of the Bacula Enterprise REST API
What it is
A full Bacula REST API — without the infrastructure
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
Stop blocking on infrastructure
Every team working with Bacula runs into the same friction. The mock server removes it.
Instant development environment
Spin up a complete Bacula API environment in under 60 seconds. No Director setup, no storage pools, no daemon handshakes. Install, start, initialize — done.
CI/CD without side effects
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.
Configurable failure rates
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.
Wire-compatible responses
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.
Safe training environment
Give administrators hands-on Bacula API experience without any risk to production. Run commands, explore endpoints, make mistakes — everything is stateless and instantly reversible.
Real authentication included
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
Built for the whole team
Whether you’re shipping a monitoring dashboard, wiring up CI, or training a new administrator, there’s a workflow for you.
Dashboard & UI development
Build monitoring interfaces and admin portals against a full Bacula API with realistic data — without waiting for access to a development Director.
CI/CD pipeline testing
The server starts in-process, runs all 247 endpoint tests, and exits cleanly in under 30 seconds — no external cleanup, no external dependencies.
Error & edge-case simulation
Set precise job failure rates and reproduce specific error patterns using profile-specific messages that match real Bacula output.
Hands-on administrator training
Pair it with BWeb Management Suite for a complete training setup — interface and API together, with zero risk to production systems.
Customer demonstrations
Realistic client profiles covering mail servers, databases, Kubernetes clusters, VMware hosts, and SAP HANA systems. No production data, always available.
Load & performance testing
Benchmark your API client using ab, wrk, or hey against a fully thread-safe server — without load on your production Director.
Features
Everything you need, nothing you don’t
Full Bacula API surface area, a lean footprint, and an idempotent installer that handles every supported OS automatically.
Full catalog endpoints
Clients, Jobs, JobLogs, Pools, Storage, Media, JobTotals — with pagination, filtering, and sorting.
Command endpoints
run, restore, cancel, estimate, label, purge, prune, delete — all respond realistically.
Status endpoints
Director, client, and storage daemon status including running jobs and next scheduled jobs.
BVFS file browsing
Virtual file system endpoints for restore simulation — browse directories and select files.
Resource management
/res/ and /configure endpoints for reading and writing Director, FD, and SD configurations.
Systemd service
Auto-start on boot, auto-restart on failure, journald logging — ready for persistent dev environments.
Interactive API docs
Swagger UI at /docs and ReDoc at /redoc — explore and test every endpoint in the browser.
BWeb integration
SQLite sync script mirrors mock data to the Bacula v1027 schema so BWeb Management Suite connects directly.
Multi-platform installer
Debian, Ubuntu, RHEL, Fedora, macOS. Detects OS, sets up a Python venv, registers the service automatically.
247+ automated tests
Python test suite (13 parts) plus a pre-compiled C test binary for Linux, macOS, and OpenBSD.
TLS / HTTPS
Auto-generated self-signed certificate or bring your own CA-signed cert. One installer flag to enable.
Security hardened
Input validation, injection prevention, stack-trace suppression. CI scans every push with Trivy, pip-audit, and Grype.
Quick start
Up in three steps
Works on Linux and macOS. Requires Python 3.8+. The installer handles everything else.
Clone & install
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 & initialize
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
Verify
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
Free. Open source. No strings attached.
Released under the BSD 2-Clause license. Use it freely in commercial products, internal tooling, or customer training environments.
↓ Download from GitHub