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?
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.
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 thedef check(self, db, uid, passwd):
method add:On the next restart, server will stop accepting users other than
admin
.