Refresh test server with production data

This page explains how to sync the test server database with the latest production data copy. Having the data in sync might be needed for reasons like:

  • Debug or reproduce issue faced on production 
  • Testing upgrades to latest versions
  • Testing queries

Make sure to confirm from the users that no critical data is lost on the test server before doing the sync. E.g., some users might be testing out a new CP setup; they can keep a backup of it before sync.


Steps to sync the data from production DB:

  1. Bring down test server Tomcat
  2. Take a backup of the current test server database before sync
  3. Drop the test server database and create a new database with the same name so that configurations need not be changed
  4. Import the production data dump into this new database
  5. Bring up the Tomcat server
  6. Once the OpenSpecimen server is up, update settings like below to reflect it is a test server
    1. Deployment Environment
    2. Application URL
    3. Data Directory: If the path is different compared to production
    4. Optional: To disable notifications or remove email settings
    5. Optional: Other user authentication settings like 'Inactive Account' can be set to 0 if you do not want users to be locked on the test server
    6. Other settings that point to production DB path like System Workflow JSON.

Steps to sync the data directory from the production:

Files uploaded in OpenSpecimen like consents, SPR, BO reports are stored in the data directory. If you want this also to be synched, follow below steps:

  1. Compress the current folders within the data directory of the test server and keep it as a backup in another folder
  2. Copy the folders within the data directory from production to test. 

This is optional. If this is not done, the file downloads for SPR, BO, etc. will not work.

If the data directory sync is not done, you have to delete all jobs sub-directories under bulk-import/ directory. This is to ensure that bulk import works fine, and the report downloaded does not refer to obsolete files.