Open kothagunda opened 6 years ago
What is this .sql backup Does it have just docTypes or also data. How to do replace the .sql with a backup. Need to stop some processes.
The .sql backup is a gzipped .sql file containing schema and data.
The command bench --site {sitename} backup --with-files
creates two gzipped files, one containing a full database backup and another containing attachments.
To restore a database:
$cat sites/kisanmitra.local/site_config.json
$mysql -u root -p {database_name_from_site_config} < ~/path/to/sql/file/backup.sql
$bench migrate
$bench restart #or bench stop; bench start
No need to stop any processes.
If I am on v10, can I take the .sql backup and put it on a v11 instance. (What if member fields differ)
Yes, but this may not be a smooth transition. Customisation is prone to breaking across major versions.
Process:
If i am moving my instance from AWS to DigitalOcean, will i get the data, custom field changes, website setting changes, custom scripts etc ?
Yes.
Currently on ERPNext-v10 + Customize docFields/Types + data, how to upgrade to ERPNext-v11 (Impact to custom fields and data. Commands ?) Currently on ERPNext-v10 + Customize docFields/Types + data, how to upgrade to KisanMitra-v1 (which has plain exotel integ) (Impact to custom fields and data. Commands?) Currently on KisanMitra -v1, how to upgrade to KisanMitra-v2 (which has new features) (Impact to custom fields and data. Commands ?) Currently on KisanMitra -v2, how to upgrade to ERPNext-v11(which has new features) (Impact to custom fields and data. Commands ?)
Place all your customisation in a separate app named "kisanmitra_erpnext"
ERPNext and kisanmitra_erpnext can then be updated independently of each other via bench update
Custom fields may get affected if the original field layout changes in the new version. To mitigate:
What if there is code conflict between these two branches. Same code might have been changed. Do we merge ErpNext-v11 into KisanMitra -v2 on github, and then install Since ERPNext and kisanmitra_erpnext will be two separate apps entirely, there will be no code conflicts.
What if I added field in a doctype and exact same name field added in ErpNext-v11 also
Add a prefix to Custom Field names, e.g. "kisanmitra_customer_name" or "km_customer_name "instead of "customer_name".
Patches from ERPNext
Both ERPNext and kisanmitra_erpnext will be patched independently after bench update.
What if I change a DocType name, for example Issue is renamed to Ticket. What if I upgrade from version 10 to Version 11. Will this get overridden ? Will I still get the Issue docType features that were built in version 11 into my Ticket docType.
Do not change names of existing Doctypes. Consider using Translation List.
All tenants have to be same version in a bench ? If I do bench upgrade from v10 o v11 do all the tenants get updated automatically.
Ideally all tenants ought to be on their latest stable version. "bench update --upgrade" will update all tenants in the bench
How do I just migrate the skeleton, with my customized docTypes, and custom scripts, without data to other tenants. Do I maintain a tenant with just custom docs and scripts and then use the .sql (witout data) and copy it over
kisanmitra_erpnext will contain custom doctypes, custom fields, property setters, which will appear in ERPNext after executing the following commands.
$bench get-app {https://github.com/{owner}/kisanmitra_erpnext}
$bench --site {sitename} install-app kisanmitra_erpnext
$bench migrate
Can we create another tenant with just a different subdomain, or does it have to be a separate URL. (first tenant kisanmitra.org/Vikarabad, second tenant kisanmitra.org/Adilabad. Or it has to be kisanmitrad-adilabad.org and kisanmitra-vikarabad.org)
Tenants can look like:
$ls sites
kisanmitra.org vikarabad.kisanmitra.org adilabad.kisanmitra.org
You can purchase a domain for kisanmitra.org and have vikarabad.kisanmitra.org and others as subdomains.
What is this DEV tenant , apart form the PROD one when we install (on same bench).
Two tenants kisanmitra.org.local and kisanmitra.org can be installed on the same bench. They will share the same version of ERPNext, Frappe and kisanmitra_erpnext.
Can they both see the same DB ? Can we have two tenants having same DB
No. Each tenant has and sees its own DB.
What is bench migrate command.
Bench migrate updates the tenant set in the frappe-bench/sites/currentsite.txt folder. Optionally:
bench --site {site_name} migrate
Can we test it on the DEV and then migrate the changes to the PROD -on digitalOcean not talking about local machine If I have 5 tenants with the same version on a bench. Can I test it on one tenant, and migrate the changes to all the tenants in one go
Ideally, you develop and test locally, push to github, then update the tenant on staging server, then on production server.
Can a have 2-3 tenants on a 1GB RAM assuming the 30GB space is good enough. The droplet on digital ocean we have is 1GB / 30GB.
Should be good enough. I will confirm this.
Can i install only certain modules on each tenant, to save space. So that i can fit in more tenants.
It is not possible to install specific modules. All modules get installed on installing ERPNext
Can something be dont such that one particular tenant can see data from all other tenants. This is to get reports from all the various tenants for data analytics.
I will get back to you on this.
Thanks a lot for the detailed responses @gaurav-naik . Really appreciate your time and patience.
Thanks for enlightening us on upgrades and deployment strategy. Some followup queries
If I install a app1, which has links to docTypes which are in app2. And if I don’t install app2, what happens. When do i know the issues, during installation, or at run-time.
If in my app1 I use Employee Loan. Now in erpnext latest version employee-loan renamed to loan. And I upgrade to latest erpnext. But since my app1 will be having link to old employee-loan, what happens.
If i dont have a seperate app, but i have done manual client customizations, and i use employee-loan as link in one of my docTypes. Now in erpnext latest version employee-loan renamed to loan. And I upgrade to latest erpnext. Will it break, or will it ask me to correct it at upgrade.
Is there a serial order in which erpnext and my kisanmitra_app has to be installed
Can you point us to the translation list manual or some doc. Couldnt find any, on how to use.
If we have more than 5 custom fields you suggested new docType. In that case if i have Issue and KisanMitra-Issue-Details as new docType. In this case i cannot directly use Report builder(works only on single docType) as fields are split across Issue and KisanMitra-Issue-Details. So only option is to use Query Rerport to join these tables and write queries right.
Assume kisanmitra_app is installed and deployed. Now i found some changes need to be made. What are steps to be followed. Will this be new version/patch/install and what is process to upgrade the hosted instance without causing any issues.: i. If a new docType has to be added. ii. If an existing docField is modified (lets say is made mandatory to non-mandatory) iii. If some master data such as new districts are added to the Disctrict DocType.
If i add some master data to be inserted during installation., lets say i add items rice and wheat. Now the instance is up and running. Now there are some changes in my app. So i do the changes and do a bench update (is this what i do) on the instance. Will it try to insert rice and wheat again and fail.
If possible, use custom doctypes where module can be among ERPNext's default modules and "Is Custom" set to true. These doctypes will simply become holders of information with minimal custom logic managed via custom scripts. This approach ensures safer upgrades. If custom logic is still deemed necessary, see if it can be generalised further and issued as a Pull Request to ERPNext. Major customization ought to be a last resort. In this case, add a doctype under KisanMitra ERPNext, where its py file can be edited. Custom doctypes with their own py files (custom logic) must be tested more extensively.
I will look up how "Is Custom" doctypes are migrated and update here.
Answers to the questions above:
- If I install a app1, which has links to docTypes which are in app2. And if I don’t install app2, what happens. When do i know the issues, during installation, or at run-time.
bench migrate
again. bench --site {sitename} console
[0] frappe.get_installed_apps()
- If in my app1 I use Employee Loan. Now in erpnext latest version employee-loan renamed to loan. And I upgrade to latest erpnext. But since my app1 will be having link to old employee-loan, what happens.
- If i dont have a seperate app, but i have done manual client customizations, and i use employee-loan as link in one of my docTypes. Now in erpnext latest version employee-loan renamed to loan. And I upgrade to latest erpnext. Will it break, or will it ask me to correct it at upgrade.
- Is there a serial order in which erpnext and my kisanmitra_app has to be installed
- Can you point us to the translation list manual or some doc. Couldnt find any, on how to use.
- If we have more than 5 custom fields you suggested new docType. In that case if i have Issue and KisanMitra-Issue-Details as new docType. In this case i cannot directly use Report builder(works only on single docType) as fields are split across Issue and KisanMitra-Issue-Details. So only option is to use Query Rerport to join these tables and write queries right.
- Assume kisanmitra_app is installed and deployed. Now i found some changes need to be made. What are steps to be followed. Will this be new version/patch/install and what is process to upgrade the hosted instance without causing any issues.: i. If a new docType has to be added.
bench update
on staging server, to see if changes are stable. Fix and repeat.bench update
on live serverii. If an existing docField is modified (lets say is made mandatory to non-mandatory)
bench export-fixtures
will create a property_setter.json under in the kisanmitra_erpnext app.iii. If some master data such as new districts are added to the Disctrict DocType.
- If i add some master data to be inserted during installation., lets say i add items rice and wheat. Now the instance is up and running. Now there are some changes in my app. So i do the changes and do a bench update (is this what i do) on the instance. Will it try to insert rice and wheat again and fail.
Thanks for you patience and detailed responses.
For master data insertion, Can we do something similar to HSN codes. https://github.com/frappe/erpnext/blob/e6d65bc2a1ee73a23299268ffc5de3c0f51bd1d7/erpnext/regional/india/setup.py#L56 https://github.com/frappe/erpnext/blob/e6d65bc2a1ee73a23299268ffc5de3c0f51bd1d7/erpnext/regional/india/setup.py#L15
Or can we add in hooks.py of kisanmitra app. Such that once issue table is created, we call a master data insert function . Since upgrades will not create issue table again, our data will not be inserted again and again.
ErpNext Installation and Upgrade Queries
Backup Queries
Version Upgrade Queries
Multi-Tenant Queries
Other