Professional CLI tool for database backups and restores
Project description
clidup 🗄️
Professional CLI tool for database backups and restores
clidup is a command-line interface designed to simplify database backup and restore operations. Built with Python, it provides a clean, professional interface for database administrators and developers.
Features (MVP)
- PostgreSQL Support: Full backup and restore for PostgreSQL databases
- Compression: Optional tar.gz compression for backups
- Local Storage: Save backups to your local filesystem
- Configuration Management: YAML configuration + environment variables
- Comprehensive Logging: Rotating log files with detailed operation history
- User Safety: Confirmation prompts for destructive operations
- Cross-Platform: Works on Windows, Linux, and macOS
Requirements
System Requirements
- Python 3.10 or higher
- PostgreSQL client tools (
pg_dumpandpsql)
Installing PostgreSQL Client Tools
Windows: Download and install from PostgreSQL Downloads
Linux (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install postgresql-client
macOS:
brew install postgresql
Installation
- Clone or download the repository:
https://github.com/Geovani29/clidup.git
- Install in editable mode:
pip install -e .
- Verify installation:
clidup --help
Note for Windows Users: If you get a "command not found" error, it means the Python Scripts folder is not in your system PATH. Alternative run method: You can always run the tool using:
python -m clidup ...
Configuration
1. Create Configuration File
A config.yaml file should already exist in the project root. Modify it as needed:
# PostgreSQL Database Configuration
postgres:
host: localhost
port: 5432
username: postgres
database: postgres
# Backup Settings
backup:
directory: ./backups
2. Set Environment Variables
Create a .env file in the project root:
# Copy the example file
copy .env.example .env
Edit .env and set your PostgreSQL password:
POSTGRES_PASSWORD=your_actual_password
Usage
First Time Setup
Before using clidup, initialize the configuration:
clidup init
This will interactively ask for:
- PostgreSQL host, port, username, password
- Backup directory location
And create:
config.yaml- Database configuration.env- Password (never commit this!)backups/- Directory for backups
Backup a Database
Basic backup:
clidup backup --db postgres --db-name myapp_db
With compression:
clidup backup --db postgres --db-name myapp_db --compress
Output:
✅ Backup completed successfully!
📁 Backup file: C:\...\backups\postgres_myapp_db_full_2026-01-07_23-15.sql.tar.gz
📝 Logs: C:\...\backups\clidup.log
Restore a Database
Basic restore:
clidup restore --db postgres --file backups\postgres_myapp_db_full_2026-01-07_23-15.sql
Restore compressed backup:
clidup restore --db postgres --file backups\postgres_myapp_db_full_2026-01-07_23-15.sql.tar.gz
Skip confirmation (use with caution):
clidup restore --db postgres --file backups\backup.sql --yes
Specify different database name:
clidup restore --db postgres --file backups\backup.sql --db-name target_database
View Help
# General help
clidup --help
# Backup command help
clidup backup --help
# Restore command help
clidup restore --help
# Version information
clidup --version
Backup File Naming
Backups are automatically named with the following format:
<db_type>_<db_name>_full_<YYYY-MM-DD>_<HH-MM>.sql
Examples:
postgres_myapp_db_full_2026-01-07_23-15.sqlpostgres_production_full_2026-01-08_02-30.sql.tar.gz(compressed)
Security Best Practices
- Passwords via environment variables only - Never hardcode passwords
.envfile in.gitignore- Prevent accidental commits- No passwords in logs - Automatic sanitization
- Confirmation prompts - Prevent accidental data loss
Troubleshooting
"pg_dump not found"
Solution: Install PostgreSQL client tools (see Requirements section)
"POSTGRES_PASSWORD environment variable not set"
Solution: Create a .env file with your password:
POSTGRES_PASSWORD=your_password
"config.yaml not found"
Solution: Make sure you're running clidup from the project directory, or specify the config path:
clidup backup --db postgres --db-name mydb --config /path/to/config.yaml
Backup fails with "connection refused"
Solution: Check that PostgreSQL is running and the connection details in config.yaml are correct.
Current Limitations
This is the MVP (Minimum Viable Product) version. The following features are not yet implemented:
- Cloud storage (AWS S3, Azure Blob, Google Cloud Storage)
- Multiple database types (MySQL, MongoDB, etc.)
- Incremental or differential backups
- Scheduled/automated backups
- Email notifications
- Backup encryption
- Automated tests
These features are planned for future releases.
Roadmap
Phase 2 (Future):
- Support for MySQL and MongoDB
- Cloud storage integration (S3, Azure, GCS)
- Incremental backups
- Automated scheduling
- Web dashboard
- Backup encryption
- Comprehensive test suite
License
MIT License - feel free to use this project for personal or commercial purposes.
Contributing
This is currently an MVP project. Contributions, issues, and feature requests are welcome!
Support
For issues or questions, please create an issue in the repository.
Built with ❤️ using Python and Typer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clidup-0.2.4.tar.gz.
File metadata
- Download URL: clidup-0.2.4.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e5dc34ceff7a872ae30ad36343d7462e2dd1c0c6d09c12777c5ffb6a778ff2
|
|
| MD5 |
d92259cf2bdcca1a8fe03726df26ba67
|
|
| BLAKE2b-256 |
541159137c12a43b59a79587b324c3843dbe415c0bad8f3c739ff6883cc49a28
|
File details
Details for the file clidup-0.2.4-py3-none-any.whl.
File metadata
- Download URL: clidup-0.2.4-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0593c9685b5f0caed0f72d53d1d2e5cb0d3b962877cc84b482f1821bdab39bec
|
|
| MD5 |
7162b6ff995a994c8c7fedc3f8416981
|
|
| BLAKE2b-256 |
4c93d54386f0a37c7803a6baa7d614720d9f0e9665d2e52bee649766002c4a4a
|