This question has been flagged
9 Replies
36901 Views

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

with

name-vitrual-host-XXX.XXX.XXX.XX9.8069.conf
name-vitrual-host-XXX.XXX.XXX.XX2.8069.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?

Avatar
Discard
Best Answer

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=openerp because 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-filter parameter, which represents a pattern used to filter the list of available databases. %h represents the domain name and %d is the first domain component of that domain. So for example with --db-filter=^%d$ I will only see the test database 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-Host header in your Apache proxy config and enabling the --proxy mode 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.

Avatar
Discard
Author

My problem is I get post already in use. I do the following. /location_domain/openerp/openerp-server -c /location_domain/openerp.cfg &

Author

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 as i

Thanks for the extra info, I updated my answer

Important note on using --db-filter=^%d$ Database names ARE case sensitive while URL is NOT case sensitive, so if you have uppercases on database names the --db-filter=^%d$ will not work as URL converts everything to lower cases. Conclusion: use only lowercases in database names to use this.

Hi Oliver and All

I create 2 db : db1 and db2

I also have hostname setup on my dns server ; db1.erp.bno db2.erp.bno

and in my /etc/openerp/openerp-server.conf , I put :

  1. list_db = False To disable the DB choice list, and
  2. db_filter=^%d$ In hope that web UI will select the db in regards of hostname (first part of FQDN)

But both didn't work 1. when I try to open http://db2.erp.bno:8069 , web UI forwardme to http://db2.erp.bno:8069/?db=db1 2. the DB choice list still there.

My installation is in ubuntu using apt-get

Kindly please give me your enlighten

Sincerely -bino-

Same for me db_filter seems to be not working on OpenERP Version 7

db-filter is working if i use it as a startup command for the server BUT is not working if i use it in the server config file ?!?

Olivier, thanks for the explanation. I believe that the --proxy setting is in fact called --proxy-mode? I see a problem with the --db-filter setting: we have to make database names always be exactly the same like subdomains - this might be for whatever reason not always possible and it would be much better to have some way of mapping subdomains to arbitrary db names, this could be achieved e.g. with an Apache environment variable. Is there any possibility of creating such a mapping (without patching the OE7 code?). Also it would be great to have this kind of configuration available via web.

Yes, we could add a mod_rewrite rule to add / replace the query string on every request, but I do not know if this will work with every request that OE7 generates... so fixing this in config file would be the best way.

Another problem with this approach: if %h is the domain name, like e.g. http://example.com - this can not be a PostgreSQL database name, as the dot is an illegal character. So it is not possible to use a dbfilter like e.g. %h_%d because it would result in example.com_subdomain - you can not add such a database via the database creation dialog.

www postgresql org / docs / current / interactive / sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS (can not post links)

Best Answer

I have no idea yet how XML-RPC works, but it might be the answer you are looking for.

References:

https://accounts.openerp.com/forum/Help-1/question/336/ https://accounts.openerp.com/forum/Help-1/question/915/ https://accounts.openerp.com/forum/Help-1/question/429/ I would say doing multiple installs would be one hell of a installation+maintenance job.

Avatar
Discard
Best Answer

Configure

I have try this and its working well.

http://tinyurl.com/oe-multi-domain-easy-config

This one of easy to setup.

Avatar
Discard

This one sounds great. How did you apply this patch ? I don't get it...

Best Answer

I think you can do the trick by launching different servers using the -c option when launching them.

With that option you can specify which configuration your server will use, in particular, which port to 'hear'.

For example, I am not sure but I think the default values in server.conf will be:

netrpc_port = 8070
...
smtp_port = 25
...
xmlrpc_port = 8069
...
xmlrpcs_port = 8071

By changing those you could specify which ports you want to use in every server process.

Hope it helps you!

Avatar
Discard
Author

Thanks, I should have been more explicit about what I have tried. Each doman has a config file with its database. My Problem is because I am using named services. I had over 750 public IP's but when my local phone company added Fiber their old DSL stopped working reliably. So Now I have to pay.

Author

Problem is I now only have 5 public IP addresses. I am able to come in to any domain and not have a problem. Seem openERP does not like to share IP addresses and wants to bind to the IP rather than the name. Thanks

Best Answer

Have you tried by redirecting subdomains to this: http://server:8069/?db=database

Almost works. For some thing I don't understand it seems to not recognize the database when redirected, but if you refresh the page with that URL the it does works fine.

Try it and tell me how it goes.

Avatar
Discard
Author

That is what I am doing. http://www.sample.com:8069/?db=openerp and so one for each domain and its database. The apache part is working. But the openERP with each having their own conig is not.

Best Answer

hello can you please provide me all step of installing multiple instances of openerp

Avatar
Discard

Please read bugs . launchpad . net /openobject-server/+bug/1195341

Best Answer

Why don't use specific_url_db option. It must be easiest way to do this job.

specific_url_db=abc.com:sr4,cde.com:sr2

Use add this option in openerp-server config file

Avatar
Discard

I tried this in v8 with no result. specific_url_db=database1.mydomain.com.co:DatabaseName1,database2.mydomain.com.co:DatabaseName2

Author Best Answer

Sovled by using *:8069 in /etc/apache2/listen.conf Then adding to each domain where desire

www.sample.com:8069/?db=openerp having a unique db for each domain.

Having a goood generic config and uses and using it with the -c config.cfg file.

Avatar
Discard

This makes no sense, why force Apache to listen to port 8069? If you're making Apache proxy requests to OpenERP, why don't you do it on the normal port (80/443)? Then just direct your customers to their own URL. So far it looks like you're just testing random things without trying to understand :-/

Best Answer

Have you tried apache "VirtualHost" configuration ?

Avatar
Discard
Author

Yes, I have that part working for the domains . It is getting the openerp working. Been trying to get customized config files working. What I do for other programs is put the source in /usr/share/openerp with links in all the virtual hosts. name-vitrual-host-168.103.176.49.8069.conf domains