Skip to main content

CLI for Odoo/Doodba database workflows.

Project description

dbodoo

Python CLI for Odoo/Doodba database workflows.

Automates remote backup, local restore via Docker Compose, and multi-environment management — always operating from the current working directory (Path.cwd()).

Installation

Isolated install with pipx (recommended):

pipx install dbodoo

Local development:

pipx install --editable .
# or
pip install -e .

Quick start

cd ~/projects/my-doodba-project

# 1. Download a backup from the remote server
dbodoo remote -b

# 2. Restore the downloaded ZIP into the local database
dbodoo remote -r

# 3. Or do both in one step
dbodoo remote -b -r

If .remotes.json does not exist yet, the configuration wizard starts automatically on the first command.


Commands

dbodoo init

Create or update .remotes.json with an interactive wizard.

dbodoo init

The wizard asks:

  1. Mode — determines which fields are required:
    • Backup + Restore — downloads the ZIP and restores locally (URL + password + dbname)
    • Backup only — downloads the ZIP only (URL + password + dbname)
    • Restore only — restores an existing ZIP (dbname only)
  2. Remote name (backup modes), database name, URL, and password

If .remotes.json already exists, the wizard offers to add another remote or overwrite the file. Use --force to overwrite without prompting.

Non-interactive (CI / scripts):

# Backup + Restore
dbodoo init --name prod --dbname prod \
            --remote-address https://client.odoo.com/ \
            --password masterpassword

# Restore-only (no URL or password needed)
dbodoo init --name prod --dbname prod

dbodoo remote -b

Download a backup ZIP from the remote Odoo server.

dbodoo remote -b
  • Connects to https://<remote_address>/web/database/backup
  • Shows a Rich progress bar during the download
  • Saves to ../<dbname>.zip (one level above the project root)
  • Distinct error messages for: timeout, connection failure, wrong password (Odoo returns HTML instead of a ZIP), HTTP 4xx/5xx

dbodoo remote -r

Restore the last downloaded ZIP into the local database via Docker Compose.

dbodoo remote -r

# Restore into a database other than 'devel' (the default)
dbodoo remote -r --destination-db staging
  • Expects the ZIP at ../<dbname>.zip — run -b first if it does not exist
  • Detects Docker Compose v2 (docker compose) with fallback to v1 (docker-compose)
  • Runs click-odoo-restoredb inside the odoo service via a read-only bind-mount
  • If the destination database already exists, asks whether to rerun with --force (drops and recreates the database) — never forces automatically
  • Emits a warning if the directory does not look like a Doodba project (missing markers), but does not block

dbodoo remote -b -r

Download a backup and restore it in a single step.

dbodoo remote -b -r

# With an explicit destination database
dbodoo remote -b -r --destination-db staging

If the download fails, the restore is never attempted.


dbodoo admin reset

Reset an Odoo admin user: login, password, TOTP 2FA, and active status.

# Reset to defaults (login=admin, password=admin, user id=2, db=devel)
dbodoo admin reset

# Custom credentials
dbodoo admin reset --login admin --password secret

# Different user or database
dbodoo admin reset --user-id 3
dbodoo admin reset --db staging

# Keep 2FA settings untouched
dbodoo admin reset --keep-2fa

Before running, the command always shows the target database and asks for confirmation — press Enter to accept or type a different name:

Local database name: (devel)

Runs a click-odoo script inside the odoo Docker Compose service (same container as dbodoo remote -r) with a read-only bind-mount, so no extra volume configuration is required.

What the reset does:

Action Default
Set active = True always
Set login admin
Set password admin
NULL totp_secret (disable 2FA) yes (--disable-2fa)

Options:

Flag Default Description
--login TEXT admin New login for the user
--password TEXT admin New plain-text password
--user-id INT 2 Database id of the user
--db TEXT devel Local database name
--disable-2fa / --keep-2fa --disable-2fa Whether to disable TOTP

dbodoo neutralize mail

