Mastering the Odoo 17 Configuration File (odoo.conf)
The heartbeat of any production Odoo instance is its configuration file. While Odoo can run with command-line arguments, a dedicated configuration file (commonly named odoo.conf or odoo-server.conf) allows for consistent, secure, and fine-tuned deployments.
In Odoo 17, proper configuration is essential for enabling multiprocessing, securing database management, and optimizing performance. This guide covers the essential parameters you need to know.1. File Location and Structure
By default, the configuration file is often located in /etc/odoo/odoo.conf (on Linux installations) or in the root directory of your installation folder on Windows.
The file follows a standard INI format. Lines starting with ; are comments.
[options]
; This is a comment
admin_passwd = my_strong_password
db_host = False
db_port = False
2. Essential General Settings
These parameters control the basic connectivity and security of your instance.
Master Password
- admin_passwd: This is the "super-admin" password used to create, delete, copy, or restore databases via the Database Manager (/web/database/manager).
Security Tip: ALWAYS change this from the default 'admin'. If left weak, attackers can delete your production database.
Addons Path
- addons_path: A comma-separated list of directories where Odoo looks for modules.
- Example: /usr/lib/python3/dist-packages/odoo/addons,/mnt/extra-addons
Proxy Mode
- proxy_mode = True: Essential when running Odoo behind a reverse proxy like Nginx or Apache (which is standard for SSL/HTTPS). It ensures Odoo correctly interprets the user's IP address and protocol.
3. Database Connection
If your PostgreSQL database is on the same server, the defaults often work. However, for external databases, you must configure these explicitly.
- db_host: The IP address or hostname of the PostgreSQL server (use False to use Unix sockets).
- db_port: The port number (Default: 5432).
- db_user: The PostgreSQL role Odoo will use.
- db_password: The password for the PostgreSQL role.
- dbfilter: A Regular Expression to filter which databases are visible. This is crucial for multi-tenant environments or to ensure a specific URL only loads a specific database.
- Example: ^my_company_db$
4. Performance Tuning (Multiprocessing)
Odoo 17 runs in threaded mode by default. For production environments with multiple concurrent users, you should switch to multiprocessing by setting the workers parameter.
Worker Calculation Strategy
A common rule of thumb for calculating workers is: (CPU Cores * 2) + 1.
- workers: The number of worker processes.
- 0: Multithreading (development/low resource).
- >0: Multiprocessing (production).
- limit_memory_hard: Maximum memory per worker. If exceeded, the worker is terminated. (Default approx. 2.5GB).
- limit_memory_soft: Soft limit. If exceeded, the worker is recycled after the current request. (Default approx. 2GB).
- limit_time_cpu: Max CPU time allowed per request (prevents infinite loops).
- limit_time_real: Max real-time allowed per request.
Note: When workers > 0, you must use a reverse proxy (Nginx/Apache) to handle the Longpolling/Gevent port (default 8072) for the chat/IoT features to work correctly.
5. Logging
Debugging issues in Odoo 17 requires clear logs.
- logfile: Path to the log file (e.g., /var/log/odoo/odoo.log). If unspecified, logs go to stdout.
- log_level: Controls verbosity.
- info (Default): Standard operational logs.
- debug_rpc: precise logging of server requests (very verbose).
- warn: Only warnings and errors.
- logrotate: If set to True, creates daily log rotations (saves 30 backups).
6. Complete Example (Production Ready)
Here is a template you can copy and adapt for a standard Linux production environment.
[options]
; --- Security ---
admin_passwd = $pbkdf2-sha512$..hashed_password...
; --- Database ---
db_host = False
db_port = False
db_user = odoo
db_password = False
dbfilter = ^PROD_DB$
; --- Paths ---
addons_path = /usr/lib/python3/dist-packages/odoo/addons,/opt/odoo/custom_addons
data_dir = /var/lib/odoo
; --- Network ---
http_port = 8069
longpolling_port = 8072
proxy_mode = True
; --- Performance (Based on 4 Core Server) ---
workers = 9
limit_memory_soft = 2147483648
limit_memory_hard = 2684354560
limit_time_cpu = 60
limit_time_real = 120
max_cron_threads = 2
; --- Logging ---
logfile = /var/log/odoo/odoo.log
log_level = info
