6.5 KiB
6.5 KiB
BAMS Architecture
Overview
BAMS (Backup Appliance Management System) is a comprehensive management platform for backup appliances, providing unified control over storage, tape libraries, iSCSI targets, and Bacula integration.
System Architecture
┌─────────────────────────────────────────────────────────┐
│ Cockpit Web UI │
│ (Cockpit Plugin) │
└──────────────────────┬──────────────────────────────────┘
│ HTTP/REST API
│
┌──────────────────────▼──────────────────────────────────┐
│ BAMS Backend Service (Go) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐│
│ │ Disk │ │ Tape │ │ iSCSI │ │ Bacula ││
│ │ Service │ │ Service │ │ Service │ │ Service ││
│ └────┬─────┘ └────┬─────┘ └────┬──────┘ └────┬────┘│
└───────┼─────────────┼──────────────┼──────────────┼─────┘
│ │ │ │
┌───────▼─────┐ ┌─────▼─────┐ ┌─────▼──────┐ ┌─────▼─────┐
│ LVM │ │ mtx │ │ SCST │ │ systemd │
│ ZFS │ │ sg_lib │ │ iSCSI │ │ bacula-sd│
└─────────────┘ └───────────┘ └────────────┘ └───────────┘
Components
1. Backend Service (Go)
Location: backend/
Structure:
main.go- Entry point, HTTP server setupinternal/api/- REST API handlers and routinginternal/services/- Business logic servicesdisk/- Disk repository management (LVM/ZFS)tape/- Tape library managementiscsi/- iSCSI target management (SCST)bacula/- Bacula integrationlogs/- Logging and diagnosticsaudit/- Audit logging
internal/config/- Configuration managementinternal/logger/- Logging utilitiesinternal/utils/- Helper functions
Key Features:
- RESTful API with JSON responses
- Graceful shutdown handling
- Request validation
- Error recovery middleware
- CORS support
2. Cockpit Plugin (Frontend)
Location: cockpit/
Files:
manifest.json- Plugin metadataindex.html- Main UI structurebams.js- JavaScript application logic
Features:
- Dashboard with real-time monitoring
- Storage repository management
- Tape library operations
- iSCSI target configuration
- Bacula status and control
- Log viewer
3. Configuration
Location: configs/
Files:
bams.service- Systemd service fileconfig.yaml.example- Configuration templatepolkit.rules- Polkit authorization rules
Data Flow
Disk Repository Creation
- User creates repository via UI
- Frontend sends POST to
/api/v1/disk/repositories - Backend validates input
- Disk service creates LVM volume or ZFS zvol
- Repository metadata stored
- Response returned to UI
Tape Operations
- User triggers inventory/load/unload
- Frontend sends request to API
- Tape service executes
mtxcommands - Results parsed and returned
- UI updates display
iSCSI Target Management
- User creates/updates target
- Backend validates IQN, portals, initiators
- SCST configuration generated
- Configuration applied via
scstadmin - Status returned to UI
Security
- Authentication: PAM/system users via Cockpit
- Authorization: Polkit rules for privileged operations
- Audit Logging: All configuration changes logged
- Input Validation: All user input validated
- Error Handling: Panic recovery middleware
API Endpoints
Dashboard
GET /api/v1/dashboard- System overview
Disk Repositories
GET /api/v1/disk/repositories- List repositoriesPOST /api/v1/disk/repositories- Create repositoryGET /api/v1/disk/repositories/{id}- Get repositoryDELETE /api/v1/disk/repositories/{id}- Delete repository
Tape Library
GET /api/v1/tape/library- Library statusPOST /api/v1/tape/inventory- Run inventoryGET /api/v1/tape/drives- List drivesPOST /api/v1/tape/drives/{id}/load- Load tapePOST /api/v1/tape/drives/{id}/unload- Unload tapeGET /api/v1/tape/slots- List slots
iSCSI Targets
GET /api/v1/iscsi/targets- List targetsPOST /api/v1/iscsi/targets- Create targetGET /api/v1/iscsi/targets/{id}- Get targetPUT /api/v1/iscsi/targets/{id}- Update targetDELETE /api/v1/iscsi/targets/{id}- Delete targetPOST /api/v1/iscsi/targets/{id}/apply- Apply configurationPOST /api/v1/iscsi/targets/{id}/luns- Add LUNDELETE /api/v1/iscsi/targets/{id}/luns/{lun}- Remove LUNGET /api/v1/iscsi/sessions- List sessions
Bacula
GET /api/v1/bacula/status- SD statusGET /api/v1/bacula/config- Get configPOST /api/v1/bacula/config- Generate configPOST /api/v1/bacula/inventory- Run inventoryPOST /api/v1/bacula/restart- Restart SD
Logs & Diagnostics
GET /api/v1/logs/{service}- Get logsGET /api/v1/logs/{service}/stream- Stream logs (WebSocket)GET /api/v1/diagnostics/bundle- Download support bundle
Deployment
- Build backend:
make build - Install service:
make install - Configure: Edit
/etc/bams/config.yaml - Start service:
systemctl start bams - Access via Cockpit web interface
Dependencies
- Go 1.21+
- Cockpit 300+
- SCST (iSCSI target framework)
- mtx (tape library control)
- LVM tools (for LVM repositories)
- ZFS tools (for ZFS repositories, optional)
- Bacula (for backup integration)
Future Enhancements
- WebSocket support for real-time log streaming
- Multi-tenant support
- High Availability
- Tape encryption management
- Cloud tiering
- Policy-based tape lifecycle