XRAY: Xray DB Sync won't start
Xray Database Sync is used to synchronize issues and vulnerabilities regularly and automatically, once a day. Initial Database Synchronization might take some time to complete but in some cases, the progress bar won't move and you will be faced with an error like below
And you might see something similar to the picture snippet below in your Xray logs
This is usually caused by an expired license or due to proxy settings blocking some URLs. We might need to refresh the license via cURL or perhaps there is an old trial license stuck in your Xray DB that we need to get rid of, or we might need to whitelist some URLs. Let's review the different methods we can take to resolve this issue.
Method 1: Whitelist URLs if using Proxy/FirewallIf you are using a firewall, to allow the database sync to complete successfully, you need to add the following URLs to your firewall's whitelist:
- https://releases.jfrog.io/
- https://releases-cdn.jfrog.io/
- https://jxray.jfrog.io/
To test the ability to sync, run the following REST API endpoint from the Xray host:
https://jxray.jfrog.io/api/v1/system/ping
Method 2: Remove cached license from Xray DBNavigate to your Xray instance and perform the following commands:
- sudo -u postgres psql -d xraydb
- select encode("config"::bytea, 'escape') from configuration where config_id = 'xrayConfig';
This will produce a JSON and in this output, if you locate a trial license inside the "license_config" tag, then we can run
- DELETE FROM configuration WHERE config_id='xrayConfig';
Restart Xray and try the DB Sync again.
Method 3: Refresh License In order to refresh our Xray License, we can run the below REST API curl command
curl -XPOST -v -uadmin http://<ARTIFACTORY>/xray/ui/binMgr/refreshLicense/<license-id>
And we should get a 200OK HTTP status code to confirm that the license has been refreshed.
Restart Xray and try the DB Sync again.