Sign inSign up

fbieringer/odoo-backup

By fbieringer

Updated almost 2 years ago

A very easy aproach to odoo backup via curl

Image
0

1.5K

fbieringer/odoo-backup repository overview

Odoo Backup Docker

Automated backups for your Odoo instance

How to

This docker container automates the download of an Odoo backup via the Odoo DB Manager. Simply mount /backup into the container to store backups. As an alternative this backup container also offers the solution to create a backup without the web DB manager.

Examples

Backup Odoo with web db manager

version: '3'
services:
  backup:
    image: fbieringer/odoo-backup
    restart: always
    volumes:
      - ./backup:/backup
    environment:

      # Name of the odoo database you want to backup
      ODOO_DATABASE: odoo
      # Master password for the instance
      ADMIN_PASSWORD: admin
      # URL where your odoo is available
      URL: https://odoo.example.com
      # Schedule for your backups
      SCHEDULE: "*/30 * * * *"
      # Delete older backups
      DELETE_AFTER: 14

For large databases the web db manager is not recommended. Instead you can directly connect to the Odoo database and file store:

version: '3'
services:
  backup:
    image: fbieringer/odoo-backup
    restart: always
    volumes:
      - ./backup:/backup

      # Volume or mountpoint that contains the filestore
      - odoo-web-data:/filestore
    environment:
      # Name of the odoo database you want to backup
      ODOO_DATABASE: odoo
      # Database host
      DB_HOST: db
      # Database user
      DB_USER: postgres
      # Database password
      DB_PASSWORD: postgres
      # Schedule for your backups according to cron ( https://en.wikipedia.org/wiki/Cron )
      SCHEDULE: "*/30 * * * *"
      # Delete older backups
      DELETE_AFTER: 14

If you want to deploy your backup automatically to another instance you can use the following example. Please note that since Odoo moved around the structure of the filesystem, the restored database NEEDS to exists. If it doesn't, make sure you initialise it first. This will look for the latest zip file and restore it.

RESTORING YOUR DATABASE WILL DELETE THE PREVIOUS CONTENT! BE SURE YOU KNOW WHAT YOU'RE DOING!

version: '3'
services:
  backup:
    image: fbieringer/odoo-backup
    restart: always
    volumes:
      - ./backup:/backup

      # Volume or mountpoint that contains the filestore
      - odoo-web-data:/filestore
    environment:
      # Name of the odoo database you want to backup
      RESTORE_DB: odoo
      # Database host
      RESTORE_HOST: db
      # Database user
      RESTORE_USER: postgres
      # Database password
      RESTORE_PASSWORD: postgres
      # Schedule for your backups according to cron ( https://en.wikipedia.org/wiki/Cron )
      SCHEDULE: "*/30 * * * *"

Environment

BACKUP_DIR Rewrite the backup directory inside the container

ODOO_DATABASE Define the name of the Odoo database to backup

ADMIN_PASSWORD Masterpassword of the instance

URL URL where the instance is available

SCHEDULE Cronscheduler for the backup (e.g. */30 * * * * )

RESTORE_DB Restore database from latest zip in backup folder

RESTORE_HOST DB host to restore to

RESTORE_USER DB user to restore the database

RESTORE_PASSWORD DB password to restore the database

Tag summary

Content type

Image

Digest

sha256:8f7b538a1

Size

6.5 MB

Last updated

over 3 years ago

docker pull fbieringer/odoo-backup