My Setup
- Separately hosted NFS server, MariaDB and Redis in private network under firewall that allows access to only IPs of k8s nodes.
- That also means SSH access into above server is only allowed from cluster IPs.
- All application load is on cluster: erpnext nginx, erpnext python gunicorn, workers, scheduler and frappe socketio
Automatic upgrade
Following may work.
helm upgrade erpnext-stable \
--namespace erpnext frappe/erpnext \
-f erpnext-stable-values.yaml \
--set migrateJob.enable=true
Replace namespace, values.yaml file and release name
The above step takes site database backups.
The manual steps are not taking any backup and depend on the backups taken in above command.
Out of my 10 sites only 3 migrations failed. So the command may just work for someone else.
Manual steps to fix failed migration
- Installed fresh new v13 helm release, I moved from the deprecated nfs-client provisioner helm chart to nfs-subdir-external-provisioner and used the new
StorageClass
in this release. Skip to Step 4 if new release is not going to be installed. - Logged into NFS server so I could have faster access to files.
- move the individual site directory from old volume location to new location
- exec into new erpnext-python container with bash shell
- Once inside container run
bench --site site.name.com migrate
(FROMsites
DIRECTORY ITSELF)- If migration is successful update the service of existing ingress to new service. (not required if new helm release is not created)
- If migration fails from the container run
bench --site site.name.com console
, once things are fixed repeatbench --site site.name.com migrate
and hope for success.
- Once all sites are moved and migrated delete old helm release. OR set
pause_scheduler
andmaintenance_mode
to0
from common config if new helm release in not installed.
Patches that failed and fixes:
Issue with Customer
migration:
There was an issue while migrating the DocType: Customer
console:
l = frappe.get_all("Customer", fields=["name","represents_company"])
for i in l:
if i.get("represents_company") == '':
e = frappe.get_doc("Customer", i.get("name"))
e.represents_company = None
e.save()
frappe.db.commit()
Problem with Therapy Session
DocType from healthcare, during patch execution:
Executing erpnext.patches.v13_0.setup_patient_history_settings_for_standard_doctypes in abc.xyz.com (db_name)
console:
frappe.reload_doc("healthcare", "doctype", "Inpatient Medication Order")
frappe.reload_doc("healthcare", "doctype", "Therapy Session")
frappe.db.commit() # superstition
Paid ERPNext + Kubernetes hacking? castlecraft.in!