A simple tool for backing up databases to various cloud storage providers or local filesystems.
Designed to make database migrations easier, this project streamlines copying, backup, and restoration operations. It consists of a library and a CLI tool that can be used both as a command-line interface for server automation and through an interactive TUI (Terminal User Interface) for everyday development tasks like pulling production data into your local environment.
Important Note: This is a side project used currently as an internal tool. It is not an industrial-grade solution. It only provides logical backup for the moment and might struggle with massive databases. Works great for development, testing, and smaller projects, but maybe don't bet your mission-critical production systems on it just yet...
If you need more advanced tools please check Barman or pgbackrest.
curl -sSL https://raw.githubusercontent.com/bloccooo/dbkp/main/install-cli.sh | sudo bashcurl -sSL https://raw.githubusercontent.com/bloccooo/dbkp/main/install-cli.sh | bashNote: macOS users may need to remove sudo depending on their permission settings.
# Clone the repository
git clone https://github.com/bloccooo/dbkp.git
cd dbkp
# Build the project
cd cli
cargo build --release
# Install the binary
sudo cp target/release/dbkp /usr/local/bin/dbkpThe CLI tool includes an interactive TUI mode that provides a visual, menu-driven interface for managing backups and databases. The TUI offers the same functionality as the command-line interface with an intuitive, user-friendly experience.
Simply run dbkp without any arguments to launch the TUI:
dbkpThe TUI provides:
- Visual database configuration
- Storage setup with validation
- Backup and restore operations
- Navigation through menus
You can exit the TUI at any time using esc.
For detailed CLI usage, commands, parameters, and examples, see the CLI Documentation.
The CLI tool supports multiple usage modes:
- TUI Mode: Interactive terminal user interface (launch with
dbkp) - Direct Parameters: For command-line control for automation
- PostgreSQL: Backup and restore support
- Version Detection: Automatic PostgreSQL version detection and compatibility
- S3-Compatible Storage: Amazon S3, MinIO, DigitalOcean Spaces, and other S3-compatible providers
- Local Filesystem: Store backups on local or network-mounted filesystems
- Streaming Architecture: Memory-efficient streaming for large databases
- Logical Backups: Full schema and data backup using
pg_dump
- TUI Mode: Interactive terminal user interface for visual management
- CLI Automation: Command-line interface for scripts and CI/CD
- Cron Job Ready: Designed for scheduled backup operations
- Docker Compatible: Works in containerized environments
# TUI mode (recommended for first-time users)
dbkp
# Command-line backup to S3
dbkp backup \
--database myapp \
--host localhost \
--username dbuser \
--storage-type s3 \
--bucket my-backups \
--endpoint https://s3.amazonaws.com
# Restore latest backup
dbkp restore \
--database myapp \
--storage-type s3 \
--bucket my-backups \
--latestThe project is organized into two main components:
- Core Library (
/core): Thedbkp-corelibrary containing database connections, backup/restore logic, and storage backends. This can be used as a dependency in other Rust projects. - CLI Tool (
/cli): Thedbkpcommand-line tool that provides:- TUI Mode: Interactive terminal user interface for visual management
- Command-Line Mode: Direct commands for automation and scripting
- Pull production data to local development environments
- Create test data snapshots for consistent testing
- Quick database migrations between environments
- Automated daily/weekly backups with retention policies
- Database migrations and deployments
- Disaster recovery for smaller applications
- Logical Backups Only: Does not support physical/binary backups
- Single Database Focus: Optimized for individual database operations
- Not Industrial-Grade: Suitable for development and smaller to medium production use cases
- PostgreSQL Focused: Currently optimized primarily for PostgreSQL
For enterprise-grade solutions with physical backups, point-in-time recovery, and high-availability features, consider Barman or pgbackrest.
MIT License - see LICENSE file for details.