A number of the larger labs and institutions which run a LabKey Server, utilize a staging or test server. Test servers are used for many different reasons, such as, ensuring that a upgrade of the LabKey Server does not break any customization or to test new modules, views or queries being developed by their developers.
We have found that when using a Staging or Test server, changing the color scheme(Web Theme), server name and other look and feel settings makes it much easier for users and/or administrators to know that they are working on the test server and not the Production server. This lowers the chances that a mistake will be made which might result in data loss on the Production server (i.e., the server that is used on a day to day basis for their research).
Changes to the Test server’s settings can easily be made through the LabKey Server’s Admin Console. In addition, they can be made programmatically via the LabKey Server’s database.
Below, is our recommended list of server settings that should be changed to when using test/staging server.
Of course there are a few caveats:
Summary. You can override the Server GUID stored in the database with the one specified in the LabKey XML configuration file (labkey.xml). This ensures that the exception reports received by LabKey developers are accurately attributed to the server (staging vs. production) that produced the errors, allowing swift delivery of fixes.
Background. By default, LabKey Servers periodically communicate back to LabKey developers whenever the server has experienced an exception. LabKey rolls up this data and groups it by GUID of each server. When using Test or Staging servers like you are now, the Test/Staging server will have the same GUID as the Production server (because you are restoring the Production servers database periodically to your Test/Staging servers). This can cause some confusion for LabKey developers when they are researching exception reports and trying to determine fixes for these problems. Changing the Server GUID for the staging server helps LabKey quickly track down exceptions and fix bugs detected on your staging server.
How-to. This change is made in the LabKey Server configuration file for your test server. This file is located in the configuration directory of your Tomcat installation.
%CATALINA_HOME%\conf\Catalina\localhost
$CATALINA_HOME/conf/Catalina/localhost
The configuration file will be named either labkey.xml
or ROOT.xml
To make the change
Find this line in the file
<Loader loaderClass="org.labkey.bootstrap.LabkeyServerBootstrapClassLoader"
useSystemClassLoaderAsParent="false" />
Add the following text below line found in step 2
<!-- Set new serverGUID --> <Parameter name="org.labkey.mothership.serverGUID" value="HOSTNAME"/>
HOSTNAME
with the name of your test server
Change the Site Settings manually
Change the Site Settings via SQL statements These commands can be run via psql or pg_admin
To change the Base Server URL run
UPDATE prop.Properties p SET Value = 'http://testserver.test.com'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'SiteConfig'
AND p.Name = 'baseServerURL';
-- Replace `http://testserver.test.com` with the URL or your test server
To change the Pipeline Tools directory run
UPDATE prop.Properties p SET Value = '/path/to/labkey/bin'
WHERE p.Name = 'pipelineToolsDirectory';
-- Replace the `/path/to/labkey/bin` with the new path to the Pipeline tools directory
To change the SSL Port number:
UPDATE prop.Properties p SET Value = '8443'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'SiteConfig'
AND p.Name = 'sslPort';
-- Replace the `8443` with the SSL port configured for your Test Server
To disable the SSL Required setting
UPDATE prop.Properties p SET Value = FALSE
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'SiteConfig'
AND p.Name = 'sslRequired';
Change the Look and Feel Manually
[TEST]
or something similar the text in this field[TEST]
to the existing name or changing the name entirely to indicate it is the Test serverNOTE: Following these instructions will change the Site Look and Feel settings. If you have customized the Look and Feel on an individual project(s), you will need to go to the Look and Feel settings for each Project and make a similar change,
Change the Site Settings via SQL statements These commands can be run via psql or pg_admin
To change the Header short name for the Site and for all Projects:
UPDATE prop.Properties p SET Value = 'LabKey Test Server'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'LookAndFeel'
AND p.Name = 'systemShortName';
-- Replace "LabKey Test Server" with the short name for your Test server.
To change the System description for the Site and for all Projects
UPDATE prop.Properties p SET Value = 'Test LabKey Server'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'LookAndFeel'
AND p.Name = 'systemDescription';
-- Replace "Test LabKey Server" with the system description for your Test server
To change the Web Theme for the Site and for all Projects:
UPDATE prop.Properties p SET Value = 'Harvest'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'LookAndFeel'
AND p.Name = 'themeName';
-- Replace "Harvest" with the name of the Web Theme you would like to use on your Test Server.
Below are some additional configuration settings that we have found useful in working with our larger customers. Below is only the SQL statements for making these changes, so of these changes can only be reasonably be done via these SQL statements.
Deactivate all non-Site Admin users
This is important to do as it will not allow one of your researchers to accidentally log into the Test Server.
update core.Principals SET Active = FALSE WHERE type = 'u' AND UserId NOT IN
(select p.UserId from core.Principals p inner join core.Members m
on (p.UserId = m.UserId and m.GroupId=-1));
Mark all non-complete Pipeline Jobs to COMPLETE
This will ensure that any Pipeline Jobs that were scheduled to be run at the time of the Production server backup do not now run on the Test server. If you are using MS2, MS1, GenMicroarray or Flow I highly recommend this.
UPDATE pipeline.statusfiles SET status = 'ERROR' WHERE status != 'COMPLETE' AND status != 'ERROR';
Change the Site Wide File Root
Only use this if the Site File Root is different on your Test server from your Production server
UPDATE prop.Properties p SET Value = '/labkey/labkey/files'
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'SiteConfig'
AND p.Name = 'webRoot';
Have the Test server startup in Admin Only mode
UPDATE prop.Properties p SET Value = TRUE
WHERE (SELECT s.Category FROM prop.PropertySets s WHERE s.Set = p.Set) = 'SiteConfig'
AND p.Name = 'adminOnlyMode';