# Odoo Backup Manager
[](https://pypi.org/project/odoo-backup-manager/)
[](https://pypi.org/project/odoo-backup-manager/)
[](https://opensource.org/licenses/MIT)
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)
```bash
pip install odoo-backup-manager
```
### From Source
```bash
# 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
```bash
sudo apt-get update
sudo apt-get install postgresql-client
```
#### RHEL/CentOS/Fedora
```bash
sudo dnf install postgresql
```
#### macOS
```bash
brew install postgresql
```
## Quick Start
### Default Behavior (v1.1.0+)
```bash
# 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-backup` without 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 `--cli` flag
- No display is available (SSH, Docker, CI/CD)
- Running in scripts or automation
## Connection Profiles (Recommended)
### Save Connection Profiles
```bash
# 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
```bash
# 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
```bash
odoo-backup --cli connections list
# Shows ๐ for production (restore disabled) or โ
for dev (restore enabled)
```
## Manual Operations (Without Profiles)
### Backup Operations
```bash
# 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
```bash
# 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
```bash
# Add to crontab for daily backups at 2 AM
0 2 * * * /usr/local/bin/odoo-backup --cli backup --connection prod
```
### Bash Script Example
```bash
#!/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
```dockerfile
# In your Dockerfile
RUN pip install odoo-backup-manager
# In your script
CMD ["odoo-backup", "--cli", "backup", "--connection", "prod"]
```
### CI/CD Pipeline
```yaml
# .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 settings
- `connections.db`: Encrypted connection profiles
### Default Configuration
```json
{
"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 dump
- `filestore.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
```bash
# 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
```bash
# 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
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run tests: `pytest`
5. Submit a pull request
## License
MIT License - see [LICENSE](LICENSE) file for details
## Support
- **Issues**: [GitHub Issues](https://github.com/jpsteil/odoo-backup-manager/issues)
- **Discussions**: [GitHub Discussions](https://github.com/jpsteil/odoo-backup-manager/discussions)
- **PyPI**: [odoo-backup-manager](https://pypi.org/project/odoo-backup-manager/)
## Credits
Developed for the Odoo community to simplify backup and restore operations while maintaining safety and ease of use.
Raw data
{
"_id": null,
"home_page": "https://github.com/jpsteil/odoo-backup-manager",
"name": "odoo-backup-manager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "odoo, backup, restore, database, postgresql",
"author": "Jim Steil",
"author_email": "Jim Steil <jim@steilonline.com>",
"download_url": "https://files.pythonhosted.org/packages/9f/63/233abdf2df7bd6a43269983c06e6b6ae2cadaa06b4dea61b159bd81e5507/odoo_backup_manager-1.1.4.tar.gz",
"platform": null,
"description": "# Odoo Backup Manager\n\n[](https://pypi.org/project/odoo-backup-manager/)\n[](https://pypi.org/project/odoo-backup-manager/)\n[](https://opensource.org/licenses/MIT)\n\nA 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.\n\n## Features\n\n- \ud83c\udfaf **Smart Interface**: Automatically launches GUI when available, falls back to CLI\n- \ud83d\uddc4\ufe0f **Complete Backup & Restore**: Handles both PostgreSQL database and Odoo filestore\n- \ud83d\udd12 **Secure Storage**: Encrypted password storage for connection profiles\n- \ud83c\udf10 **Remote Support**: Backup/restore from remote servers via SSH\n- \ud83d\udcbe **Connection Profiles**: Save and reuse connection configurations\n- \ud83d\udda5\ufe0f **Dual Interface**: Both GUI and CLI modes available\n- \ud83d\udce6 **Archive Management**: Creates compressed archives with metadata\n- \ud83d\udd04 **Flexible Operations**: Backup only, restore only, or backup & restore in one operation\n- \ud83d\udee1\ufe0f **Production Protection**: Prevent accidental restores to production databases\n- \ud83e\uddea **Database Neutralization**: Safe testing with disabled emails and reset passwords\n\n## Installation\n\n### Using pip (Recommended)\n\n```bash\npip install odoo-backup-manager\n```\n\n### From Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/jpsteil/odoo-backup-manager.git\ncd odoo-backup-manager\n\n# Install the package\npip install -e .\n\n# For development\npip install -r requirements-dev.txt\n```\n\n## Prerequisites\n\n- Python 3.8 or higher\n- PostgreSQL client tools (`pg_dump`, `pg_restore`, `psql`)\n- tar command-line utility\n- tkinter (for GUI mode) - usually included with Python\n\n### Installing PostgreSQL Client Tools\n\n#### Ubuntu/Debian\n```bash\nsudo apt-get update\nsudo apt-get install postgresql-client\n```\n\n#### RHEL/CentOS/Fedora\n```bash\nsudo dnf install postgresql\n```\n\n#### macOS\n```bash\nbrew install postgresql\n```\n\n## Quick Start\n\n### Default Behavior (v1.1.0+)\n\n```bash\n# Launch the application (GUI if available, otherwise help)\nodoo-backup\n\n# Force GUI mode (error if not available)\nodoo-backup --gui\n\n# Force CLI mode\nodoo-backup --cli\n\n# Show CLI help\nodoo-backup --cli --help\n```\n\n### GUI Mode\n\nThe GUI automatically launches when:\n- You run `odoo-backup` without arguments\n- A display is available (not SSH/Docker)\n- tkinter is installed\n\nThe GUI provides:\n- Visual connection management\n- Easy backup/restore operations\n- Progress tracking\n- Connection testing\n- Safety features clearly visible\n\n### CLI Mode\n\nThe CLI is used when:\n- You explicitly use `--cli` flag\n- No display is available (SSH, Docker, CI/CD)\n- Running in scripts or automation\n\n## Connection Profiles (Recommended)\n\n### Save Connection Profiles\n\n```bash\n# Production connection (restore disabled by default for safety)\nodoo-backup --cli connections save \\\n --name prod \\\n --host db.example.com \\\n --user odoo \\\n --database mydb \\\n --filestore /var/lib/odoo\n\n# Development connection (with restore enabled)\nodoo-backup --cli connections save \\\n --name dev \\\n --host localhost \\\n --user odoo \\\n --database devdb \\\n --filestore /var/lib/odoo \\\n --allow-restore\n```\n\n### Use Connection Profiles\n\n```bash\n# Backup using connection\nodoo-backup --cli backup --connection prod\n\n# Restore using connection (only works if --allow-restore was set)\nodoo-backup --cli restore --connection dev --file backup.tar.gz --name test_db\n\n# Restore with neutralization for safe testing\nodoo-backup --cli restore --connection dev --file backup.tar.gz --name test_db --neutralize\n```\n\n### List Connections\n\n```bash\nodoo-backup --cli connections list\n# Shows \ud83d\udd12 for production (restore disabled) or \u2705 for dev (restore enabled)\n```\n\n## Manual Operations (Without Profiles)\n\n### Backup Operations\n\n```bash\n# Backup database and filestore\nodoo-backup --cli backup \\\n --name mydb \\\n --host localhost \\\n --user odoo \\\n --filestore /var/lib/odoo/filestore\n\n# Backup database only\nodoo-backup --cli backup \\\n --name mydb \\\n --host localhost \\\n --user odoo \\\n --no-filestore\n\n# Backup with specific output directory\nodoo-backup --cli backup \\\n --name mydb \\\n --host localhost \\\n --user odoo \\\n --output-dir /backups\n```\n\n### Restore Operations\n\n```bash\n# Restore from backup file\nodoo-backup --cli restore \\\n --file backup_MYDB_20240101_120000.tar.gz \\\n --name newdb \\\n --host localhost \\\n --user odoo\n\n# Restore with database neutralization (safe for testing)\nodoo-backup --cli restore \\\n --file backup.tar.gz \\\n --name testdb \\\n --host localhost \\\n --user odoo \\\n --neutralize\n```\n\n## Database Neutralization\n\nWhen using the `--neutralize` flag during restore, the following safety measures are applied:\n\n- \u2709\ufe0f All outgoing mail servers are disabled\n- \u23f0 All scheduled actions (crons) are disabled \n- \ud83d\udd11 Admin password is reset to 'admin'\n- \ud83d\udc65 All user passwords are reset to 'demo'\n- \ud83d\udd14 All notification channels are disabled\n\nThis ensures your test database won't send emails or execute scheduled tasks.\n\n## Automation & Scripting\n\n### Cron Job Example\n\n```bash\n# Add to crontab for daily backups at 2 AM\n0 2 * * * /usr/local/bin/odoo-backup --cli backup --connection prod\n```\n\n### Bash Script Example\n\n```bash\n#!/bin/bash\n# backup-all-databases.sh\n\nDATABASES=(\"db1\" \"db2\" \"db3\")\nfor DB in \"${DATABASES[@]}\"; do\n odoo-backup --cli backup --connection prod --name \"$DB\"\ndone\n```\n\n### Docker Usage\n\n```dockerfile\n# In your Dockerfile\nRUN pip install odoo-backup-manager\n\n# In your script\nCMD [\"odoo-backup\", \"--cli\", \"backup\", \"--connection\", \"prod\"]\n```\n\n### CI/CD Pipeline\n\n```yaml\n# .github/workflows/backup.yml\n- name: Backup Odoo Database\n run: |\n odoo-backup --cli backup \\\n --name ${{ secrets.DB_NAME }} \\\n --host ${{ secrets.DB_HOST }} \\\n --user ${{ secrets.DB_USER }} \\\n --password ${{ secrets.DB_PASSWORD }}\n```\n\n## Configuration\n\nThe tool stores its configuration in `~/.config/odoo-backup-manager/`:\n- `config.json`: Application settings\n- `connections.db`: Encrypted connection profiles\n\n### Default Configuration\n\n```json\n{\n \"backup_dir\": \"~/Documents/OdooBackups\",\n \"default_odoo_version\": \"17.0\",\n \"pg_dump_options\": [\"--no-owner\", \"--no-acl\"],\n \"compression_level\": 6,\n \"max_backup_age_days\": 30,\n \"auto_cleanup\": false,\n \"verbose\": false\n}\n```\n\n## Backup File Structure\n\nBackup archives (`backup_DBNAME_YYYYMMDD_HHMMSS.tar.gz`) contain:\n- `database.sql`: PostgreSQL database dump\n- `filestore.tar.gz`: Compressed filestore data (if included)\n- `metadata.json`: Backup metadata (timestamp, database name, Odoo version)\n\n## Security Features\n\n- \ud83d\udd10 **Encrypted Storage**: Passwords are encrypted using machine-specific keys\n- \ud83d\udeab **Production Protection**: Connections are protected from restore by default\n- \ud83d\udd11 **SSH Support**: Key-based and password authentication for remote connections\n- \ud83d\udee1\ufe0f **Safe Defaults**: Must explicitly enable restore capability for connections\n\n## Troubleshooting\n\n### GUI Not Launching\n\n```bash\n# Check if display is available\necho $DISPLAY\n\n# Install tkinter if missing\nsudo apt-get install python3-tk\n\n# Force CLI mode as fallback\nodoo-backup --cli [command]\n```\n\n### Permission Denied\n\n- Ensure read access to filestore directory\n- Ensure write access to backup directory\n- Check PostgreSQL user permissions\n\n### Connection Issues\n\n```bash\n# Test connection manually\npsql -h hostname -U username -d database -c \"SELECT version();\"\n\n# Check SSH access for remote connections\nssh user@host \"echo 'SSH connection successful'\"\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Run tests: `pytest`\n5. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/jpsteil/odoo-backup-manager/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/jpsteil/odoo-backup-manager/discussions)\n- **PyPI**: [odoo-backup-manager](https://pypi.org/project/odoo-backup-manager/)\n\n## Credits\n\nDeveloped for the Odoo community to simplify backup and restore operations while maintaining safety and ease of use.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A comprehensive backup and restore utility for Odoo instances",
"version": "1.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/jpsteil/odoo-backup-manager/issues",
"Documentation": "https://github.com/jpsteil/odoo-backup-manager#readme",
"Homepage": "https://github.com/jpsteil/odoo-backup-manager",
"Repository": "https://github.com/jpsteil/odoo-backup-manager"
},
"split_keywords": [
"odoo",
" backup",
" restore",
" database",
" postgresql"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ad4f3c04f790617100c6571b50ee0f0ec4473b4d5a4eccccb53f1a91d3040321",
"md5": "a0828a66b616ff1d28a3aeded104cacd",
"sha256": "2400e14ad25d920ccc6a98d22d33af1d15ee10b67ee82498ce17d7e247393a6b"
},
"downloads": -1,
"filename": "odoo_backup_manager-1.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a0828a66b616ff1d28a3aeded104cacd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 53640,
"upload_time": "2025-08-24T03:36:59",
"upload_time_iso_8601": "2025-08-24T03:36:59.596518Z",
"url": "https://files.pythonhosted.org/packages/ad/4f/3c04f790617100c6571b50ee0f0ec4473b4d5a4eccccb53f1a91d3040321/odoo_backup_manager-1.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9f63233abdf2df7bd6a43269983c06e6b6ae2cadaa06b4dea61b159bd81e5507",
"md5": "fa81100af61165ccf12e685e3e805e12",
"sha256": "83e10464b248e0976b60d6999f623be1f0b04e6db3ca6f15cee9e68cf8cd0228"
},
"downloads": -1,
"filename": "odoo_backup_manager-1.1.4.tar.gz",
"has_sig": false,
"md5_digest": "fa81100af61165ccf12e685e3e805e12",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 49708,
"upload_time": "2025-08-24T03:37:01",
"upload_time_iso_8601": "2025-08-24T03:37:01.322865Z",
"url": "https://files.pythonhosted.org/packages/9f/63/233abdf2df7bd6a43269983c06e6b6ae2cadaa06b4dea61b159bd81e5507/odoo_backup_manager-1.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 03:37:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jpsteil",
"github_project": "odoo-backup-manager",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "cryptography",
"specs": [
[
">=",
"41.0.0"
]
]
},
{
"name": "paramiko",
"specs": [
[
">=",
"3.0.0"
]
]
}
],
"lcname": "odoo-backup-manager"
}