-
-
Notifications
You must be signed in to change notification settings - Fork 7
Plugins
BBS plugins extend backup functionality by adding pre-backup actions, post-backup actions, and specialized backup capabilities. Plugins allow you to customize the backup workflow for each client's specific needs.
The BBS plugin architecture consists of:
- Plugin Types: Built-in plugins provided by BBS (MySQL, PostgreSQL, Shell Hook, S3 Sync)
- Plugin Configurations: Named, reusable configurations for each plugin type
- Backup Plan Association: Plugins are attached to backup plans, not directly to clients
- Per-Client Enablement: Each plugin must be enabled on a per-client basis before use
When a backup job runs:
- BBS checks which plugins are attached to the backup plan
- The agent receives plugin instructions along with the backup job
- Pre-backup plugins execute first (e.g., database dumps, custom scripts)
- Borg creates the backup archive
- Post-backup plugins execute (e.g., notifications, cleanup scripts)
- Post-prune plugins execute after pruning completes (e.g., S3 sync)
Purpose: Automatically dump MySQL databases before backup
Use Cases:
- WordPress, Joomla, Drupal site backups
- Production database backups
- E-commerce platforms (WooCommerce, Magento)
- Custom application databases
How It Works:
- Executes
mysqldumpbefore Borg runs - Creates
.sqlfiles in a specified dump directory - Borg includes the dump files in the backup archive
- Enables one-click MySQL restoration from the BBS web interface
Configuration Parameters:
- Database host and port
- Username and password
- Database names (comma-separated or "all")
- Dump directory path
See Database-Backups for detailed MySQL backup documentation.
Purpose: Automatically dump PostgreSQL databases before backup
Use Cases:
- Django application databases
- Rails application databases
- Data warehouses and analytics platforms
- Custom PostgreSQL applications
How It Works:
- Executes
pg_dumpbefore Borg runs - Creates
.dumpfiles in custom format (compressed) - Borg includes the dump files in the backup archive
- Enables one-click PostgreSQL restoration from the BBS web interface
Configuration Parameters:
- Database host and port
- Username and password
- Database names (comma-separated or "all")
- Dump directory path
See Database-Backups for detailed PostgreSQL backup documentation.
Purpose: Run custom shell scripts before and/or after backups
Use Cases:
- Stop/start applications for consistent backups
- Export application state or logs
- Notify external monitoring systems
- Custom cleanup or preparation tasks
- Trigger webhooks or API calls
How It Works:
-
Pre-backup script: Runs before
borg create - Post-backup script: Runs after backup completes (success or failure)
- Scripts run as the agent user on the client machine
- Environment variables provide context (backup status, archive name, etc.)
Configuration Parameters:
| Parameter | Description | Example |
|---|---|---|
| Configuration Name | Descriptive name | "Stop Nginx Before Backup" |
| Pre-backup Script | Shell script to run before backup | /opt/scripts/pre-backup.sh |
| Post-backup Script | Shell script to run after backup | /opt/scripts/post-backup.sh |
| Working Directory | Directory to run scripts from | /var/www/app |
| Timeout | Maximum execution time (seconds) | 300 |
| Run as User | Unix user to run scripts as (optional) | www-data |
Environment Variables Available to Scripts:
BBS_BACKUP_STATUS=success # or "failed"
BBS_ARCHIVE_NAME=2024-01-15_10-30-00
BBS_REPO_PATH=/var/bbs/repos/12
BBS_BACKUP_PLAN=Daily Backup
BBS_CLIENT_NAME=web-server-01Example Pre-backup Script:
#!/bin/bash
# Stop Nginx to ensure consistent filesystem state
systemctl stop nginx
# Flush Redis to disk
redis-cli save
# Export application state
/opt/app/bin/export-state.sh
exit 0 # Return 0 for success, non-zero for failureExample Post-backup Script:
#!/bin/bash
# Restart services
systemctl start nginx
# Send notification
if [ "$BBS_BACKUP_STATUS" = "success" ]; then
curl -X POST https://monitoring.example.com/webhook \
-d "status=success&archive=$BBS_ARCHIVE_NAME"
else
curl -X POST https://monitoring.example.com/webhook \
-d "status=failed&client=$BBS_CLIENT_NAME"
fi
exit 0- Navigate to client detail → Plugins tab
- Enable Shell Script Hook plugin
- Click Add Configuration
- Fill in the configuration:
- Configuration name
- Pre-backup script path (optional)
- Post-backup script path (optional)
- Working directory
- Timeout (default: 300 seconds)
- Click Save
Screenshot: Shell Hook plugin configuration form
- Scripts must be executable (
chmod +x script.sh) - Scripts run as the agent user (typically
bbs-agent) - Scripts must exist on the client machine, not the BBS server
- Non-zero exit codes from pre-backup scripts will abort the backup
- Post-backup scripts run regardless of backup success/failure
- Use absolute paths for reliability
- Test scripts manually before attaching to production backups
Purpose: Mirror Borg repositories to S3-compatible storage for offsite disaster recovery
Use Cases:
- Offsite backup copies for disaster recovery
- Geographic redundancy
- Long-term archival in cloud storage
- Compliance requirements for offsite backups
How It Works:
- Uses
rcloneto mirror the Borg repository to S3 - Automatically runs after successful prune operations
- Incremental sync (only changed files are transferred)
- Supports bandwidth limiting
Supported Storage Providers:
- AWS S3
- Wasabi
- Backblaze B2
- DigitalOcean Spaces
- MinIO
- Any S3-compatible object storage
Configuration Methods:
- Global S3 Settings (Settings → Offsite Storage): One set of credentials for all clients
- Named S3 Plugin Config: Per-client S3 credentials and buckets
- Inline Per-Plan Config: Unique S3 settings per backup plan
See S3-Offsite-Sync for detailed S3 sync documentation.
Plugins must be enabled on a per-client basis before they can be used:
- Navigate to the client detail page
- Click the Plugins tab
- Toggle the desired plugins to Enabled
- Only enabled plugins can have configurations created
Screenshot: Plugins tab showing plugin enable/disable toggles
Named configurations are reusable plugin settings that can be shared across multiple backup plans for the same client.
- Reusability: Create once, use in multiple backup plans
- Consistency: Same database credentials across all plans
- Maintenance: Update one config to affect all plans using it
- Organization: Descriptive names like "Production MySQL" or "Staging DB"
- Client detail → Plugins tab
- Find the plugin you want to configure (must be enabled)
- Click Add Configuration
- Fill in the configuration form
- Give it a descriptive name
- Save
Screenshot: Plugin configuration list showing multiple named configs
- Edit: Click the edit icon next to a configuration
- Delete: Click the delete icon (only if not attached to any backup plans)
- In-Use Indicator: Configurations attached to plans show which plans use them
- Configurations are per-client (not global)
- The same configuration can be used by multiple backup plans for the same client
- Configurations cannot be shared across different clients
- To use the same settings on multiple clients, create separate configurations for each
Plugins are activated by attaching their configurations to backup plans:
- Navigate to client detail → Backup Plans tab
- Create a new plan or edit an existing one
- Scroll to the Plugins section
- Select plugin configurations from the dropdowns:
- MySQL Backup: Choose a MySQL config (if enabled)
- PostgreSQL Backup: Choose a PostgreSQL config (if enabled)
- Shell Hook: Choose a shell hook config (if enabled)
- S3 Sync: Choose an S3 config (if enabled)
- Save the backup plan
Screenshot: Backup plan editor showing plugin configuration dropdowns
A single backup plan can use multiple plugins simultaneously:
- Example: MySQL dump + Shell hook (to stop/start app) + S3 sync (for offsite copy)
- Plugins execute in order: Pre-backup hooks → Database dumps → Backup → Post-backup hooks → S3 sync
-
Pre-backup phase:
- Shell hook pre-backup script
- MySQL dump
- PostgreSQL dump
-
Backup phase:
-
borg createruns
-
-
Post-backup phase:
- Shell hook post-backup script
-
Post-prune phase (after prune jobs only):
- S3 sync
Before running a production backup, test your plugin configurations:
- On the Plugins tab, find your configuration
- Click the Test button
- BBS queues a
plugin_testjob - Monitor the test in Queue → Job Detail
- Review results:
- Success: Plugin executed correctly
- Failure: Check error log for issues
Screenshot: Plugin configuration card with Test button
- MySQL/PostgreSQL: Connects to database, performs a test dump, verifies dump files created
- Shell Hook: Executes the scripts in a test environment, captures output and exit codes
- S3 Sync: Tests S3 credentials, attempts to create a test file in the bucket
| Plugin | Error | Solution |
|---|---|---|
| MySQL | Connection refused | Check host/port, verify MySQL is running |
| MySQL | Access denied | Verify username/password, check user privileges |
| PostgreSQL | authentication failed | Check credentials, review pg_hba.conf |
| Shell Hook | Script not found | Verify path is absolute and file exists on client |
| Shell Hook | Permission denied | Make script executable, check file permissions |
| S3 Sync | Invalid credentials | Verify access key and secret key |
| S3 Sync | Bucket not found | Check bucket name, ensure it exists |
Plugins create jobs that appear in the Queue:
| Job Type | Description | When It Runs |
|---|---|---|
backup |
Regular backup with plugin pre/post actions | Scheduled or manual |
plugin_test |
Test a plugin configuration | Manual test button |
restore_mysql |
Restore MySQL databases from archive | Manual restore |
restore_pg |
Restore PostgreSQL databases from archive | Manual restore |
s3_sync |
Sync repository to S3 | After successful prune |
- All plugin credentials (database passwords, S3 keys) are encrypted using BBS's APP_KEY
- Credentials are never logged or displayed in plain text
- Agents receive decrypted credentials over HTTPS only when needed for job execution
- Only client owners (or admins) can view/edit plugin configurations
- Regular users cannot see other users' client plugins
- API keys authenticate agent-to-server communication
- Scripts run as the agent user (limited privileges)
- Scripts cannot access BBS server resources
- Scripts run in the context of the client machine only
- Validate script sources before deployment
- Use
Run as Useroption carefully (requires sudo privileges for agent)
- Test First: Always test plugin configurations before production use
- Name Clearly: Use descriptive names like "Production MySQL" not "Config 1"
- Monitor Jobs: Check Queue regularly to ensure plugins execute successfully
- Update Credentials: Rotate database passwords periodically, update configs accordingly
- Database Dumps: Large databases increase pre-backup time. Monitor dump duration.
- Shell Scripts: Keep scripts fast. Long-running scripts delay backups.
- S3 Sync: Bandwidth limiting prevents saturating network connections
- Concurrent Jobs: Multiple plugins on one plan execute sequentially, not in parallel
- Remove Unused Configs: Delete configurations no longer attached to plans
- Review Logs: Check job detail logs for plugin warnings or errors
- Update Scripts: Keep shell hook scripts in version control
- Document Configs: Add comments or notes in configuration names
-
Cause: Missing dependencies on client (e.g.,
pg_dumpnot installed) - Solution: Install required software on client machine, restart agent
- Cause: Incorrect credentials, unreachable services, missing directories
- Solution: Verify all configuration parameters, check network connectivity, review error logs
- Cause: Configuration not attached to backup plan
- Solution: Edit backup plan, select the plugin configuration in the Plugins section
- Cause: Script syntax error, missing executable permission, incorrect path
-
Solution: Test script manually on client (
bash /path/to/script.sh), check permissions (ls -l)
- Cause: Bandwidth limits too restrictive, network issues, bucket permissions
- Solution: Adjust bandwidth limit, verify S3 credentials, check bucket policies
- Database-Backups — Detailed MySQL and PostgreSQL backup guide
- S3-Offsite-Sync — Comprehensive S3 sync documentation
- Queue-and-Jobs — Monitoring plugin job execution
- Troubleshooting — General BBS troubleshooting
📖 User Manual
Getting Started
Using BBS
- Dashboard
- Managing Clients
- Linux Agent Setup
- macOS Agent Setup
- Windows Agent Setup
- Repositories
- Storage Setup
- Backup Plans
- Restoring Files
- Database Backups
- Plugins
- Remote Storage
- S3 Offsite Sync
Monitoring
Administration
- Settings
- User Management
- Single Sign-On
- Two-Factor Authentication
- Updating BBS
- Server Backup and Restore
Reference