A comprehensive backup and restore utility for Odoo instances
Project description
Odoo Backup Manager
A comprehensive backup and restore utility for Odoo instances with smart GUI/CLI interface, supporting both database and filestore operations with local and remote (SSH) connections.
Features
- 🎯 Smart Interface: Automatically launches GUI when available, falls back to CLI
- 🗄️ Complete Backup & Restore: Handles both PostgreSQL database and Odoo filestore
- 🔒 Secure Storage: Encrypted password storage for connection profiles
- 🌐 Remote Support: Backup/restore from remote servers via SSH
- 💾 Connection Profiles: Save and reuse connection configurations
- 🖥️ Dual Interface: Both GUI and CLI modes available
- 📦 Archive Management: Creates compressed archives with metadata
- 🔄 Flexible Operations: Backup only, restore only, or backup & restore in one operation
- 🛡️ Production Protection: Prevent accidental restores to production databases
- 🧪 Database Neutralization: Safe testing with disabled emails and reset passwords
Installation
Using pip (Recommended)
pip install odoo-backup-manager
From Source
# Clone the repository
git clone https://github.com/jpsteil/odoo-backup-manager.git
cd odoo-backup-manager
# Install the package
pip install -e .
# For development
pip install -r requirements-dev.txt
Prerequisites
- Python 3.8 or higher
- PostgreSQL client tools (
pg_dump,pg_restore,psql) - tar command-line utility
- tkinter (for GUI mode) - usually included with Python
Installing PostgreSQL Client Tools
Ubuntu/Debian
sudo apt-get update
sudo apt-get install postgresql-client
RHEL/CentOS/Fedora
sudo dnf install postgresql
macOS
brew install postgresql
Quick Start
Default Behavior (v1.1.0+)
# Launch the application (GUI if available, otherwise help)
odoo-backup
# Force GUI mode (error if not available)
odoo-backup --gui
# Force CLI mode
odoo-backup --cli
# Show CLI help
odoo-backup --cli --help
GUI Mode
The GUI automatically launches when:
- You run
odoo-backupwithout arguments - A display is available (not SSH/Docker)
- tkinter is installed
The GUI provides:
- Visual connection management
- Easy backup/restore operations
- Progress tracking
- Connection testing
- Safety features clearly visible
CLI Mode
The CLI is used when:
- You explicitly use
--cliflag - No display is available (SSH, Docker, CI/CD)
- Running in scripts or automation
Connection Profiles (Recommended)
Save Connection Profiles
# Production connection (restore disabled by default for safety)
odoo-backup --cli connections save \
--name prod \
--host db.example.com \
--user odoo \
--database mydb \
--filestore /var/lib/odoo
# Development connection (with restore enabled)
odoo-backup --cli connections save \
--name dev \
--host localhost \
--user odoo \
--database devdb \
--filestore /var/lib/odoo \
--allow-restore
Use Connection Profiles
# Backup using connection
odoo-backup --cli backup --connection prod
# Restore using connection (only works if --allow-restore was set)
odoo-backup --cli restore --connection dev --file backup.tar.gz --name test_db
# Restore with neutralization for safe testing
odoo-backup --cli restore --connection dev --file backup.tar.gz --name test_db --neutralize
List Connections
odoo-backup --cli connections list
# Shows 🔒 for production (restore disabled) or ✅ for dev (restore enabled)
Manual Operations (Without Profiles)
Backup Operations
# Backup database and filestore
odoo-backup --cli backup \
--name mydb \
--host localhost \
--user odoo \
--filestore /var/lib/odoo/filestore
# Backup database only
odoo-backup --cli backup \
--name mydb \
--host localhost \
--user odoo \
--no-filestore
# Backup with specific output directory
odoo-backup --cli backup \
--name mydb \
--host localhost \
--user odoo \
--output-dir /backups
Restore Operations
# Restore from backup file
odoo-backup --cli restore \
--file backup_MYDB_20240101_120000.tar.gz \
--name newdb \
--host localhost \
--user odoo
# Restore with database neutralization (safe for testing)
odoo-backup --cli restore \
--file backup.tar.gz \
--name testdb \
--host localhost \
--user odoo \
--neutralize
Database Neutralization
When using the --neutralize flag during restore, the following safety measures are applied:
- ✉️ All outgoing mail servers are disabled
- ⏰ All scheduled actions (crons) are disabled
- 🔑 Admin password is reset to 'admin'
- 👥 All user passwords are reset to 'demo'
- 🔔 All notification channels are disabled
This ensures your test database won't send emails or execute scheduled tasks.
Automation & Scripting
Cron Job Example
# Add to crontab for daily backups at 2 AM
0 2 * * * /usr/local/bin/odoo-backup --cli backup --connection prod
Bash Script Example
#!/bin/bash
# backup-all-databases.sh
DATABASES=("db1" "db2" "db3")
for DB in "${DATABASES[@]}"; do
odoo-backup --cli backup --connection prod --name "$DB"
done
Docker Usage
# In your Dockerfile
RUN pip install odoo-backup-manager
# In your script
CMD ["odoo-backup", "--cli", "backup", "--connection", "prod"]
CI/CD Pipeline
# .github/workflows/backup.yml
- name: Backup Odoo Database
run: |
odoo-backup --cli backup \
--name ${{ secrets.DB_NAME }} \
--host ${{ secrets.DB_HOST }} \
--user ${{ secrets.DB_USER }} \
--password ${{ secrets.DB_PASSWORD }}
Configuration
The tool stores its configuration in ~/.config/odoo-backup-manager/:
config.json: Application settingsconnections.db: Encrypted connection profiles
Default Configuration
{
"backup_dir": "~/Documents/OdooBackups",
"default_odoo_version": "17.0",
"pg_dump_options": ["--no-owner", "--no-acl"],
"compression_level": 6,
"max_backup_age_days": 30,
"auto_cleanup": false,
"verbose": false
}
Backup File Structure
Backup archives (backup_DBNAME_YYYYMMDD_HHMMSS.tar.gz) contain:
database.sql: PostgreSQL database dumpfilestore.tar.gz: Compressed filestore data (if included)metadata.json: Backup metadata (timestamp, database name, Odoo version)
Security Features
- 🔐 Encrypted Storage: Passwords are encrypted using machine-specific keys
- 🚫 Production Protection: Connections are protected from restore by default
- 🔑 SSH Support: Key-based and password authentication for remote connections
- 🛡️ Safe Defaults: Must explicitly enable restore capability for connections
Troubleshooting
GUI Not Launching
# Check if display is available
echo $DISPLAY
# Install tkinter if missing
sudo apt-get install python3-tk
# Force CLI mode as fallback
odoo-backup --cli [command]
Permission Denied
- Ensure read access to filestore directory
- Ensure write access to backup directory
- Check PostgreSQL user permissions
Connection Issues
# Test connection manually
psql -h hostname -U username -d database -c "SELECT version();"
# Check SSH access for remote connections
ssh user@host "echo 'SSH connection successful'"
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
pytest - Submit a pull request
License
MIT License - see LICENSE file for details
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- PyPI: odoo-backup-manager
Credits
Developed for the Odoo community to simplify backup and restore operations while maintaining safety and ease of use.
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 odoo_backup_manager-1.5.7.tar.gz.
File metadata
- Download URL: odoo_backup_manager-1.5.7.tar.gz
- Upload date:
- Size: 53.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7eebeb6ec217f3a9403ea053923a7050f6923f39432f8b9b9eee095192ca23d
|
|
| MD5 |
f5a7067da21a4fec2d435a11aed3a3aa
|
|
| BLAKE2b-256 |
aff3d470b79021aca31790335c604c14d88b63a1a26d1d2bde5d5e9dd071a872
|
Provenance
The following attestation bundles were made for odoo_backup_manager-1.5.7.tar.gz:
Publisher:
pypi-publish.yml on jpsteil/odoo-backup-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
odoo_backup_manager-1.5.7.tar.gz -
Subject digest:
d7eebeb6ec217f3a9403ea053923a7050f6923f39432f8b9b9eee095192ca23d - Sigstore transparency entry: 430761991
- Sigstore integration time:
-
Permalink:
jpsteil/odoo-backup-manager@dcc9d2da7cf023dcb869e41eeaeb2079da340472 -
Branch / Tag:
refs/tags/v1.5.7 - Owner: https://github.com/jpsteil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@dcc9d2da7cf023dcb869e41eeaeb2079da340472 -
Trigger Event:
push
-
Statement type:
File details
Details for the file odoo_backup_manager-1.5.7-py3-none-any.whl.
File metadata
- Download URL: odoo_backup_manager-1.5.7-py3-none-any.whl
- Upload date:
- Size: 57.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86a59c0d8c122bc31295acdc55d596c8660e425b2a2313094df92adf5ac45602
|
|
| MD5 |
d54023cce7e6b36e2aaaee6df545dcb2
|
|
| BLAKE2b-256 |
712cfffb3bca9e028ce03b6a56bd11e57d34056418c2e93ce55e3dcb8d341ea9
|
Provenance
The following attestation bundles were made for odoo_backup_manager-1.5.7-py3-none-any.whl:
Publisher:
pypi-publish.yml on jpsteil/odoo-backup-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
odoo_backup_manager-1.5.7-py3-none-any.whl -
Subject digest:
86a59c0d8c122bc31295acdc55d596c8660e425b2a2313094df92adf5ac45602 - Sigstore transparency entry: 430762025
- Sigstore integration time:
-
Permalink:
jpsteil/odoo-backup-manager@dcc9d2da7cf023dcb869e41eeaeb2079da340472 -
Branch / Tag:
refs/tags/v1.5.7 - Owner: https://github.com/jpsteil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@dcc9d2da7cf023dcb869e41eeaeb2079da340472 -
Trigger Event:
push
-
Statement type: