Odoo Multi domains to multi instances
5 March, 2021 by
Odoo Multi domains to multi instances
Administrator

1
down vote
accepted
yes i have realized this on my server. to achieve that goal I have tested two ways. It’s up to you wich one is better to feet on your needs 1 method is odoo+wsgi+appache2 2 method is odoo+nginx+SSL both cases required the proxy reverse. so lest go on. I assume that you know how to install odoo and postgress mandatory requirement:

you should have hardware that can handle odoo postgress and webserver for more than one instance. As of every instance of odoo creates it’s own processes. My server (6 core CPU, 3 gb Ram, and i have cpu load around 5% and RAM for 40%, i have 6 different instances rub=ning on this server with different domain names)
for each instance you should have different user created for odoo and for PostgreSQL
in case of using first method odoo+wsgi+appach you don’t ned to configure openerp-server.conf file and sturtuo script as of we gonna use openerp-wsgi.py file as a configuration and the appache to sturt odoo.

/YOUR_ODOO1_PATH/openerp-wsgi.py modification with your data:

conf[‘addons_path’] = ‘LINK TO YOUR ODOO1 ADDONS FULL PATH FROM THE ROOT’

admin_passwd = ‘ODOO1 MASTR ADMIN PASSWORD’

conf[‘db_user’] = ‘ODOO1_POSTGRESQL_USER_NAME’

conf[‘db_password’] = ‘ODOO1_POSTGRESQL_USER_PASSWORD’

bind = ‘0.0.0.0:8070’

pidfile = ‘.gunicorn.pid’

workers = 4

timeout = 240

max_requests = 2000

conf[‘logfile’] = ‘/var/log/ODOO1/wsgi-pyton.log’
THAT WILL RUN YOUR ODOO1 instance on port 8070

for each instance you should use DIFFERENT PORT

now it is time to configure appache server: I assume that you have installed apache server but in any case, to do that use

sudo apt-get install apache2
and for mod WSGI

sudo apt-get install libapache2-mod-wsgi
Enable required apache modules:

sudo a2enmod proxy_http headers rewrite wsgi

If the system miss some of them you should install this modules first then enable them. More you will find in the Apache website.

Create Configuration file in apache for reverse proxy for site odoo1.com:

sudo nano /etc/apache2/sites-available/odoo1.conf


ServerName odoo1.com
ErrorLog /var/log/odoo1/openerp-error.log
CustomLog /var/log/odoo1/openerp-access.log combined

Order deny,allow
Allow from all

ProxyRequests Off
ProxyPass / **odoo1_full_URL**
ProxyPassReverse / **odoo1_full_URL**
ProxyVia On
LogLevel warn

odoo1_full_URL replace with http : // odoo1.com: 8070 (for me it is not allowed to post more than 2 url, that way i have write in this way without spaces) 5. Create Site Configuration file to run WSGI script

sudo nano /etc/apache2/site-available/odoo1-wsgi.conf
With following content


ServerName odoo1.com
WSGIScriptAlias / /YOUR_ODOO1_PATH/openerp-wsgi.py
WSGIDaemonProcess oe user=ODOO1_USER group=ODOO1_USER processes=2 pythonpath=/YOUR_ODOO1_Path/ display-name=apache-ODOO1USER
WSGIProcessGroup oe
ErrorLog /var/log/ODOO1/odoo1-wsgi-error.log
CustomLog /var/log/ODOO1/odoo1-wsgi-access.log combined

Order allow,deny
Allow from all


finaly enable your odoo1 and odoo1-wsgi configuration sites and restart apache server

sudo a2ensite odoo1-wsgi.conf odoo1.conf sudo service apache2 restart

that’s all by typing in the url the odoo1.com you will be able to see your database without port number in the address bar.