This question has been flagged
2 Replies
20446 Views

I would like to know if there would be any problem setting up OpenERP in a cloud environment (AWS for example).

I'm thinking about this setup:

  1. One instance for the PostgreSQL DB
  2. Two or more instances behind a Load Balancer, both using the same DataBase.

Does OpenERP store/persist data (images?) on the disk that would not be shared between both instances?

Avatar
Discard
Best Answer

I'm right now in the process of setup a high availability enviroment with 2 distributed OpenERP servers and there are some points that you need to consider that are not exposed in the link before and I couldn't find any reference.

When you do a load balance for any service you need to take care of sessions handling in the number of servers that you may have, in the case of OpenERP the session management is done by werkzeug at the low level and OpenERP use the werkzeug.contrib.sessions.FilesystemSessionStore wich write sessions to disk. If all of your OpenERP servers are on the same server machine and they are started with the same user you should not have any trouble but if the OpenERP servers are distributed perhaps you will end having different sessions for the same user in all the OpenERP servers, for example you ask to the loadbalancer for http://yours.server.com/ and that generate request for load js, css, and many more stuffs like dblist, etc. if you have 2 servers you may be creating session in both of them, so when you login in the UI, you are login in one of the servers and in that server the session store the information related to who you are, but again others request will be send to the rest of the servers and in those your session are not authenticated so you will be seen errors like "your session has expired" because you are trying to access a resource that need to have been authenticated agains a db and in that server your session doesn't. to resolve this I create a session store that use Redis as a backend and is configured to be used in all my OpenERP servers to query Redis for session information, that way all the request agains all the servers can access to the same session information.

Avatar
Discard

How you stored session on redis cache?

I create a new werkzeug SessionStore based on Redis and use it in OpenERP(version 7) web/http.py. The same apply to Odoo v8 and v9. You can look at my RedisSessionStore at https://gist.github.com/aek/efb0f9dd8935471f9070 The redis config values used to connect to the redis instance are retrieved from OpenERP config. Due to all the servers in my environment are using workers I cannot monkey patch the Root class in web/http.py so im running a modified version of http.py to ensure that all the workers are using the RedisSessionStore class My new Root class only diff from the original in the init part when initializing the session_store like: if tools.config.get('redis_store', False): self.session_store = RedisSessionStore() path = 'Redis' else: path = session_path() self.session_store = werkzeug.contrib.sessions.FilesystemSessionStore(path) My config file for Redis look like this: [options] ... redis_store = True redis_host = localhost redis_port = 6379 redis_dbindex = 1 redis_pass = admin ...

@Axel,

Thanks for your work on this. I've been searching for ages for a Redis Cache option for Odoo. Do you have any suggestions on how to get it working with Odoo 8, or would I be able to pay for your time to train me how to use it?

I'm interested in using it as a session store as well as for storing cached objects like product images in redis.

Best Answer

This setup is possible.
You should have a look at this documentation "High availability OpenERP":
http://www.scribd.com/doc/116781163/High-Availability-Opener-p

Avatar
Discard