BareD - Backup and Restore Daemon for MySQL, PostgreSQL, Redis
6.3K
A simple yet powerful backup and restore daemon for databases written in Go.
Phase 1: Foundation ✓
Phase 2: Database Dumpers ✓
Phase 3: Compression ✓
Phase 4: Storage Backends ✓
Phase 5: Backup Pipeline ✓
Phase 6: Restore Workflow ✓
Phase 7: Daemon & Scheduler ✓
Phase 8: Retention & Notifications ✓
keep settingPhase 9: Polish & Documentation ✓
# Build the binary
make build
# Or manually with Go
go build -o bin/brd ./cmd/brd
Create a bared.yml configuration file (see examples/config.example.yml for full example):
default_storage: local_disk
storages:
local_disk:
type: local
path: /backups
keep: 20
targets:
- name: my_mysql_db
conn:
type: mysql
user: root
password: ${MYSQL_PASSWORD}
database: myapp
host: localhost
port: 3306
compress:
enabled: true
type: tgz
storage:
enabled: true
name: local_disk
# Validate configuration
./bin/brd validate-config --config bared.yml
# Backup a target
./bin/brd backup --config bared.yml --target my_mysql_db
# List backups
./bin/brd list --config bared.yml --target my_mysql_db
# Restore latest backup
./bin/brd restore --config bared.yml --target my_mysql_db --backup latest
# Restore specific backup
./bin/brd restore --config bared.yml --target my_mysql_db --backup path/to/backup.tar.gz
# Run as daemon with scheduler
./bin/brd daemon --config bared.yml
# Run as daemon with web UI (API-based config management enabled)
./bin/brd daemon --config bared.yml --http :8080 --http-user admin --http-pass secret
# Import YAML configuration into database via API
./bin/brd config import bared.yml --user admin --pass secret
BareD supports two configuration approaches:
Configure everything via YAML files. Simple and suitable for GitOps workflows.
# bared.yml
storages:
local_disk:
type: local
path: /backups
keep: 20
targets:
- name: my_mysql_db
conn:
type: mysql
user: root
password: ${MYSQL_PASSWORD}
database: myapp
host: localhost
port: 3306
schedule: "0 2 * * *" # Daily at 2 AM
Manage configuration through the Web UI or REST API. Config is stored in SQLite with encrypted secrets.
Benefits:
Migration: Start with YAML and migrate to database when ready using either the Web UI or CLI import tool.
Method 1: Using the CLI Import Tool (Recommended for automation)
# Start daemon first
./bin/brd daemon --http :8080 --http-user admin --http-pass secret
# In another terminal, import your YAML config
./bin/brd config import bared.yml --user admin --pass secret
# Interactive mode - prompts for conflicts
./bin/brd config import bared.yml --user admin --pass secret --mode interactive
# Override mode - updates all existing configs
./bin/brd config import bared.yml --user admin --pass secret --mode override
# Skip mode - only creates new configs
./bin/brd config import bared.yml --user admin --pass secret --mode skip
# Dry run - validate without importing
./bin/brd config import bared.yml --user admin --pass secret --dry-run
Method 2: Using the Web UI
# Start daemon with HTTP server
./bin/brd daemon --config bared.yml --http :8080 --http-user admin --http-pass secret
# Access at http://localhost:8080
# Navigate to Configuration → Migrate to Database
Encryption Key Management:
BARED_ENCRYPTION_KEY environment variable for production (32 bytes, base64-encoded)BareD daemon can run in three distinct modes to fit different operational needs:
Run automated backups on a schedule without HTTP API access:
./bin/brd daemon --config bared.yml
Requirements:
schedule field configured in YAMLUse case: Traditional scheduled backups in environments where API access is not needed.
Run the HTTP server for manual backups via web UI or API without any scheduled jobs:
./bin/brd daemon --config bared.yml --http :8080 --http-user admin --http-pass secret
Requirements:
--http flag must be specifiedschedule fields (they can be omitted)Use case: On-demand backups triggered manually through the web interface or API calls, ideal for development environments or when you need full control over backup timing.
Run both scheduled backups AND provide HTTP API access:
./bin/brd daemon --config bared.yml --http :8080 --http-user admin --http-pass secret
Requirements:
--http flag specifiedschedule fields (scheduled), others may omit schedules (API-only)Use case: Production environments where you want automated scheduled backups plus the ability to trigger ad-hoc backups when needed.
Note: At least one mode (cron or API) must be active. The daemon will fail with a helpful error if neither schedules nor HTTP server are configured.
📚 Complete Documentation Hub - Navigate all documentation by audience and topic
For Users:
For Operators:
For Developers:
For Integrators:
Backup:
[Database Dump] -> [Compress] -> [Storage Upload] -> [Cleanup]
↓ ↓ ↓
(streaming via io.Pipe - no temp files)
Restore:
[Storage Retrieve] -> [Decompress] -> [Database Restore] -> [Cleanup]
↓ ↓ ↓
(streaming via io.Pipe)
bared/
├── cmd/brd/ # CLI entry point
├── internal/
│ ├── app/ # High-level orchestration
│ ├── config/ # Configuration parsing & validation
│ ├── database/ # Database dumpers (MySQL, Postgres, Redis)
│ ├── storage/ # Storage backends (Local, S3, SFTP)
│ ├── compress/ # Compression (tar.gz)
│ ├── notify/ # Notifications (coming soon)
│ ├── daemon/ # Daemon mode (coming soon)
│ ├── retention/ # Retention policies (coming soon)
│ └── util/ # Utilities (paths, retry, shell)
├── examples/ # Example configurations
└── docs/ # Complete documentation
mariadb-dump and mariadb commands (preferred)mysqldump and mysql commands (fallback)pg_dump and psql commandsredis-cli commandgopkg.in/yaml.v3 - YAML configuration parsinggithub.com/spf13/cobra - CLI frameworkgithub.com/aws/aws-sdk-go-v2 - S3 storagegithub.com/pkg/sftp - SFTP storagegolang.org/x/crypto/ssh - SSH for SFTPSee docs/ for complete documentation including user guides, operations, and architecture details.
# Using Makefile (outputs to bin/brd)
make build
# Or manually with Go
go build -o bin/brd ./cmd/brd
# Cross-platform builds (outputs to dist/)
make build-all
go test ./...
To be determined
Contributions welcome! Please see CONTRIBUTING.md and docs/development/ for implementation details and architecture.
Content type
Image
Digest
sha256:ee20402b8…
Size
38.4 MB
Last updated
29 days ago
docker pull ektowett/bared:main-636aa54