How to roll back an Artifactory upgrade

Patrick Russell
2019-08-01 21:56

Subject 
Rolling back an Artifactory upgrade requires reinstalling the older version of Artifactory and loading a backup into it.

Description
If an Artifactory upgrade has failed in a production environment, and the JFrog Support Team is unable to assist with restoring the upgrade, a rollback may be necessary.

Artifactory makes permanent, non-reversable changes to its linked database. This means that the only way to get the original Artifactory configuration is to reload a backup.

Resolution

0. Before upgrading to the new version, perform a System Export of the Artifactory or take a database dump of the external database

1. Copy or otherwise back up the Artifactory data directory (By default found under /var/opt/jfrog/artifactory/data)

2. Back up the /etc/opt/jfrog/artifactory folder to a secure location:
zip -r ~/artifactory-etc.zip /etc/opt/jfrog/artifactory #zips the artifactory etc recursively

3. Shut down the Artifactory service:
systemctl stop artifactory

4. Search for the Artifactory installation and remove it:
[RPM install]
rpm -qa | grep artifactory
rpm -e <Artifactory-version>

5. Remove the Artifactory directories:
#NOTE: This only needs to be done if you have to reinstall Artifactory on the same machine! 
#Skip this step if you have a new host for the older Artifactory installation
rm -rf /var/opt/jfrog/artifactory
rm -rf /etc/opt/jfrog/artifactory

6. Download and install the old Artifactory version:
wget <Bintray_link>
rpm -i <ART>.rpm

7. Start the Artifactory service and check to see if it comes online:
Systemctl start artifactory
Tail -f /var/opt/jfrog/artifactory/logs/artifactory.log

#You should see the following ASCII text:
### Artifactory successfully started (<seconds> seconds)   ###

8. Add the Artifactory license back to Artifactory in the Web UI

9. Restore the following files from your backed up etc directory:
$ART_ETC/default
$ART_ETC/binarystore.xml

10. You will need a new empty database to restore to, configure the new $ART_HOME/etc/db.properties file to connect to it

11. Restore the Artifactory data to the same location as before

12. Restart Artifactory

13. Perform a system import from the old Artifactory backup (or reload the old database dump) to load the backed up data into the new database