How to migrate Xray configurations to another server

How to migrate Xray configurations to another server

AuthorFullName__c
Daniel Poterman
articleNumber
000005034
ft:sourceType
Salesforce
FirstPublishedDate
2021-04-07T09:03:36Z
lastModifiedDate
2021-04-06
VersionNumber
7

Migrating Xray to another instance is a fairly simple procedure which requires knowing how to install Xray and how to run a REST API call. 
This procedure includes exporting the current Xray server configurations and importing them to the new server

At the source instance (current Xray server):

  1. Run the Export Xray Settings  REST API call. This call will export the Xray server’s configurations to a .zip file in $JFROG_HOME/xray/var/backup/config.
  2. Stop Xray
At Destination instance (new Xray server):
  1. Install the desired JFrog Xray version 3.x and make sure to connect it to your Artifactory server.
  2. Start Xray
  3. Run the Import Xray Configurations REST API call. This call will import the former server’s configurations to the new one.
The Export Xray Settings REST API call consumes a .json file that contains the information you wish to export and creates a .zip file in $JFROG_HOME/xray/var/backup/config. In the below example I chose to export all settings, however, in case you don’t want to export all of them, simply set the non-desired value to false:
Export.json:
{
    "policies" : true,
    "watches" : true,
    "ignore_rules" : true,
    "custom_licenses" : true,
    "custom_issues" : true,
    "webhooks" : true,
    "mail_server" : true,
    "proxy_config": true,
    "indexed_resources" : true,
    "instance_id" :"<your_Artifactory_instance_id>" #this value is configured from the UI in the Administration tab >> General >> Settings >> Server Name
}
The Import Xray Configurations REST API call also consumes a .json file which contains the instance_id and the path the exported settings .zip file as shown below:
Import.json:
{
    "instance_id" : "<your_Artifactory_instance_id>",
    "src_path" : "$JFROG_HOME/xray/var/work/server/backup/config/<SERVICE_ID>_xray_exported_config_<TIMESTAMP>.zip" #the path to the zip file that was generated from the export command. It should be located in $JFROG_HOME/xray/var/work/server/backup/config
}
Two important notes to keep in mind:
  • The <SERVICE_ID>_xray_exported_config_<TIMESTAMP>.zip file generated by the Export REST API call should be owned by the user and group xray.
  • The migration process does not include the DB sync, meaning, you will have to re-run the DB sync in the new server.
  • After the migration is completed, Xray will still need to reindex and analyze the available resources for the Xray data to be displayed.