Why S3 for Odoo Filestore?
By default, Odoo stores file attachments on the local filesystem. This creates problems at scale: disk fills up, backups include large binary files, and you cannot easily share filestore between multiple Odoo workers or servers. Moving to S3 (or S3-compatible storage) solves all of these.
Benefits
- Unlimited storage — No more disk space issues
- CDN delivery — Serve files from CloudFront/Cloudflare for faster downloads
- Simpler backups — Database backup is smaller without binary files
- High availability — S3 has 99.999999999% durability
- Cost effective — S3 Standard: $0.023/GB/month
Compatible Services
| Service | S3 Compatible | Cost |
|---|---|---|
| AWS S3 | Native | $0.023/GB/mo |
| MinIO | Yes (self-hosted) | Free (open source) |
| DigitalOcean Spaces | Yes | $5/mo for 250GB |
| Wasabi | Yes | $6.99/TB/mo |
| Backblaze B2 | Yes | $0.005/GB/mo |
| Linode Object Storage | Yes | $5/mo for 250GB |
| Google Cloud Storage | Via interop | $0.020/GB/mo |
Setup with OCA Module
Step 1: Install the Module
# Clone OCA storage module
git clone https://github.com/OCA/storage.git --branch 19.0
# Copy fs_storage and fs_attachment to your addons path
# Install: -i fs_storage,fs_attachmentStep 2: Configure S3 Backend
# In Odoo admin:
# Settings → Technical → Filesystem Storage
# Create new storage:
# Name: S3 Filestore
# Protocol: s3
# Options (JSON):
{
"endpoint_url": "https://s3.amazonaws.com",
"aws_access_key_id": "AKIA...",
"aws_secret_access_key": "xxx",
"bucket_name": "my-odoo-filestore",
"region_name": "us-east-1"
}
# For MinIO:
{
"endpoint_url": "https://minio.company.com:9000",
"aws_access_key_id": "minioadmin",
"aws_secret_access_key": "minioadmin",
"bucket_name": "odoo-filestore"
}
# For DigitalOcean Spaces:
{
"endpoint_url": "https://nyc3.digitaloceanspaces.com",
"aws_access_key_id": "xxx",
"aws_secret_access_key": "xxx",
"bucket_name": "odoo-filestore"
}Step 3: Configure Attachment Storage
# Settings → Technical → Attachment Storage
# Create rule:
# Name: S3 Storage
# Storage: S3 Filestore (created above)
# Condition Domain: [] (all attachments)
# Force DB: FalseStep 4: Migrate Existing Files
# Run migration to move existing local files to S3:
# The module provides a migration wizard
# Or use a script:
import boto3
import os
s3 = boto3.client('s3',
endpoint_url='https://s3.amazonaws.com',
aws_access_key_id='AKIA...',
aws_secret_access_key='xxx'
)
filestore_path = '/var/lib/odoo/.local/share/Odoo/filestore/dbname/'
for root, dirs, files in os.walk(filestore_path):
for fname in files:
local_path = os.path.join(root, fname)
s3_key = os.path.relpath(local_path, filestore_path)
s3.upload_file(local_path, 'my-odoo-filestore', s3_key)Alternative: System Parameter Method
# Simpler but less flexible:
# Set ir.config_parameter:
# ir_attachment.location = s3
# Then configure via odoo.conf or environment variables:
# AWS_ACCESS_KEY_ID=xxx
# AWS_SECRET_ACCESS_KEY=xxx
# AWS_BUCKET_NAME=my-odoo-filestore
# AWS_REGION=us-east-1MinIO (Self-Hosted S3)
# Docker Compose for MinIO:
services:
minio:
image: minio/minio
ports:
- "9000:9000"
- "9001:9001" # Console
volumes:
- minio-data:/data
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: server /data --console-address ":9001"
volumes:
minio-data:
# Access console: http://localhost:9001
# Create bucket: odoo-filestore
# S3 endpoint: http://minio:9000 (from Odoo container)Performance Considerations
- Latency: S3 adds ~50-100ms per file request vs local filesystem. Use CDN (CloudFront) to mitigate.
- Thumbnails: Odoo generates image thumbnails on the fly. With S3, this is slower. Consider caching.
- Report generation: wkhtmltopdf needs to access images. Ensure S3 URLs are accessible from the Odoo server.
DeployMonkey
DeployMonkey supports S3-compatible filestore out of the box. Configure your S3 bucket or use DeployMonkey's built-in object storage. The AI agent helps migrate existing files and optimize performance.