- Python 65%
- Shell 24.7%
- C 10.1%
- Makefile 0.2%
|
All checks were successful
Functional Tests / Run Functional Tests (push) Successful in 31s
Security & Dependency Scan / Scan Python Source & Dependencies (push) Successful in 7s
Security & Dependency Scan / Grype Cross-Check (push) Successful in 1s
Security & Dependency Scan / Email Alert on Detection (push) Has been skipped
|
||
|---|---|---|
| .forgejo | ||
| certs | ||
| docs | ||
| logs | ||
| scripts | ||
| src | ||
| tests | ||
| .coveragerc | ||
| .env | ||
| .gitignore | ||
| .gitleaks.toml | ||
| .trivyignore.yaml | ||
| CHANGELOG | ||
| config.yaml | ||
| CONTRIBUTING.md | ||
| generate-bom.py | ||
| gpg-faaleo-dev-team.asc | ||
| install-bweb-mock.sh | ||
| install-bweb-scheduled.sh | ||
| install.sh | ||
| README.md | ||
| requirements.txt | ||
| status-check.sh | ||
| structure.md | ||
Bacula Enterprise Mock Server
Full simulation of the Bacula Enterprise REST API — no Director required
A wire-compatible mock of the Bacula Enterprise REST API for dashboard development, CI/CD testing, administrator training, and demo environments. Same endpoints, same response formats, same authentication — backed by realistic generated data across 30+ client profiles instead of a production Director.
Use Cases
- Dashboard development — build monitoring UIs against a realistic API without production infrastructure
- CI/CD testing — 86 automated tests across 13 groups, runnable in seconds
- Training — learn the Bacula REST API without risk to production
- QA / disaster simulation — configurable error rates from 0% to 100%
- Performance testing — benchmark with
ab,wrk, orhey - BWeb integration — plug into BWeb Management Suite via lighttpd reverse proxy
Key Features
- 100% wire-compatible with the Bacula Enterprise REST API
- 30+ client profiles — mail, database, NFS, web, Windows, VMware, Kubernetes, SAP HANA, IoT, and more
- OAuth2 + HTTP Basic Auth — same auth flow as real Bacula Enterprise
- HTTP and HTTPS (TLS) with auto-generated self-signed certificates
- Configurable error rates —
bacula-mock init 100 0.25creates 100 clients with 25% failure rate - Schedule-based job history — jobs are generated at regular intervals (default: every 24 h over 7 days) so job IDs and timestamps are always strictly ascending, matching real Bacula Director behaviour; interval, jitter, and history length are configurable in
config.yaml - Full CLI tool (
bacula-mock) — server management, queries, exports, smoke tests - External Go test client — 86 tests across 13 groups for CI/CD pipelines
- BVFS browsing — file-level restore browsing endpoints
- CSV/JSON data export — for reporting and analysis
- Systemd service with auto-start, auto-restart, and log rotation
Quick Start
# 1. Install
sudo ./install.sh
# 2. Start
sudo systemctl start bacula-mock
# 3. Generate test data (100 clients, 25% error rate)
# Jobs are created at 24 h intervals over the last 7 days (see config.yaml)
bacula-mock init 100 0.25
# 4. Verify
bacula-mock health
bacula-mock clients
bacula-mock jobs-failed
bacula-mock smoke-test
Tuning the job history
Three parameters in config.yaml under simulation control the generated history:
| Parameter | Default | Description |
|---|---|---|
history_days |
7 |
How many days of history to generate per client |
job_interval_hours |
24 |
Base interval between consecutive jobs |
jitter |
0.1 |
Timestamp variance as a fraction of the interval (0 = exact, 1 = fully random) |
Example — 30 days of history with 12 h intervals and slight jitter:
simulation:
history_days: 30
job_interval_hours: 12
jitter: 0.05
API at a Glance
| Category | Endpoints | Examples |
|---|---|---|
| Catalog | /cat/Client, /cat/Job, /cat/JobTotals, /cat/JobLog, /cat/Pool, /cat/Storage |
List clients, jobs, logs, aggregate stats |
| Commands | /cmd/run, /cmd/restore, /cmd/cancel, /cmd/estimate, /cmd/label, /cmd/purge, /cmd/prune |
Run backups, restore, manage volumes |
| Status | /status/director, /status/client/ |
Live daemon status |
| Resources | /res/director, /res/filedaemon, /res/storagedaemon |
Read/write configuration |
| Auth | /oauth/token |
OAuth2 token flow |
| Mock | /mock/health, /mock/initialize, /mock/reset |
Server control (no auth on health) |
CLI Commands
bacula-mock start # Start server
bacula-mock init [N] [rate] # Generate N clients with error rate
bacula-mock reset # Delete all data
bacula-mock clients [limit] # List clients
bacula-mock jobs-failed [limit] # Failed jobs only
bacula-mock jobtotals # Aggregate KPIs
bacula-mock joblog <jobid> # Job log messages
bacula-mock dir-status # Director status
bacula-mock run <job> # Start a backup
bacula-mock restore # Restore from backup
bacula-mock export-csv # Export jobs as CSV
bacula-mock smoke-test # Test all endpoints (86 tests)
Add --raw to any command for unformatted JSON output.
Requirements
| Component | Requirement |
|---|---|
| OS | Debian 13, (Ubuntu 20.04+, RHEL 8+, Fedora 35+, macOS 11+ untested) |
| Python | 3.8+ |
| Disk | ~100 MB |
| Memory | 512 MB minimum (1 GB for 500+ clients) |
| Port | 9101 (configurable) |
All Python dependencies are installed automatically in a virtual environment.
Documentation
| Document | Description |
|---|---|
| Implementation Guide | Full configuration, client profiles, authentication, TLS, BWeb integration, service management |
| End User Guide | Getting started, CLI walkthrough, dashboard building |
| Usage Examples | Practical workflows, frontend integration (JS/Python), load testing, error analysis |
Verifying a Release Package
All release packages are GPG-signed. Follow these steps to verify the authenticity and integrity of a downloaded package.
1. Import the Public GPG Key (One-Time)
curl -sL https://git.faaleoleo.io/faaleoleo-dev-team/BaculaMockServer/raw/branch/main/my-public-key.asc | gpg --import
2. Download the Package, Signature, and Checksum
Replace v1.0.0 with the version you want:
VERSION="v1.0.0"
BASE="https://git.faaleoleo.io/api/packages/faaleoleo-dev-team/generic/BaculaMockServer/${VERSION}"
curl -O "${BASE}/BaculaMockServer-${VERSION}.tar.gz"
curl -O "${BASE}/BaculaMockServer-${VERSION}.tar.gz.asc"
curl -O "${BASE}/BaculaMockServer-${VERSION}.tar.gz.sha256"
3. Verify the GPG Signature
gpg --verify BaculaMockServer-${VERSION}.tar.gz.asc BaculaMockServer-${VERSION}.tar.gz
Expected output: gpg: Good signature from "...". If you see BAD signature, do not use the package.
4. Verify the SHA256 Checksum
sha256sum -c BaculaMockServer-${VERSION}.tar.gz.sha256
Expected output: BaculaMockServer-v1.0.0.tar.gz: OK
5. Extract
tar -xzf BaculaMockServer-${VERSION}.tar.gz
License
BSD 2-Clause — Copyright © 2026 faaleoleo
"Bacula" is a registered trademark of Bacula Systems SA. This software is not affiliated with or endorsed by Bacula Systems SA.