Disable all outgoing mail servers in a restored local database to prevent accidental email delivery to real customers.

# Neutralize the default 'devel' database
dbodoo neutralize mail

# Neutralize a different database
dbodoo neutralize mail --db staging

Before running, the command asks you to confirm (or change) the target database — press Enter to accept or type a different name:

Local database name: (devel)

What it does:

env['ir.mail_server'].sudo().search([]).write({'active': False})

Expected output:

Neutralizing outgoing mail (db=devel)…
Found 2 mail server(s).
All outgoing mail servers disabled successfully.
✓ Mail neutralization complete.

Uses docker compose run --rm -T odoo shell -d {db} with stdin piping — no external dependencies beyond core Odoo.

Options:

Flag Default Description
--db TEXT devel Local database name

dbodoo choose

Select and print a remote name (useful in scripts).

dbodoo choose

With a single remote configured, selection is automatic.


.remotes.json structure

The file lives at the project root, next to docker-compose.yml.

Backup + Restore / Backup only:

{
  "prod": {
    "remote_address": "client.odoo.com",
    "dbname": "prod",
    "password": "masterpassword"
  },
  "staging": {
    "remote_address": "staging.client.odoo.com",
    "dbname": "staging",
    "password": "masterpassword"
  }
}

Restore only (no remote connection required):

{
  "prod": {
    "dbname": "prod"
  }
}

URLs are normalised on save: https://client.odoo.com:8069/client.odoo.com:8069.


Project detection

dbodoo locates the project root by walking up from cwd, looking for:

  1. .remotes.json
  2. Doodba markers: common.yaml, docker-compose.yml, odoo/custom/src

Configuration is always local to the project — there is no global config file.


Troubleshooting

Backup ZIP not found

Error: Backup ZIP not found at /home/.../project.zip.
Run dbodoo remote -b first to download it.

Run dbodoo remote -b before attempting a restore.


Wrong master password

Error: Authentication failed for 'client.odoo.com'. The server returned
an HTML page instead of a ZIP. Check the master password.

Check the password in .remotes.json or run dbodoo init to update it.


Destination database already exists

Error: Destination database already exists: devel
⚠  click-odoo-restoredb exited with code 1.
? Rerun with --force? (drops and recreates the 'devel' database) (y/N)

Answer y to drop and recreate the database, or n to cancel without touching anything.


Docker Compose not found

Error: Docker Compose not found. Install Docker with the Compose plugin (v2)
or 'docker-compose' (v1).

Install Docker Desktop or the Compose plugin: apt install docker-compose-plugin.


Directory does not look like a Doodba project

Warning: This directory does not look like a Doodba project
(missing: common.yaml, docker-compose.yml, odoo/custom/src).
The Docker restore may not work as expected.

The restore continues, but may fail if the odoo service is not defined in docker-compose.yml. Run dbodoo from the Doodba project root.


.remotes.json not found

The remote command starts the configuration wizard automatically. To create the file manually:

dbodoo init

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

dbodoo-1.0.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

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

dbodoo-1.0.1-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file dbodoo-1.0.1.tar.gz.

File metadata

  • Download URL: dbodoo-1.0.1.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for dbodoo-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b9e345a309e50812ee9035c95e612bf21fb51aa2e0f04d73f115dbd9a0656503
MD5 4ccf80467af8cd3896246de8f35cfb33
BLAKE2b-256 dea0fce1652e48b9df5ba51a950dc915cefe4e11737f6a2cf314b33367478c84

See more details on using hashes here.

File details

Details for the file dbodoo-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: dbodoo-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for dbodoo-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17f495a6be7036662956131d95b7c83fc4600e2bf29099d143141cd351528f6e
MD5 bac67a241bd8b4f929f088f14f7b2aa3
BLAKE2b-256 f0bc9502c563dde94e891eb6f3e3a6993927b948b6a5832e50f2aacb28bddf50

See more details on using hashes here.

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