Is there a way to trigger maintenance mode for All except the System Manager Role? Currently, the only way to trigger maintenance mode is during the update but there are use cases where changes that do not require bench update need to be carried out and I want all users to be locked out while these changes are being implemented and tested by the System Manager(s).
@flexy2ky I don’t think that it is possible because Frappe checks for
maintenance_mode at the beginning of the request. Until now I couldn’t find a way for you to do that.
Without updating, Maintenance Mode can be enabled/disabled at any time, with the following commands:
bench --site yoursitename set-maintenance-mode on bench --site yoursitename set-maintenance-mode off
But you’re correct, this is system-wide, and doesn’t make any exceptions for System Administrators.
What I’ve seen in other ERP systems is the concept of “draining” the login and authentication system:
- If you’re already logged in, you can keep working.
- No new logins are accepted (except for System Managers)
- System Managers can choose to terminate an existing connection, as-needed.
This design provided a lot of flexibility. You could quietly and safely shut down a system. If anyone was still logged in, you could contact them (text, voice, email, chat), and confirm if they were done working? If no, you’d let them finish. If yes, they could logout, or you could log them out yourself. Once logged out, no one could login (except for Admins).
This was a great way of entering a maintenance window, versus immediately shutting down the entire server and risk people losing their work.