Skip to Content
Backup Odoo to S3

Backup Odoo to S3

Backup Odoo database to Amazon S3

https://tower.cetmix.com/web/image/product.template/13/image_1920?unique=53e7516
(0 review)
Summary
Categories
Commands
Tags
Odoo Backup Amazon S3
Authors
Cetmix OU
License AGPL-3
Version 1.0.0
Call sign cx_command_backup_odoo_to_s3
Website https://cetmix.com/contactus
Download
16 downloads

📄 Overview

This YAML snippet defines a Cetmix Tower command for backing up an Odoo database and pushing the backup file to an Amazon S3 bucket. It is intended for environments using Docker-based Odoo instances and integrates with AWS S3 via environment-injected credentials.

Important

You must add the following policy for the user you are using to create backups:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:PutObjectTagging"
],
"Resource": "arn:aws:s3:::<your_bucket_name>/*"
}
]
}


🏗️ Architecture Components

1. Execution Layer

  • Command Type: ssh_command

  • Execution Context: Remote Docker container (Odoo)

  • Privileges: Runs as root inside container

  • Parallel Execution: Not allowed

  • Exit Policy: Command stops on error

☁️ Storage Layer

Amazon S3 Integration

  • Upload Tool: AWS CLI inside container

  • Permissions: Requires s3:PutObject permission

  • Tagging Support: Optional tagging via put-object-tagging

  • Storage Path:

    php-template
    CopyEdit
    s3://<bucket_name>/<server_reference>/<instance_name>/<timestamped_backup>.zip

🐘 Odoo Configuration

  • Database Backup: Uses click-odoo-backupdb command

  • Configuration:

    • Injects db_host, db_user, and db_password dynamically into odoo.conf

    • Supports dynamic DB name selection (odoo_db_to_backup_name or fallback to odoo_db_name)

  • Docker Context:

    • Mounts Odoo filestore volume (odoo_data)

    • Uses specified Docker image (odoo_image_name)

    • Joins Docker network if tower_docker_network is defined

🔁 Workflow Summary

  1. Run apt-get install awscli inside the container

  2. Patch /etc/odoo.conf with DB connection info

  3. Perform backup with click-odoo-backupdb

  4. Upload ZIP to S3

  5. Optionally apply backup tagging (e.g. Hourly, Daily)



This package is distributed under the GNU Affero General Public License v3.0 (AGPL-3) or later license.