The base line i've did this with is ERPNext 12 on Debian 9 with Python 3.5. We use nginx as a reverse proxy frontend with letsencrypt certificates.
We need to upgrade this to ERPNext 12 on Debian 10 with Python 3.7.
First make a snapshot if you are running it in a VM. This makes it much easier to rollback after it fails.
apt-get update apt-get upgrade apt-get dist-upgrade
Do not do an apt-get autoremove because this will remove python 3.5 and this will make the next step hell.
Wait a while for mysql to upgrade all tables
Everything should work now. Next step upgrade to python 3.7 to remove unsupported python 3.5 in Debian 10.
sudo -u frappe -s -H cd ~/frappe-bench bench migrate-env /usr/bin/python3.7 bench update
After this update gunicorn will not start. This is due to a newer version of werkzeug that is incompatible. We are going to force it to version 0.16.0.
./env/bin/pip install werkzeug==0.16.0 bench update
Now everything is installed and working correctly. Time to remove the old packages
And we are done. ERPNext 12 on Debian 10 with Python 3.7. Snapshots can now be removed ;)