2

From time to time, an OpenERP production server needs some maintenance: upgrading a few modules, probably having a server restart.

My issue is, I would like to have a way to stop regular users to access the server. For example, by returning to them a "under maintenance" message.

What would be the best solution for this?

DReispt
  • 133
  • 5

2 Answers2

2

If the server is rebooting, usually you'll need some kind of failover IP or at least a caching proxy in front of the application server (in this case, OpenERP) to tell the user that it's down. Otherwise, while the server is offline, you'll just get a generic browser error message returned to the client, like "server not found" or similar.

In short, the best way to do this is to have another physical/virtual server sitting in front of the application server that is "always" up (or a cluster of servers that are rebooted independently), so that you always have something resolving the domain name or can fail over to a backup if the primary is down due to crashes or reboots.

allquixotic
  • 487
  • 1
  • 10
  • 24
  • 1
    The server is up during the module's upgrade, and during that operation it can be problematic to have users on the system. Having nginx upfront redirecting other IPs to a maintenance page is an idea. – DReispt Dec 20 '12 at 17:03
  • 1
    assuming openerp is a web app (i know nothing about it) -- make an index.html; python -m SimpleHTTPServer; enable xinetd port 80 redirect to 8000. done. – Sirex Dec 20 '12 at 20:08
  • This is how I've seen it commonly done for websites/webapps. Take the real servers out of the LB pool and put the "sorry server" into it. Everyone gets the "sorry, we're working" page until you put the real servers back in. – mfinni Dec 20 '12 at 20:51
1

This is not the best way to do it, but it's a useful hack:

Edit the server's openerp\addons\base\res\res_users.py file. At the beginning of the def check(self, db, uid, passwd): method add:

    if uid != openerp.SUPERUSER_ID:
        raise osv.except_osv(_('UNDER MAINTENANCE'), _('This service is temporarily down for maintenance.'))

On the next restart, server will stop accepting users other than admin.

DReispt
  • 133
  • 5