6.7 KiB
Backup & Restore Guide
Version: v0.7.0 Applies To: BZOD Multi-User Platform
Overview
BZOD provides built-in backup and recovery functionality for both single-user and multi-user deployments.
The backup architecture is designed to support:
- Full platform backups
- Individual tenant backups
- Disaster recovery
- Upgrade safety
- Migration validation
- Data integrity verification
All production deployments should maintain regular backups before performing upgrades, maintenance, or administrative operations.
Database Architecture
BZOD stores data across multiple SQLite databases.
Core Databases
data/
├── users.db
├── system.db
└── users/
users.db
Stores:
- User accounts
- Password hashes
- Account status
- Roles
- Sessions
- Quotas
- API tokens
system.db
Stores:
- Global slug registry
- Reserved slugs
- Slug ownership history
- Audit events
- Moderation events
- System settings
Tenant Databases
Each tenant owns isolated content and analytics databases.
data/users/{user_id}/
├── content.db
└── analytics.db
content.db
Stores:
- Short URLs
- Landing pages
- Metadata
- Tags
- QR code configuration
analytics.db
Stores:
- Visit events
- Referrers
- Browser information
- Country information
- Aggregated statistics
Backup Types
Full Platform Backup
Creates a complete snapshot of the entire BZOD installation.
Includes:
users.db
system.db
all tenant content.db files
all tenant analytics.db files
Recommended for:
- Daily scheduled backups
- Upgrades
- Server migration
- Disaster recovery
User Backup
Creates a backup of a single tenant.
Includes:
content.db
analytics.db
Recommended for:
- User export
- User migration
- User recovery
CLI Backup Commands
Create Full Backup
bzod backup
Output:
backups/
└── backup-YYYYMMDD-HHMMSS.zip
Create User Backup
bzod backup-user 42
Output:
backups/
└── user-42-YYYYMMDD-HHMMSS.zip
CLI Restore Commands
Restore Full Backup
bzod restore backup-20260619-020000.zip
Restores:
- users.db
- system.db
- all tenant databases
Restore Single User
bzod restore-user user-42-20260619.zip
Restores only:
users/42/content.db
users/42/analytics.db
without affecting any other tenant.
Web-Based Backup Management
Administrative users can manage backups through:
/admin/backups
Features:
- Create backup
- Download backup
- Upload backup
- Restore backup
- Delete backup
Only authenticated administrators may access backup operations.
Backup Strategy
Recommended Schedule
Daily
02:00 AM
Create a full platform backup.
Weekly
Sunday 03:00 AM
Create a full backup and copy it to:
- NAS
- Secondary server
- External storage
Monthly
Archive a backup for long-term retention.
Recommended retention:
12 months
Retention Policy
Recommended policy:
Daily Backups:
30 days
Weekly Backups:
12 weeks
Monthly Backups:
12 months
Adjust retention according to compliance requirements.
Upgrade Procedure
Always create a backup before upgrading.
Step 1
Create backup:
bzod backup
Step 2
Upgrade BZOD binary.
Step 3
Start BZOD.
bzod serve
Step 4
Allow database migrations to complete.
Step 5
Verify:
- Login
- URLs
- Landing pages
- Analytics
- Administration panels
Restore Validation
After every restore operation verify:
Authentication
- Administrator login works
- Standard user login works
Content
- URLs are visible
- Landing pages render correctly
Routing
- Slug redirects work
- Landing page routes resolve
Analytics
- Visit counts exist
- Analytics dashboards load
System
- Audit events visible
- Moderation records preserved
- System settings preserved
Multi-User
- Tenant isolation maintained
- Ownership mappings preserved
Disaster Recovery Scenarios
Scenario 1: Deleted User
Problem:
User account accidentally deleted.
Recovery:
bzod restore-user user-42.zip
Verify:
- URLs restored
- Pages restored
- Analytics restored
Scenario 2: Corrupted Tenant Database
Problem:
content.db corruption
Recovery:
bzod restore-user user-42.zip
or
bzod restore full-backup.zip
Scenario 3: Corrupted users.db
Problem:
Unable to login
Missing users
Session failures
Recovery:
bzod restore full-backup.zip
Scenario 4: Corrupted system.db
Problem:
Slug resolution failures
Moderation data missing
Settings lost
Recovery:
bzod restore full-backup.zip
Scenario 5: Complete Server Failure
Problem:
Disk failure
Server loss
Hardware replacement
Recovery:
- Reinstall operating system
- Install BZOD
- Restore backup
bzod restore backup.zip
- Start BZOD
bzod serve
WAL Mode
BZOD uses SQLite Write-Ahead Logging (WAL).
Examples:
users.db
users.db-wal
users.db-shm
system.db
system.db-wal
system.db-shm
content.db
content.db-wal
content.db-shm
analytics.db
analytics.db-wal
analytics.db-shm
Benefits:
- Improved concurrency
- Better crash recovery
- Faster write operations
Backup Safety
Do not manually copy live SQLite databases while the server is actively writing.
Always use:
bzod backup
or the Backup Management UI.
This ensures consistent snapshots.
Security Considerations
Backups may contain:
- User accounts
- Password hashes
- Session metadata
- Analytics data
- Audit records
- API token hashes
Even though passwords and tokens are stored as hashes, backup archives should be treated as sensitive information.
Recommended practices:
- Encrypt backup storage
- Restrict filesystem permissions
- Maintain offsite copies
- Transfer backups over secure channels
- Test restores periodically
Backup Testing
A backup is only useful if it can be restored.
Quarterly validation is recommended.
Example:
mkdir restore-test
bzod restore backup.zip \
--data-dir restore-test
Verify:
- Login works
- URLs resolve
- Landing pages load
- Analytics display
- Administration dashboard functions
Production Recommendation
Minimum production policy:
Daily Full Backup
Weekly Offsite Backup
Monthly Archive Backup
Quarterly Restore Validation
Following this policy protects against:
- User mistakes
- Database corruption
- Upgrade failures
- Hardware failures
- Site disasters
and provides a reliable recovery path for BZOD deployments.