Odoo configuration while going live
by Stanislav on Tuesday May 03, 2022
Setting up Odoo instance on your dev-machine can be really straight forward, but when it comes to real live system, the server will require more specific things to be configured. In current post we’ll see what are those things and how to manage them.
First of all when we switch to production server in most cases it’s built on multicore/thread architecture, so it’s better to use all power of parallel execution. In Odoo config there’s a parameter workers which stands for a parallel execution and is calculated by: workers = (CPU cores * 2 + 1). Assuming we have 4 CPU cores, the workers amount will be 9. So in odoo.conf we specify:
workers = 9 max_cron_threads = 4
When switched to multicore production architecture, there’s a long polling service starting on a separate port 8072 (in contrast to a dev machine run, where workers = 0 or 1). Long polling service is a chatter implementation that ensures message delivery to Odoo users, useful thing for sure. For reason the most live servers employ proxy servers to pass requests from the outside to the core app, we need to configure these redirections to both the core app and longpolling service within the proxy config (Apache example):
ProxyPass /longpolling/poll http://127.0.0.1:8072/longpolling/poll/ ProxyPass /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/ ProxyPassReverse /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/ ProxyPass / http://127.0.0.1:8069/ ProxyPassReverse / http://127.0.0.1:8069/
From that Apache config, we see the external port 80 is mapped to the local one 8069 (Odoo instance) and 8072 (chatter long polling instance) depending on the request postfix.
One more thing to be considered is that the chatter service is being automatically started on Linux system, though on Windows need to trigger this either manually or by defining a Windows service. For Windows case there’s a CMD command to be run to start longpolling service:
python odoo-bin gevent
That’s it, these 3 steps are the most common means that take place when switching to Odoo live. As a further possible step SSL enabling can be considered, this can be done through the same proxy server mentioned in this article.