How do I use openERP with multiple domains on single server?
I have over 40 domains and I would like to have a specific database associated with each domain. Do I have to have multiple installs? I know how to use a specific database. But I cannot seem to control. I have tried having apache2 listen to specific 8069 ports for the domains. But I always seem to have issues.
I use apache2 named services. I have in /etc/apache2/vhosts a file
name-vitrual-host.XXX.XXX.XXX.XX9.80.conf name-vitrual-host-XXX.XXX.XXX.XX2.80.conf name-vitrual-host-XXX.XXX.XXX.XX9.443.conf name-vitrual-host-XXX.XXX.XXX.XX2.443.conf
or name-vitrual-host-XXX.XXX.XXX.XX9.8069.conf.org name-vitrual-host-XXX.XXX.XXX.XX2.8069.conf.org
I have apache2 setup to only read and use a .conf So I am doing it with and without I have also tried using in my /srv/apache2/listen.conf a global *:8069
The above file has a different location for each openerp config in a domain. I have linked the source code from /usr/share/openerp to each domain.
cd /srv/www/vhosts/domain_name/ ln -s /usr/share/openerp openerp cd /srv/www/vhosts/domain_name/ ln -s /usr/share/openerp openerp ... cd /srv/www/vhosts/domain_name#/ ln -s /usr/share/openerp openerp
I have in each index.html or apporiate html file
Note each below have a http: in front //www.sample.com:8069/?db=openerp //www.sample1.com:8069/?db=openerp1 //www.sample2.com:8069/?db=openerp2 //www.sample3.com:8069/?db=openerp3
It is getting the openerp working. Seems openERP wants to bind to the IP:Port and not the domainname:Port
Been trying to get customized config files working. What I do for other programs is for example put the source in /usr/share/openerp with links in all the virtual hosts as shown above.
Each .conf file has the following in them [options] addons_path = /usr/share/openerp/addons or /srv/www/vhosts/domain_name/addons
then a specific db db_name=openerp db_name=openerp1 db_name=openerp2 db_name=openerp3
all have the same db_user = openerp
My problem is I get post already in use. I do the following:
/location_domain/openerp/openerp-server -c /location_domain/openerp.cfg &
Then on the next add using the -c with a different cfg and location I get the already in use. I have different names in the config file but they are using the same IP. Making use of the apache2 named configurations. So if the system uses the name it should work, but if using IP it will fail
Any known way to do this?
You can perfectly well serve all the databases with a single OpenERP server on your machine. Unfortunately you did not mention what error you were seeing and what you expected as a result - makes it a bit harder to help you ;-)
Anyway, here are some random ideas based on the information you provided:
- If you have a problem with OpenERP not listening on all interfaces, try to specify 0.0.0.0 as the xmlrpc_interface in the configuration file, this should have OpenERP listen on 8069 on all IPs.
- Note that Apache is not relevant if you're connecting to e.g.
http://www.sample.com:8069/?db=openerpbecause you're directly connecting to OpenERP. If you want to go through Apache, you need to setup ReverseProxy rules in your vhost configs, and OpenERP does not need to listen to all public IPs then.
- OpenERP 6.1 and later can autodetect the database name based on the virtual host name, and filter the name of the available databases: you need to start it with the
--db-filterparameter, which represents a pattern used to filter the list of available databases.
%hrepresents the domain name and
%dis the first domain component of that domain. So for example with
--db-filter=^%d$I will only see the
testdatabase if I end up on the server using
http://test.example.com:8069. If there's only one database match, the list is not displayed and the user will directly end up on the right database. This works even behind Apache reverse proxies if you make sure that OpenERP see the external hostname, i.e. by setting a
X-Forwarded-Hostheader in your Apache proxy config and enabling the
--proxymode of OpenERP.
Update: The port reuse problem comes because you are trying to start multiple OpenERP servers on the same interface/port combination. This is simply not possible unless you are careful to start just one server per IP with the IP set in the
xmlrpc_interface parameter, and I don't think you need that.
The named-based virtual hosts that Apache supports are all handled by a single master process that listens on port 80 on all the interfaces. If you want to do the same with OpenERP you only need to start one OpenERP server for all your domains, and make it listen on 0.0.0.0, port 8069, as I explained above.
On top of that it's not clear what you would have set differently in the various config files. Running 40 different OpenERP servers on the same machine with identical code sounds like a lot of overkill. OpenERP is designed to be multi-tenant so that many (read: hundreds) of databases can be served from the same server.