This option will take you through installing additional Xray version 2.x instances for each Artifactory instance that you have, and restore all MongoDB and PostgreSQL data. Then, you can continue to upgrade each Artifactory and Xray pairs to version 7.x and version 3.x.
This procedure is more complex and is only suggested if you must keep all your Xray configurations and easily reconfigure them in the new instances.
Many to One Pairing | One to One Pairing | ||
---|---|---|---|
Stop Xray services
Backup Xray data folder
Install new Xray and update configuration files
Restore MongoDB and PostgreSQL
Start the New Xray instance
Additional Xray instances
Remove unnecessary Artifactory Xray Pairing
Step 1: Stop Xray Services
The following set of steps will disable your Xray instance from all except one Artifactory instance, handle pending tasks in Xray's queues, and stop the Xray service.
Configure one of your Artifactory instances as your authentication provider, if you do not have one already configured.
In the Xray UI, go to Admin | Authentication, and select your Artifactory instance.
Disable Xray integration from your Artifactory instances. If you have an Artifactory instance that is configured as your authentication provider, keep this instance enabled with Xray.
In the Artifactory UI, go to Admin | JFrog Xray, and disable the Xray integration.
Stop Xray.
Note: Do not stop the PostgreSQL and MongoDB.
Step 2: Backup Xray data folder
Compress and copy a backup file of your Xray data.
cd <XRAY_HOME> tar -zcvf xray.backup.tar.gz xray
Create MongoDB dumps.
Create a dump file
mongodump -d xray -u xray -p password -o mongodump
Compress the dump file
tar -czvf mongodump.tar.gz mongodump
Create PostgreSQL dumps.
Create a dump file
pg_dump -U xray xraydb > /postgresdump
Compress the dump file
tar -czvf postgresdump.tar.gz postgresdump
Step 3: Install new Xray and update configuration files
Install a new instance of Xray on a separate machine.
Unzip and Restore Xray backup data.
Change the new
$XRAY_HOME
folder name toxray_tmp
(this will be deleted once the configuration update is complete).Note: This folder includes the following folders:
backup
,config
,data
,db_migraitons
mv xray xray_tmp
Copy the Xray data backup file, from the previous installation,
xray.backup.tar.gz
into the new$XRAY_HOME
folder.Extract the Xray data backup file.
tar -xvf xray.backup.tar.gz
Verify that a new Xray folder is created, and its structure is the same as the
xray_tmp
structure.Remove the xray_tmp folder.
rm xray_tmp
Modify the Xray configuration file
/var/opt/jfrog/xray/config/xray_config.yaml
with thepostgres
,mongodb
, rabbitmq parameters.--- ver: 1.0 XrayServerPort: 8000 mqBaseUrl: amqp://guest:guest@rabbitmq:5672 mongoUrl: mongodb://xray:password@mongodb:27017/?authSource=xray&authMechanism=SCRAM-SHA-1 postgresqlUrl: postgres://xray:xray@postgres:5432/xraydb?sslmode=disable
Step 4: Restore MongoDB and PostgreSQL
MongoDB
Copy the MongoDB backup zip file
mongodump.tar.gz
to the new machine.Extract the MongoDB backup file.
tar -xvf mongodump.tar.gz
Restore MongoDB.
Go to the extracted folder, cd to every subdir until reaching the Xray directory and run the following command.
mongorestore /mongodump/xray -u xray -p password --authenticationDatabase xray --db xray --drop --batchSize=1
PostgreSQL
Copy the PostgreSQL backup zip file
postgresdump.tar.gz
to the new machine.Extract the PostgreSQL backup file.
tar -xvf postgresdump.tar.gz
Restore PostgreSQL.
psql -U xray -f postgresdump xraydb
Step 5: Start the New Xray instance
Remove the authentication provider configuration from the new Xray instance.
Run the following query in your MongoDB.
Note: a new authentication provider will be connected later on.
db.getCollection('configuration').deleteOne({"config_id" : "accessConfig"})
Modify the binary manager collection configuration in MongoDB for the new Xray instance. This step should also be done once for the initial Xray instance.
Run the following query in your MongoDB, to get a list of your Artifactory instances.
db.getCollection('binary_managers').find({})
Run the following query in your MongoDB, for each of the redundant Artifactory instances, except the selected one you are connecting to this new Xray instance.
Note: this command requires a non-existant URL to manipulate the new Xray data. These Artifactory connections will be removed once the unnecessary pairings are removed, later on in this procedure.
db.getCollection('binary_managers').update({"bin_mgr_id" : {"<Redundent-Artifactory-id-to-delete>"}}, {$set : {"bin_mgr_url" : "<non-existing-url-which-not-in-use>"}})
Start the new Xray instance.
Change the Xray base URL.
In the Xray UI, go to Admin | General, and disable the Xray Base URL.
Validate the Xray URL in Artifactory.
In the selected Artifactory UI, go to Admin | Advanced | Config Descriptor, and check the
xrayConfig
.Enable Xray in Artifactory.
In the selected Artifactory UI, go to Admin | JFrog Xray, and set Xray to be Enabled.
Connect Xray to your selected authentication provider.
In the Xray UI, go to Admin | Authentication, and select your Artifactory instance.
Step 6: Additional Xray instances
Repeat steps 3 to 5 for additional Xray instances.
Once you have completed the process of pairing all new Xray instances to their Artifactory instances, go to each Xray instance (Admin | Artifactory) and check that only one Artifactory instance is connected to it.
Continue to upgrade your Artifactory and Xray instances to the new JFrog Platform.
Step 7: Remove unnecessary Artifactory Xray Pairing
Repeat the following steps for each of your Xray instances.
Validate that the new Xray instance is connected to the selected Artifactory instance, as an authentication provider.
Note
Before continuing to the next step, make sure your Artifactory and Xray are working. You can try to re-index a repository from Artifactory and check to see it was indexed in Xray.
Remove all Artifactory instances connected to Xray, except the one you would like to keep connected to this Xray instance.
In the Xray UI, go to Admin | A rtifactory, and delete the Artifactory instance(s) to remove.
Note: This operation will remove all data for the removed Artifactory instances.
Re-index all required repositories.
In the Xray UI, go to Admin | Artifactory, click on the authentication provider Artifactory instance and select I
ndex Existing
on the repositories to index.