Alfresco Maintenance message
feb 06 2014
Categories : Tips and Tricks
Every once in a while you need to restart Alfresco. When you do, it would be nice if the user could be informed on why the system isn’t available.
For this purpose I have created a maintenance page to be used when you use Nginx as a front-end to Alfresco. It will detect when the backend (Alfresco tomcat instance) is not available (you get an 50x response) and instead display this page:
The progress bar is animated and updates to reflect how much percent of planned downtime that has been used.
It will also catch Ajax 50x errors on /share/proxy/alfresco and rewrite them as 401 (Unathorized), Share detects this and tries to reload the entire page, and therefore display the maintenance page. This is to catch that Alfresco Tomcat is down, for example when navigating folders in the document library.
When you need to shut down Alfresco, instead of shutting down directly (with sudo service alfresco stop), use a special shutdown script (found in /opt/alfresco/scripts):
ams.sh 20 "This is the custom message"
The number is the time in minutes you expect the shutdown to last. When the time has run out the page will try to reload the original Alfresco page. If still not available, the maintenance page will display additional info: Since we have run out of expected downtime, something was clearly harder to fix than we anticipated. But we are working hard to get the system up and running. In fact, we may already be done. Try hitting Load Alfresco Now button.
This is all available using my Alfresco Ubuntu install script.
For those of you who have already installed Alfresco with the script check this commit to see the changes you need to do. In short you need to update nginx.conf to catch 50x errors, and download ams.sh shell script, and the maintenance.html file and place it in /opt/alfresco/www (or any other location matching your config on nginx.conf).