Skip to main content

Docker-based Odoo database migration tool using OpenUpgrade framework

Project description

OdooUpgrader

GitHub Release Python Version Docker Downloads

Professional command-line tool for automating Odoo database upgrades using OCA's OpenUpgrade framework. Seamlessly upgrade your Odoo databases from version 10.0 through 18.0 with a single command.

โœจ Features

  • ๐Ÿš€ Automated Incremental Upgrades: Automatically handles multi-step upgrades
  • ๐Ÿ“ฆ Multiple Source Formats: Supports both .zip and .dump database files
  • ๐ŸŒ Remote Downloads: Download databases directly from URLs
  • ๐Ÿ”Œ Custom Addons Support: Include custom Odoo modules during the upgrade process
  • ๐Ÿณ Docker-Based: Uses containerized environments for safe, isolated upgrades
  • ๐Ÿ“Š Rich CLI Output: Beautiful progress bars and status indicators using Rich library
  • ๐Ÿ“ Detailed Logging: Optional verbose mode and log file support
  • โœ… Validation: Pre-flight checks for source accessibility and Docker availability

๐Ÿ“‹ Requirements

  • Python: 3.9 or higher
  • Docker: Docker Engine with Docker Compose (v2) or docker-compose (v1)
  • Operating System: Linux, macOS, or Windows (with WSL2 for best results)
  • Disk Space: Minimum 5GB free space for Docker volumes and temporary files

๐Ÿš€ Installation

Using pip (Recommended)

pip install odooupgrader

From Source

git clone https://github.com/fasilwdr/OdooUpgrader.git
cd OdooUpgrader
pip install -e .

๐Ÿ“– Usage

Basic Usage

Upgrade a local database file to version 16.0:

odooupgrader --source /path/to/database.zip --version 16.0

Download and Upgrade from URL

odooupgrader --source https://example.com/database.dump --version 17.0

Upgrade with Custom Addons

Include custom addons from a local directory:

odooupgrader --source /path/to/database.zip --version 16.0 --extra-addons /path/to/custom_addons

Include custom addons from a local ZIP file:

odooupgrader --source /path/to/database.zip --version 16.0 --extra-addons /path/to/addons.zip

Include custom addons from a remote ZIP URL:

odooupgrader --source /path/to/database.zip --version 16.0 --extra-addons https://example.com/custom_addons.zip

Specify PostgreSQL Version

odooupgrader --source /path/to/database.zip --version 16.0 --postgres-version 15

Enable Verbose Logging

odooupgrader --source /path/to/database.zip --version 18.0 --verbose

Save Logs to File

odooupgrader --source /path/to/database.zip --version 15.0 --log-file upgrade.log

Complete Example with All Options

odooupgrader \
  --source https://example.com/database.dump \
  --version 17.0 \
  --extra-addons https://example.com/custom_modules.zip \
  --postgres-version 15 \
  --verbose \
  --log-file upgrade.log

๐ŸŽฏ Command-Line Options

