Guide to setting up Odoo software with Docker and manual installation
این مقاله راهنمایی جامع برای نصب و پیکربندی نرم‌افزار Odoo به دو روش Docker و دستی است.

Guide to setting up Odoo software with Docker and manual installation

This article will provide a complete walkthrough of setting up Odoo using both Docker and manual installation. You will learn how to optimize Odoo and implement security and scalability recommendations. This guide includes steps, tips, and tricks to best install and configure it to run on cloud and VPS servers.
0 Shares
0
0
0
0

How to set up Odoo fast, secure, and scalable?

This guide provides step-by-step installation and configuration. Odoo Two common methods — Docker installation and traditional (manual) installation — are explained, along with security tips, performance optimization, backup, and HA/Scale solutions for cloud servers and VPS. Examples and commands for distributions based on Debian/Ubuntu are provided and all operational settings and hardware recommendations are preserved.

Brief introduction to Odoo architecture

Odoo It includes the following key components:

  • Python application (backend) that with PostgreSQL It is related.
  • Web client which provides HTTP/WS over port 8069; longpolling For real-time reports and notifications.
  • Filestore To store attachments on disk or cloud solutions (S3).
  • Additional modules and plugins (community Or enterprise).

Prerequisites

Before installation, make sure the following are available:

  • Operating system: Ubuntu 20.04/22.04 or Debian 11/12
  • PostgreSQL 12+ (Compatible with Odoo version)
  • Python 3.8+, pip, virtualenv (for normal installation)
  • Docker Engine + docker-compose (For container method)
  • Nginx or HAProxy As a reverse proxy and SSL termination
  • Memory and processor tailored to user load and automation

Installing Odoo with Docker

Advantages: Isolation, ease of deployment, version compatibility, and management through docker-compose.

Sample docker-compose.yml to get started

version: '3.7'
services:
  db:
    image: postgres:13
    environment:
      POSTGRES_DB: odoo
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo_password_here
    volumes:
      - odoo_db_data:/var/lib/postgresql/data
    restart: always

  odoo:
    image: odoo:16.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    environment:
      HOST: db
      PORT: 5432
      USER: odoo
      PASSWORD: odoo_password_here
    volumes:
      - odoo_data:/var/lib/odoo
      - ./config:/etc/odoo
    restart: always

volumes:
  odoo_db_data:
  odoo_data:

Basic executive commands

docker-compose up -d
docker-compose logs -f odoo

Practical tips for production environments

  • Using an official image or a custom build Which includes the modules and dependencies you need.
  • Volumes must be persistent; use NFS or an appropriate storage driver to deploy to the cluster.
  • Configure SSL at the reverse-proxy layer; connect the Odoo container with proxy_mode = True Run.
  • To back up the database from pg_dump Or use WAL-based tools.

Nginx reverse proxy example (for SSL)

server {
  listen 80;
  server_name odoo.example.com;
  return 301 https://$host$request_uri;
}
server {
  listen 443 ssl;
  server_name odoo.example.com;

  ssl_certificate /etc/letsencrypt/live/odoo.example.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/odoo.example.com/privkey.pem;

  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;

  location / {
    proxy_pass http://127.0.0.1:8069;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
  }

  location /longpolling {
    proxy_pass http://127.0.0.1:8072;
  }
}

Installing Odoo manually on Linux

This method is suitable for single-purpose servers and when you need complete control.

General installation steps

Step 1 — Install Prerequisites:

sudo apt update && sudo apt upgrade -y
sudo apt install -y git python3-pip build-essential python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libpq-dev libjpeg-dev libfreetype6-dev node-less npm wkhtmltopdf

Step 2 — Install PostgreSQL and create user/database:

sudo apt install -y postgresql
sudo -u postgres createuser -s odoo
# یا ایجاد با رمز
sudo -u postgres psql -c "CREATE USER odoo WITH PASSWORD 'secure_password';"
sudo -u postgres psql -c "CREATE DATABASE odoo OWNER odoo;"

Step 3 — Create a system user and virtual environment:

sudo useradd -m -U -r -s /bin/bash odoo
sudo mkdir /opt/odoo && sudo chown odoo: /opt/odoo
sudo -u odoo git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 /opt/odoo/odoo
cd /opt/odoo/odoo
python3 -m venv odoo-venv
source odoo-venv/bin/activate
pip install -r requirements.txt

