Hibou Roost - Odoo: Odoo Database Management: Database Backup

Purpose

This document outlines two methods in which to back up your Odoo database.

Backup of Odoo typically includes two pieces:

  1. The Postgres database (typically in a 'dump' or plain text format, but occasionally in a 'custom' format)

  2. The 'filestore' (typically a directory with ~250 additional directories in it (to spread out the files across 2 characters of the hash of the file content, the files themselves are stored without file extension and hashed by content).

There is a 'combined' format that Odoo puts together with a .zip file that includes a 'filestore' directory and 'dump.sql' file (and maybe a manifest, but that is not required or always present - e.g. Odoo.sh does not have a manifest file, and will include an empty filestore if the filestore is not requested).

Processes

Odoo Database Manager

Odoo has a database manager that may be accessed via the route /web/database/manager

To use it, you will need the so called 'master password' of the installation.  You can use the database manager with a regular browser.  However, it is often times more reliable to 'script' the download of a backup. In the following example, we are using the native "XML-RPC" port for odoo, and utilizing intranet style DNS (aka this is useful in a kubernetes environment where there is a deployment named 'odoo13' in the namespace 'odoo-prod').  It will download the backup to /tmp/backup.zip as is customary.

curl -k -X POST -F "master_pwd=their_master_pass" -F "name=prod-db" -F "backup_format=zip" -o /tmp/backup.zip   http://odoo13.odoo-prod:8069/web/database/backup

Hibou Flow Backup

Flow can create backups, and even push them into S3/Minio (allowing you to make a backup in one container, get the shared link at the end and use it to make a restore in a different container).

The below examples are similar to the above ones.  Very simple command to backup the database to /tmp/backup.zip , a more complicated one to push the backup into a Minio bucket named client-backups.

Find all of the options in the easy to read source code https://gitlab.com/hibou-io/hibou-odoo/flow/-/blob/master/odoo/backup.py

/entrypoint.sh flow odoo-backup -d prod
# OR
/entrypoint.sh flow odoo-backup -d prod \
  --backup_dest 's3://client-backups/abc-prod-2020-12-31.zip' \
  --backup_minio_host ca-b1.hiboucorp.com \
  --backup_minio_access_key minio \
  --backup_minio_secret_key miniokey \
  --backup_minio_secure 1