Skip to Content

6 - Configuring odoo.conf for Development vs. Production

Welcome back! By now, you know how to start your Odoo server and build a basic module. But there is a massive difference between running Odoo on your laptop and running it on a live server with hundreds of users.

The secret to a stable, fast, and secure Odoo instance lies in one single file: odoo.conf.

What works perfectly for your local development environment will absolutely crash a production server. Today, we are going to look at how to configure this file for both scenarios.

1. The Development Configuration (Your Local Sandbox)

When you are writing code on your laptop, your main goals are speed of development and easy debugging. You don't care about handling 500 simultaneous users; you just want to see your errors clearly and load your custom addons.

Here is a standard, clean odoo.conf file for your local Odoo 19 development environment:

[options]
; The master password to create/delete databases
admin_passwd = admin

; Database settings (False means it connects locally via your system user)
db_host = False
db_port = False
db_user = your_ubuntu_username
db_password = False

; Paths to the core Odoo code and your custom modules
addons_path = /home/user/odoo-dev/odoo/addons,/home/user/odoo-dev/custom_addons

; Web server port
http_port = 8069

; Logging set to debug so you can see exactly why your code is breaking
log_level = debug

Why this works for development: It relies on default PostgreSQL peer authentication (no complex passwords needed locally), prints everything clearly to your terminal screen, and keeps things lightweight.


2. The Production Configuration (The Heavy Lifter)

When you deploy Odoo 19 to a real server (like AWS, DigitalOcean, or Google Cloud), the rules change completely. You need to focus on performance, security, and stability.

In production, Odoo should never run as a single process. It needs to split its workload across multiple "workers."

Here is a professional, production-ready odoo.conf template:

[options]
; Security: NEVER leave this as 'admin' in production!
; Generate a secure hash from the Odoo UI and paste it here.
admin_passwd = $pbkdf2-sha512$25000$YourSecureHashHere...

; Database settings must be explicit in production
db_host = localhost
db_port = 5432
db_user = odoo_db_user
db_password = SuperSecurePassword123

; Paths
addons_path = /opt/odoo19/odoo/addons,/opt/odoo19/custom_addons

; Performance: Multiprocessing (The most important part!)
workers = 5
max_cron_threads = 1

; Resource Limits (Prevents Odoo from crashing your server if a query gets stuck)
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200

; Networking and Security
http_port = 8069
proxy_mode = True

; Logging: Send logs to a file, not the screen
logfile = /var/log/odoo/odoo-server.log
log_level = info


3. Understanding the Production Magic

Let's break down the most critical settings we added for production:

The workers Parameter

By default, Odoo runs on a single thread. If one user downloads a massive PDF report, everyone else on the website has to wait! By setting workers, Odoo spawns multiple background processes to handle requests simultaneously.

  • The Golden Rule for Workers: (Number of CPU Cores * 2) + 1.

  • Example: If your server has 2 CPU cores, you should set workers = 5.

Resource Limits (limit_memory & limit_time)

When you enable workers, you must tell Odoo how much RAM and CPU time each worker is allowed to use. If a user writes a bad Python script that causes an infinite loop, Odoo will automatically kill that specific worker once it hits the limit_time_cpu limit, saving your server from crashing.

The proxy_mode Parameter

In production, you never expose Odoo directly to the internet on port 8069. Instead, you put a web server like Nginx or Apache in front of it to handle SSL certificates (HTTPS). Setting proxy_mode = True tells Odoo, "Hey, I am sitting behind a secure proxy, so read the real user IP addresses properly."


4. Professional Best Practices & Advice

💡 PRO TIP: Protect your admin_passwd! In older versions of Odoo, people left their master password as plain text (e.g., admin_passwd = my_secret_password). This is a massive security risk! In Odoo 19, go to your database manager page, click "Set Master Password," and Odoo will generate an encrypted hash. Copy that hash and paste it into your odoo.conf file.

  • Log Files: Notice that we added logfile = /var/log/odoo/odoo-server.log. In production, you don't have a terminal window open 24/7. Odoo will silently write all errors and info to this file so you can review it later.

  • Cron Threads: max_cron_threads = 1 tells Odoo to dedicate one background worker entirely to automated tasks (like sending scheduled emails or creating recurring invoices).

Rating
0 0

There are no comments for now.

to be the first to leave a comment.