Step 4 — Configure Odoo (example /etc/odoo.conf):

[options]
; This is the password that allows database operations:
admin_passwd = your_admin_db_password
db_host = False
db_port = False
db_user = odoo
db_password = secure_password
addons_path = /opt/odoo/odoo/addons,/opt/odoo/custom_addons
logfile = /var/log/odoo/odoo.log
proxy_mode = True
workers = 4
max_cron_threads = 1

Step 5 — systemd service (enabling and running Odoo):

sudo systemctl daemon-reload
sudo systemctl enable --now odoo

Production configuration and performance optimization

Critical settings in odoo.conf For production environment:

  • workers: For multiprocessing mode. Suggested formula: workers = (CPU cores * 2) + 1
  • db_maxconn: Maximum number of DB connections (e.g. workers * 3)
  • limit_memory_soft and limit_memory_hard: To prevent OOM
  • proxy_mode = True If using a reverse proxy
  • longpolling: Separating to a different service or port (usually 8072)

Calculation example: 4-core server => workers = 9 and db_maxconn = 60 (adjustable based on needs).

Security and recommended hardware

Network security and recommended settings

  • Firewall: Open only essential ports (e.g. SSH, 80, 443) and restrict access to 8069/8072 to a private network or reverse proxy.
  • TLS: Use of Let's Encrypt and automatic renewal.
  • Fail2Ban: Prevent brute-force on SSH and admin panel.
  • PostgreSQL: Connection only from localhost or private network, strong passwords and user restrictions.
  • Access in Odoo: Restrict permissions and enforce access level controls for users.

Recommended hardware based on usage

  • Development/Testing: 1 vCPU, 2GB RAM, 20GB SSD
  • Small business (5-20 users): 2-4 vCPU, 4-8GB RAM, 50-200GB SSD
  • Medium organization (20-200 users): 4-8 vCPU, 16-64GB RAM, NVMe SSD
  • HA/Enterprise: Multiple servers (app nodes + dedicated DB master+replica + filestore on NFS/object storage)

Backup, monitoring and HA/Scale solutions

Backup

Backup suggestions:

  • Database: Regularly with pg_dump or snapshot at the block level and test restore.
  • Filestore: rsync to object storage (S3-compatible) or NFS mount and backup it.
  • Automation: Cron scripts and 7/30 day retention and migration to another geographical location.
pg_dump -U odoo -Fc odoo > /backups/odoo_$(date +%F).dump

Monitoring

Use of Prometheus + Grafana Or SaaS tools to monitor CPU, RAM, disk i/o, connections, and queues. Send logs to central logging (ELK/Graylog).

High Availability and Scalability

  • PostgreSQL replication (streaming replication) or using Managed DB.
  • Load Balancer (HAProxy/Nginx) and multiple Odoo app nodes.
  • Filestore As shared storage (NFS/Gluster) or S3-compatible to ensure simultaneous access.

Choose a location and offered services

Important points for choosing a location and network:

  • Latency: Choosing a data center close to end users to reduce ping.
  • Compliance: Comply with local laws and privacy regulations.
  • Network: For latency sensitivity, use locations with low ping and a suitable BGP network.
  • CDN: It is useful for static distribution and load reduction on Odoo.

Related services mentioned in the input document include providing 85+ global locations, cloud and VPS servers, anti-DDoS servers, Managed Database, CDN, and GitLab and CI/CD hosting capabilities for managing modules and addons.

Operational Solutions (Use Cases)

  • eCommerce Store: CDN for images and static, cache setup and worker augmentation.
  • POS and in-person sales: Local network with low ping or local servers to ensure performance during internet outages.
  • Production and warehouse: Integration with IoT and queue management for heavy reporting.
  • Analytics and ML: Odoo is suitable for light ML; for heavy models, use dedicated GPU servers.

Conclusion and next steps

This guide covered quick installation with Docker and manual installation for full control, security tips, performance optimization, backup and HA solutions. Choosing the right location, hardware and network configuration has a direct impact on Odoo's stability and performance.

If you need an environment with multiple locations, anti-DDoS protection, Managed DB, and technical support, the services discussed in the entry document are suitable and can help with a secure and scalable deployment.

Frequently Asked Questions

You May Also Like