Production-.ready Odoo deployment with Traefik reverse proxy, automatic SSL certificates, and PostgreSQL 17.
- 🚀 One-Command Deployment -
./deploy.shand you're done - 🔒 Automatic HTTPS - Let's Encrypt SSL certificates with auto-renewal
- 🌐 WebSocket Support - Real-time chat and notifications (longpolling enabled)
- 📦 Dual Deployment Modes - Official Docker images or Git source
- 🛡️ Production Ready - Isolated networks, security best practices
- ⚙️ Easy Configuration - Just edit 3
.envfiles
Create and edit three configuration files:
traefik/.env
LETS_ENCRYPT_CONTACT_EMAIL=admin@yourdomain.com
DOMAIN_NAME=`traefik.yourdomain.com`postgresql/.env
POSTGRES_DB=postgres
POSTGRES_PASSWORD=strongpassword
POSTGRES_USER=odooodoo/.env
DEPLOYMENT_MODE=image
ODOO_VERSION=19.0
HOST=postgresql
USER=odoo
PASSWORD=strongpassword
DOMAIN=`odoo.yourdomain.com`chmod +x deploy.sh && ./deploy.shThat's it! 🎉 The script will:
- ✅ Create Docker networks
- ✅ Configure Let's Encrypt
- ✅ Build all services
- ✅ Start everything with longpolling enabled
- Odoo:
https://odoo.yourdomain.com - Traefik Dashboard:
https://traefik.yourdomain.com:8080
Default Credentials:
- Master password:
odooPassword(change inodoo/odoo.conf)
docker-traefik/
├── deploy.sh # One-command deployment script
├── build-all.sh # Build all services
├── start-all.sh # Start all services
├── stop-all.sh # Stop all services
├── traefik/
│ ├── .env # Traefik configuration
│ └── docker-compose.yml
├── postgresql/
│ ├── .env # Database configuration
│ └── docker-compose.yml
└── odoo/
├── .env # Odoo configuration
├── docker-compose.yml
├── odoo.conf # Odoo settings (workers, longpolling, etc.)
├── extra-addons/ # Custom modules
└── custom-addons/ # Additional modules
Uses official Odoo Docker images - fast, stable, and production-ready.
DEPLOYMENT_MODE=image
ODOO_VERSION=19.0 # or 18.0, 17.0, 16.0, etc.Pros:
- ⚡ Fast build (2-5 minutes)
- ✅ Stable and tested
- 💾 Smaller size (~2 GB)
- 🔄 Easy updates (
docker pull)
Clones Odoo from Git - full source access for customization.
DEPLOYMENT_MODE=source
ODOO_REPO=https://github.com/odoo/odoo.git
ODOO_BRANCH=saas-18.4 # or master, 19.0, etc.Pros:
- 🔧 Full source code access
- 🎯 Use specific branches (saas-18.4, master, etc.)
- 🛠️ Easy customization
- 🚀 Development-friendly
Cons:
- 🐌 Slower build (10-20 minutes)
- 💾 Larger size (~5-8 GB)
Internet
↓
┌──────────────────┐
│ Traefik v2.10 │ ← Port 80/443
│ (Reverse Proxy)│
│ • Auto HTTPS │
│ • SSL Certs │
└──────────────────┘
↓
traefik-network (Docker)
↓
┌──────────────────┐
│ Odoo Container │
│ Port 8069/8072 │ ← Longpolling enabled
└──────────────────┘
↓
postgres-network (Docker)
↓
┌──────────────────┐
│ PostgreSQL 17 │
│ (Internal only)│
└──────────────────┘
Networks:
traefik-network: Public-facing (Traefik ↔ Odoo)postgres-network: Internal only (Odoo ↔ PostgreSQL)
Security:
- PostgreSQL is NOT exposed to internet
- Automatic SSL/TLS encryption
- Network isolation
Key settings for production:
# Longpolling (WebSocket support)
workers = 2 # Must be >= 2 for longpolling
gevent_port = 8072 # WebSocket port
# Database
db_host = postgresql
db_port = 5432
db_user = odoo
db_password = odoo
db_maxconn = 64
# Performance
limit_memory_soft = 4294967296
limit_memory_hard = 5368709120
workers = 2 # Adjust based on CPU coresWorker Calculation:
workers = (CPU_cores * 2) + 1
For production:
- 2 CPU cores → 5 workers
- 4 CPU cores → 9 workers
- 8 CPU cores → 17 workers
cd odoo && docker compose logs -f
cd traefik && docker compose logs -f
cd postgresql && docker compose logs -f./stop-all.sh && ./start-all.sh# Edit odoo/.env
ODOO_VERSION=18.0
# Rebuild
cd odoo && docker compose up -d --build# Place your modules in:
odoo/extra-addons/your_module/
# Restart Odoo
cd odoo && docker compose restartAutomatically backs up PostgreSQL database + Odoo Filestore.
./backup.sh- Saved in
./backups/YYYY-MM-DD_HH-MM-SS.tar.gz - Automatically deletes backups older than 7 days
Interactively restore from an existing backup.
./restore.shWarning: This overwrites the current database and filestore!
Add this to your crontab (crontab -e) to backup daily at 3 AM:
0 3 * * * cd /path/to/docker-traefik && ./backup.sh >> ./backup.log 2>&1Check if workers >= 2:
grep "^workers" odoo/odoo.conf
# Should show: workers = 2 or higherIf workers = 1, edit odoo/odoo.conf:
workers = 2Then restart:
cd odoo && docker compose restartVerify in browser DevTools (F12 → Network → WS):
- Should see:
wss://your-domain.com/websocket - Status:
101 Switching Protocols
- Check DNS points to your server IP
- Ensure ports 80 and 443 are open
- View Traefik logs:
cd traefik && docker compose logs -f
Check both services are on same network:
docker network inspect postgres-networkVerify credentials in .env files match.
View detailed logs:
cd odoo && docker compose logs --tail=50Check if ports are already in use:
docker ps
netstat -tulpn | grep -E '(8069|8072|5432)'| Feature | Image Mode | Source Mode |
|---|---|---|
| Build Time | ⚡ 2-5 minutes | 🐌 10-20 minutes |
| Disk Space | 💾 ~2 GB | 💾 ~5-8 GB |
| Stability | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Customization | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Best For | Production | Development |
| Updates | docker pull |
git pull + rebuild |
-
Change Default Passwords
- Edit
odoo/odoo.conf→ changeadmin_passwd - Edit
postgresql/.env→ changePOSTGRES_PASSWORD
- Edit
-
Firewall Configuration
ufw allow 80/tcp ufw allow 443/tcp ufw enable -
Regular Updates
docker compose pull docker compose up -d
-
Backup Database
./backup.sh
Edit odoo/.env:
DOMAIN=`odoo1.com`, `odoo2.com`, `odoo3.com`DEPLOYMENT_MODE=source
ODOO_REPO=https://github.com/yourcompany/odoo-fork.git
ODOO_BRANCH=feature-custom-moduleAdd to docker-compose.yml:
services:
odoo:
deploy:
resources:
limits:
cpus: '2'
memory: 4GContributions are welcome! Feel free to:
- ⭐ Star the repository
- 🐛 Report bugs
- 💡 Suggest features
- 📖 Improve documentation
- 🔀 Submit pull requests
MIT License - see LICENSE file for details.
Made with ❤️ by Dustin Mimbela
Happy Deploying! 🚀