How to migrate Xray configurations to another server

Daniel Poterman
2023-01-22 11:08

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 includesexportingthe current Xray server configurations andimportingthem to thenew server.

At the source instance (current Xray server):

  1. Run theExport Xray SettingsREST 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.xand make sure to connect it to your Artifactory server.
  2. Start Xray
  3. Run theImport Xray ConfigurationsREST API call. This call will import the former server’s configurations to the new one.

The Export Xray Settings REST API callconsumes a .json filewhich contains the information you wish to export andcreates a .zip filein$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" :"" #this value is configured from the UI in theAdministration tab >> General >> Settings >> Server Name
}
The Import Xray Configurations REST API callalso consumes a .json filewhich contains the instance_id and the path the the exported settings .zip file as shown below:
Import.json:{
"instance_id" : "",
"src_path" : "$JFROG_HOME/xray/var/work/server/backup/config/_xray_exported_config_.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_xray_exported_config_.zipfile generated by the Export REST API call should beowned by the user and group xray.
  • The migration processdoes not include the DB sync, meaning, you will have tore-run the DB syncin the new server.
  • After the migration is completed,Xray will still need to reindex and analyze the available resourcesfor the Xray data to be displayed.