Option Required Description
--source โœ… Path to local .zip/.dump file or URL to download
--version โœ… Target Odoo version (10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
--extra-addons โŒ Custom addons location: local folder, local .zip file, or URL to .zip file
--postgres-version โŒ PostgreSQL version for the database container (default: 13)
--verbose โŒ Enable verbose logging output
--log-file โŒ Path to save detailed log file

๐Ÿ“„ How It Works

  1. Validation: Checks if source file/URL is accessible and Docker is available
  2. Environment Setup: Creates necessary directories and PostgreSQL container
  3. Source Processing: Downloads (if URL) and extracts the database
  4. Addons Processing: Downloads and extracts custom addons (if provided)
  5. Database Restoration: Restores database and filestore to PostgreSQL
  6. Version Detection: Determines current database version
  7. Incremental Upgrades: Runs OpenUpgrade for each version step with custom addons
  8. Package Creation: Creates final .zip with upgraded database and filestore

๐Ÿ“ Output Structure

After successful upgrade, you'll find in the output directory:

output/
โ”œโ”€โ”€ upgraded.zip          # Final packaged database (ready to restore)
โ””โ”€โ”€ odoo.log             # Upgrade process logs

๐Ÿ— Architecture

graph TD
    A[Input Source] --> B{File Type?}
    B -->|ZIP| C[Extract ZIP]
    B -->|DUMP| D[Copy DUMP]
    C --> E[Database Container]
    D --> E
    E --> F[Restore Database]
    F --> G[Get Current Version]
    G --> H{Current < Target?}
    H -->|Yes| I[Build Upgrade Container]
    I --> J{Extra Addons ?}
    J -->|Yes| K[Mount Custom Addons]
    J -->|No| L[Run OpenUpgrade]
    K --> L
    L --> M[Update Database]
    M --> N[Get New Version]
    N --> H
    H -->|No| O[Create Final Package]
    O --> P[Cleanup]

๐Ÿ”ง Custom Addons

The --extra-addons option allows you to include custom Odoo modules during the upgrade process. This is essential when your database uses custom addons that need to be available during migration.

Supported Formats

  • Local Directory: --extra-addons /path/to/custom_addons
  • Local ZIP File: --extra-addons /path/to/addons.zip
  • Remote ZIP URL: --extra-addons https://example.com/custom_modules.zip

Directory Structure

custom_addons/
โ”œโ”€โ”€ requirements.txt       # Optional: Python dependencies for your addons
โ”œโ”€โ”€ module_1/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ __manifest__.py
โ”œโ”€โ”€ module_2/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ __manifest__.py

Note: If your custom addons require additional Python packages, include a requirements.txt file in the root directory. Dependencies will be automatically installed during the upgrade process.

๐Ÿ“š Supported Versions

This tool supports upgrading Odoo databases from version 10.0 through 18.0. The upgrade paths and compatibility are determined by the OCA OpenUpgrade project, which maintains migration scripts for each Odoo version.

๐Ÿค Contributing

Contributions are welcome!

๐Ÿ”’ Security Considerations

  • Database credentials are hardcoded for the temporary Docker container
  • The PostgreSQL container is on an isolated Docker network
  • No ports are exposed to the host machine
  • Containers are automatically cleaned up after upgrade
  • Consider using this tool in isolated environments for production databases

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

๐Ÿ“ˆ Changelog

Version 0.2.0

  • โœจ Added custom addons support via --extra-addons option
  • ๐Ÿ“ฆ Support for local directories, local ZIP files, and remote ZIP URLs
  • ๐Ÿ”Œ Automatic addon mounting during upgrade process
  • ๐ŸŽฏ Enhanced upgrade workflow with custom module integration

Version 0.1.0 (Initial Release)

  • โœจ Initial release with core upgrade functionality
  • โœ… Support for Odoo versions 10.0 through 18.0
  • ๐Ÿณ Docker-based isolated upgrade environment
  • ๐Ÿ“Š Rich CLI output with progress indicators
  • ๐ŸŒ URL download support for remote databases
  • ๐Ÿ“ฆ Automatic packaging of upgraded databases

Made with โค๏ธ by Fasil | Powered by OpenUpgrade

โญ If you find this tool helpful, please star the repository!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odooupgrader-0.2.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odooupgrader-0.2.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file odooupgrader-0.2.0.tar.gz.

File metadata

  • Download URL: odooupgrader-0.2.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odooupgrader-0.2.0.tar.gz
Algorithm Hash digest
SHA256 642afb2d6c28249a7475739d9690a36cb4976a103457bf8c6c85131df6887eba
MD5 39f2784a653e0feacb4d572c505f60d5
BLAKE2b-256 602f91059b773fd82d8b4ce9cc7b360ea7257136332933aa716c32f05178c15d

See more details on using hashes here.

Provenance

The following attestation bundles were made for odooupgrader-0.2.0.tar.gz:

Publisher: publish-pypi.yml on fasilwdr/OdooUpgrader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file odooupgrader-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: odooupgrader-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odooupgrader-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85feb4d871daf50a6424355ba4722cc55eeecb52c384eeaa1f59231bb62c527d
MD5 5fd75d4216b8017622f5b292c36e4eaa
BLAKE2b-256 506887c9bce8f781ac930bc961fac8cc07e2866cff6a3682b6b5c88681d5d713

See more details on using hashes here.

Provenance

The following attestation bundles were made for odooupgrader-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on fasilwdr/OdooUpgrader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page