Backup Odoo to S3
Backup Odoo database to Amazon S3
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 |
📄 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-templateCopyEdits3://<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
Run apt-get install awscli inside the container
Patch /etc/odoo.conf with DB connection info
Perform backup with click-odoo-backupdb
Upload ZIP to S3
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.