===== Upgrade the system ===== This chapter contains a short description on how to upgrade the Track and Trace 2 system on any given server. ==== Prerequisites ==== This instruction requires a running version of Track and Trace 2.0 of the same major number as the version upgraded to. For ease of reading we will assume that Track and Trace 2.0 is installed in the path /opt/node/TrackAndTrace2, if it is installed in another location please change the steps below accordingly. ==== Setting up the new version ==== First create the new version path and download the new version of TnT2 to it: mkdir /opt/node/tnt2_[site]_[newversion] cd /opt/node/tnt2_[site]_[newversion] git clone -b [version] [git repo] Now we need to make sure the right config is being used for this site: cd /opt/node/tnt2_[site]_[newversion]/config ln -s tntconfig_[site].js tntconfig.js * Edit the file /opt/node/tnt2_[site]_[newversion]/client/index.html and make sure the right RESTURL is active. * Edit the file /opt/node/tnt2_[site]_[newversion]/apps/scanner/config/config.js and make sure the Config variable is set to the right preset, or contains the correct configuration for the current site. Install all the npm modules: cd /opt/node/tnt2_[site]_[newversion] npm install Move the scripts to this installation cp /opt/node/[site]/scripts/* /opt/node/tnt2_[site]_[newversion]/scripts ==== Switch the running version ==== Now it's time to switch the running version. Link the TrackAndTrace2 path to the new version: cd /opt/node rm TrackAndTrace2 ln -s tnt2_[site]_[newversion] TrackAndTrace2 After this simply restart all the running TnT2 services: pm2 restart all Or do it process by process, checking the logs making sure everything starts up properly. ==== Conclusion ==== Now it's a good idea to save the old version on the server until the functionallity of the new installation has been confirmed. All the logs from the previous version are present in the old path, and only the logs for the new version is available under /opt/node/TrackAndTrace2/logs, so it might be wise to keep them for future reference until the next upgrade.