How I upgraded from v13 to v14 and Ubuntu 20.04 LTS to 22.04 LTS

First, I made sure my last nightly backup of the VM was successful. Then I backed up the site with bench --site *sitename* backup --with-files and copied the backups off-host. Then I made another snapshot of the VM. Being OCD with backups is helpful with this kind of upgrade!

Next, I upgraded frappe-bench to the latest: pip3 install frappe-bench --upgrade

At this point, I followed this guide to upgrade to Python 3.10 and pip to the latest version.

Next, I ran bench restart and tested the site in the browser to make sure it was still working. Took another VM snapshot.

Next, I upgraded from Ubuntu 20.04 LTS to 22.04 LTS with sudo do-release-upgrade -d and after the reboot, browser-tested to make sure the site was still working. So far so good! Took another VM snapshot.

Next up is to upgrade node from v14 to v16 via nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
exit shell and login again
nvm install 16 --reinstall-packages-from=current

EDIT: Here, I found it necessary to upgrade frappe-bench again: pip3 install frappe-bench --upgrade

Then restart bench: bench restart and browser test again. Took another VM snapshot.

Switched to branch 14, but upgrade was not successful and ended with errors: bench switch-to-branch version-14 --upgrade

Installed app hrms:
bench get-app hrms
bench --site *sitename* install-app hrms

Tried again, but had more problems and errors. Installed payments app:
bench get-app payments
bench --site *sitename* install-app payments

Ran bench migrate and bench update --reset due to issues with untracked files in git.

Ran bench restart for good measure and tested the site- working!

EDIT: do not remove the payments app here at this point as I originally posted!

Browser tested again: Success! As always, YMMV. And my errors and workarounds with regard to installing the apps after the bench switch-to-branch command may have been avoidable by adding resolve-deps as noted in that post. Good luck and don’t forget to back up a lot!

9 Likes

Hi,
When I migrate ERP using ‘bench switch-to-branch version-14 --upgrade’ i have sql query error for table tabDocType State. When I checked sql schema I notice that table ‘tabDocType State’ is missing.

To fix this error you need to execute bench migrate, and after that one more time bench switch-to-branch version-14 --upgrade

1 Like

Yes, I’ve been doing some more experimenting with the upgrade. I think I found a better way to do this which results in fewer errors (replace ‘bench switch-to-branch version-14 --upgrade’ and the following commands with these) :

~/frappe-bench$ bench get-app --branch version-14 frappe
~/frappe-bench$ bench get-app payments
~/frappe-bench$ bench get-app --branch version-14 erpnext
~/frappe-bench$ bench get-app hrms
~/frappe-bench$ bench --site sitename install-app hrms
~/frappe-bench$ bench migrate