How To Replicate Your Production Environment to UAT

    Purpose

    The purpose of this document is to be a list of considerations for people trying to replicate their production environment into a UAT environment.  While hopefully comprehensive, I am hoping that others will share their experiences to help round out the document.

     

    Assumptions

    The steps listed below will try to be agnostic; however, there are some details that are technology specific, such as SQL syntax.

    Unless indicated otherwise, the below steps will be for SBS 4.x running on RHEL 5 Linux Application Servers and Oracle 11g SQL.

    Getting Started

    The following are a list of resources that you should preserve/copy before you begin the refresh process:

    • Application Server (Production)
      • ~/applications/sbs/home/crypto/*
      • ~/applications/sbs/home/node.id
      • ~/applications/sbs/home/themes/*
    • Database Tables (UAT)

      • jiveProperty
        • jiveInstanceId - keep track of this value for all tiers in your environment stack
        • mail.smtp.host
        • jive.dv.callback.host
        • email.creation.smtp.host
        • jiveURL
        • jive.master.encryption.key.node - should match the master server's file : ~/applications/sbs/home/node.id
        • Any other property that points to a Tier specific hostname/resource
      • It is recommended that you preserve these values in a script that can be automatically run after the refresh, such as the following (amend as needed):
    -- NAME: post_refresh.sql
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='jiveURL';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='log4j.threshold';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='jive.dv.callback.host';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='email.creation.smtp.host';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='globalRenderManager.EmoticonFilter.imageURL';
    /*** MAIL HOST IS IMPORTANT TO POTENTIALLY PREVENT SPAMMING OF USERS FROM THE UAT ENVIRONMENT ***/
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='mail.smtp.host';
    UPDATE jiveProperty SET PROPVALUE=PROPVALUE||'-UAT' WHERE NAME='system.adminuser.fromName';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='jiveInstanceId';
    UPDATE jiveProperty SET PROPVALUE='%YOUR_VALUE%' WHERE NAME='jive.master.encryption.key.node';
    
    /*** ASSUMES CLUSTERING ENABLED ***/
        /*** REMOVE THE PRODUCTION REFERENCES ***/
        DELETE FROM jiveProperty WHERE NAME LIKE 'jive.cluster.jgroup.servers.address.%';
        /*** ADD BACK IN YOUR TEST REFERENCES, MAY BE MORE THAN ONE ***/
        UPDATE jiveProperty SET PROPVALUE='%YOURVALUE%' WHERE NAME='jive.cluster.jgroup.servers.address.%YOUR_VALUE%';
        UPDATE jiveProperty SET PROPVALUE='%YOURVALUE%' WHERE NAME='jive.cluster.jgroup.servers.address.%YOUR_VALUE%';
    COMMIT;
    
    -- THIS IS A LARGE TX, SO BREAKING IT OFF...NEED TO MAKE SURE THAT THE DOCVERSE ASSETS ARE REFERENCED TO THIS INSTANCE
    UPDATE jiveDvRevArtifact
    SET instanceID = (SELECT PROPVALUE FROM jiveProperty WHERE NAME='jiveInstanceId')
    WHERE instanceID <> (SELECT PROPVALUE FROM jiveProperty WHERE NAME='jiveInstanceId');
    
    COMMIT;
    

     

    Performing the Migration

    The following are a high-level system series of steps to execute to perform the actual migration:

    • Bring down your UAT Application Server(s)
      • ~/bin/appstop sbs
    • Bring down the UAT JOOSD, JDCD, and Cache Services
      • ~/bin/joosd/joosd stop && ~/bin/jdcd/jdcd stop && ~/bin/cache/cache stop
    • Copy the Production Database down to your UAT Database
      • This part can be multiple ways depending on your DBA processes
        • This could be to copy the Oracle DB Files...and make the config changes to turn the DB into the UAT instance
    • Bring up the UAT Database
    • Run the post-refresh.sql Script (see Getting Started above)
    • UAT Application Server(s)
      • Encryption Key (you should only need to do this once, assuming node.id does not change)
          • Copy the ~/applications/sbs/home/crypto/default-creds-key File from your Production Server, and make sure that it is on all of your UAT Server(s) in the same location
          • Pick one of your UAT Application Server(s) as the Master Node, and do the following
          • On that server run the following command:      
            • cat ~/applications/sbs/home/node.id > ~/applications/sbs/home/crypto/default-creds-key-master-node
          • Now copy ~/applications/sbs/home/crypto/default-creds-key-master-node to the rest of your UAT Application Servers
            • Also, make sure that your jiveProperty["jive.master.encryption.key.node"] property value is in sync with the value in this file.
        • Clear the Local File-System Cache on all of your UAT Servers
          • rm -rf ~/applications/sbs/home/cache/*
        • Themes
          • Copy the ~/applications/sb/home/themes/* from your Production Server to your UAT Server(s)
      • Bring up the UAT JOOSD, JDCD, and Cache Services
        • ~/bin/joosd/joosd start && ~/bin/jdcd/jdcd start && ~/bin/cache/cache start
      • Bring up your UAT Application Server(s)
        • ~/bin/appstart sbs
      • Visit the Admin Console
        • System > Settings > Cluster - Confirm the Cluster consists of your UAT servers, if not, set appropriately
        • System > Settings > Cache - Confirm the Caches are pointed to the appropriate Cache Server
        • If all looks good, I like to have the system re-index all the content...this can help flush out configuration gotchas.  
          • System > Settings > Search > Index Tasks > Rebuild Content Index
          • System > Settings > Search > Index Tasks > Rebuild User Index
      • If any changes were made in the Admin Console, perform another restart
        • ~/bin/apprestart sbs

       

      Hopefully this will help some of you, and please share your feedback.