Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from superuser.com Dec 20 '12 at 19:33

This question came from our site for computer enthusiasts and power users.

    
SF users: Please let me know if this migration was inappropriate (and why). Thanks. –  Daniel Beck Dec 20 '12 at 19:34

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.