Using the LabKey Server SiteDown webapp Brian Connolly  2010-01-05 17:09
 

Below you will find the instructions for installing the LabKey SiteDown webapp. This webapp allows the LabKey Administrator to show a pretty SiteDown page when the LabKey server needs to be taken offline.. This SiteDown webapp is designed to be used only during certain types of outages, such as when the database server is offline due to a hardware failure, or upgrade.

This SiteDown webApp is not meant to be used in the following cases

  • during LabKey Server upgrades (ie upgrade of the LabKey Server from v9.1 to v9.2)
  • during times when you want to perform maintenance on the LabKey Server by placing the server in Admin-Only mode.

How does the SiteDown webapp work?

The LabKey Server currently has a very simple SiteDown functionality. When enabled, by editing the <LABKEY_HOME>/labkeywebapp/WEB-INF/web.xml file, it will show a simple message to the screen. This message contains no formatting, logo images, etc. It is just black text on the white background. I have leveraged this functionality to redirect the browser to a new webapp that allows us to show a “prettier” SiteDown page.

When enabled, the SiteDown page will work in the following way

  1. When the user comes to any page within the LabKey webApp (ie http://<YourServerName>/labkey/Project/home/begin.view)
  2. The LabKey webApp will return a small blurb of javascript. The javascript tells the browser to load http://<YourServerName>/sitedown/index.html
    • The URL to load is configurable and can be changed.
  3. The browser then loads http://<YourServerName>/sitedown/index.html and shows the user the “prettier” SiteDown page
  4. This page contains a Meta Refresh directive which tells the browser to load http://<YourServerName>/labkey/Project/home/begin.view every 60 secs.
    • This insures that if a user leaves their browser open after they see the SiteDown page, they will eventually get redirected back the LabKey webApp when it is back online.


Preparations for Using the Site Down page

  1. Log in to the web server which is running your LabKey Server
  2. Copy/Download the attached file, labkey_sitedown.zip, to your server.
  3. Unzip the file into <LABKEY_HOME>/sitedown


Edit the Site Down page to show the desired message

  1. Using an editor open <LABKEY_HOME>/sitedown/sitedown/index.html
  2. Find the text “This is the message”
  3. Replace this with the content you would like to have displayed. Note: this is an HTML page, you can add in any supported HTML tags you would like.
  4. If your LabKey webapp is configured to use a different ContextPath than /labkey, you will need to edit the Meta Refresh tag. i.e. the tag that begins with

    <meta http-equiv="refresh" content="60;url=/labkey/index.html">
    


Enable the SiteDown webapp and test

  1. Using an editor open <LABKEY_HOME>/sitedown/sitedown.xml
  2. Change the docBase attribute from CHANGETHIS to <LABKEY_HOME>/sitedown/sitedown
    • where <LABKEY_HOME> is the directory where the LabKey software is installed
  3. Copy <LABKEY_HOME>/sitedown/sitedown.xml to <CATALINA_HOME>/conf/Catalina/localhost/sitedown.xml
    • [NOTE the tomcat server will automatically load the new SiteDown webapp. This will allow you verify the formatting of your SiteDown page]
  4. Goto http://<YourServerName>/labkey/sitedown/index.html and verify that the SiteDown message looks correct. If you need to fix any of the content or formatting, simply open <LABKEY_HOME>/sitedown/sitedown/index.html with an editor and make the changes. Once you save the file, refresh your browser to review your changes.


Redirect from the CPAS webapp to the SiteDown page

When it is time to show the “SiteDown” page, do the following

  1. Make a backup of the web.xml file by copying <LABKEY_HOME>/labkeywebapp/WEB-INF/web.xml to <LABKEY_HOME>/orig_web.xml
  2. Copy <LABKEY_HOME>/sitedown/sitedown_web.xml to <LABKEY_HOME>/labkeywebapp/WEB-INF/web.xml
  3. Restart the Tomcat Server
  4. Test by going to http://<YourServerName>/labkey/Project/home/begin.view


Bring the LabKey webapp backup online

  1. Copy <LABKEY_HOME>/orig_web.xml to <LABKEY_HOME>/labkeywebapp/WEB-INF/web.xml
  2. Disable the sitedown webapp by deleting <LABKEY_HOME>/sitedown/sitedown.xml
  3. Restart the Tomcat Server
  4. Test by going to http://<YourServerName>/labkey/Project/home/begin.view


Other Information

The SiteDown page in the attached zip archive is a sample. By editing the index.html file located in the sitedown directory, you should be able to customize the look and feel of the page to match your server.