Option 1: Pairing without configuration data (recommended)
This option will take you through disconnecting all Artifactory instances from your single Xray instance, except for one. Then, continuing to upgrade the disconnected Artifactory instances to version 7.x with newly installed Xray version 3.x instances.
This procedure will require re-indexing the additional Artifactory instances, and will cause some loss of Xray configuration data. You will need to:
Many to One Pairing | One to One Pairing |
---|---|
|
|
Procedure Steps
- Export user-defined configurations (Optional for Xray v 2.11 and up)
You canexport Xray user-defined configurationsto be imported to other Xray instances using a set of dedicated REST APIs. The following settings include policies, watches, Ignore Rules, custom licenses, custom issues, webhooks, mail server, proxy configurations, and indexed resource settings. - Disconnect Artifactory Xray pairings, except one
Remove all Artifactory instances connected to Xray, except the one you would like to keep connected to this Xray instance.If you have an Artifactory instance that is configured as your authentication provider, keep this instance enabled with Xray.
In the Xray UI, go toAdmin|Artifactory, anddelete the Artifactory instance(s) to remove.
Note: This operation will remove all data for the removed Artifactory instances. - Upgrade the remaining connected Xray Artifactory pairing
- Upgrade the connected Artifactory instance to version 7.x,using this guide.
- Upgrade the connected Xray instance to version 3.x,using this guide.
Note: Make sure to upgrade Artifactory before Xray.
- Upgrade disconnected Artifactory instances to 7.x,using this guide.
- Install a new Xray 3.x instance(s) for each Artifactory cluster,using this guide.
When installing the new Xray instances, make sure to provide the base URL and join key of the Artifactory instance you want to pair your Xray with. - Import user-defined configurations (Optionalfor Xray v 2.11 and up)
You canimport Xray user-defined configurations, if you chose to export them in the first step. - Index all required resources for each one of the new Artifactory Xray pairs
From the UI, in theAdministrationmodule, go toXray Security and Compliance| Generaland clickIndexed Resources
Option 2:Pairing with configuration data
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 |
---|---|
|
|
Procedure Steps
The following main steps are included:
- Stop Xray services
- 备份x光数据文件夹
- 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 toAdmin|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 toAdmin|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
tar -zcvf xray.backup.tar.gz xray Create MongoDB dumps.
Create a dump filemongodump -d xray -u xray -p password -o mongodump
Compress the dump filetar -czvf mongodump.tar.gz mongodump
Create PostgreSQL dumps.
Create a dump filepg_dump -U xray xraydb > /postgresdump
Compress the dump filetar -czvf postgresdump.tar.gz postgresdump
Step 3: Install new Xray and update configuration files
- Install a new instance of Xrayon 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
,rabbitmqparameters.--- 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" : {"
"}}, {$set : {"bin_mgr_url" : " "}})
Start the new Xray instance.
- Change the Xray base URL.
In the Xray UI, go toAdmin|General, and disable the Xray Base URL. - Validate the Xray URL in Artifactory.
In the selected Artifactory UI, go toAdmin|Advanced|Config Descriptor, and check thexrayConfig
. - Enable Xray in Artifactory.
In the selected Artifactory UI, go toAdmin|JFrog Xray, and set Xray to be Enabled. - Connect Xray to your selected authentication provider.
In the Xray UI, go toAdmin|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 yourArtifactoryandXrayinstances to the new JFrog Platform.
Step 7: Remove unnecessary Artifactory Xray Pairing
Repeat the below steps for each of your Xray instances.
验证新的x光实例连接to the selected Artifactory instance, as an authentication provider.
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 toAdmin|Artifactory, anddelete the Artifactory instance(s) to remove.
Note: This operation will remove all data for the removed Artifactory instances. - 对所有的回购要求进行检索sitories.
In the Xray UI, go toAdmin|Artifactory, click on the authentication provider Artifactory instance and select Index Existing
on the repositories to index.