Restoring backup on VPS System

Hi there,
I am trying to restore a backup to a VPS System from my local macine. I have some changes to the erpnext and also added some custom doctypes to it. I am trying to restore on the VPS System and also did restore but when am running the application it does not reflect any changes.
i.e. it reflects just a fresh install on the system.
Do i have to perform all of the changes again in VPS Sytem as well?
And also having some errors while executing bench migrate after restoring the backup database sql file.
How can i make the System to reflect all the custom changes i have made on the Erpnenxt.
Throw some light to it.!

I have performed the following code after restoring the backup and facing the following error:

ujjawal@deverp:~/frappe-bench$ bench migrate
Migrating erpnext.dev
Executing frappe.patches.v7_0.create_private_file_folder in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing frappe.patches.v7_1.setup_integration_services #2016-09-16 in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing execute:frappe.db.set_default(‘language’, ‘’) in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing erpnext.patches.v7_0.update_party_status #2016-09-22 in erpnext.dev (68aa9e2822a6f0cb)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/ujjawal/frappe-bench/apps/erpnext/erpnext/patches/v7_0/update_party_status.py”, line 7, in execute
frappe.reload_doctype(party_type)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 627, in reload_doctype
reload_doc(scrub(db.get_value(“DocType”, doctype, “module”)), “doctype”, scrub(doctype), force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 639, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 136, in reload_doc
return import_files(module, dt, dn, force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 17, in import_files
return import_file(module, dt, dn, force=force, pre_process=pre_process)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 21, in import_file
path = get_file_path(module, dt, dn)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 28, in get_file_path
path = os.path.join(get_module_path(module),
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 128, in get_module_path
return frappe.get_module_path(module)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 664, in get_module_path
return get_pymodule_path(local.module_app[module] + “.” + module, *joins)
KeyError: u’selling’

Is your local machine and the vps on the same version of erpnext ? If not would recommend to upgrade both to the latest version and then do the restore.

Yes they are both on the same version.

@neilLasrado
Any update on the issue?

Hi Ujjwal,
Do a fresh installation and then restore the backup with the following commands:

Step 1: bench --site your_current_site_name --force restore {path to SQL file backup}
Step 2: bench migrate

and then let me know the result apart from that, if you think that your instance is like a fresh installation then try the above commands on it.

Regards
Ruchin Sharma

While doing restore i came across the following:

ujjawal@deverp:~/frappe-bench$ bench --site erpnext.dev --force restore /home/ujjawal/20160928_120002_43b66340_database.sql
MySQL root password:
*** Scheduler is disabled ***

while doing the bench migrate getting the following error:

ujjawal@deverp:~/frappe-bench$ bench migrate
Migrating erpnext.dev
Executing frappe.patches.v7_0.create_private_file_folder in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing frappe.patches.v7_1.setup_integration_services #2016-09-16 in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing execute:frappe.db.set_default(‘language’, ‘’) in erpnext.dev (68aa9e2822a6f0cb)
Success
Executing erpnext.patches.v7_0.update_party_status #2016-09-22 in erpnext.dev (68aa9e2822a6f0cb)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/ujjawal/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/ujjawal/frappe-bench/apps/erpnext/erpnext/patches/v7_0/update_party_status.py”, line 7, in execute
frappe.reload_doctype(party_type)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 627, in reload_doctype
reload_doc(scrub(db.get_value(“DocType”, doctype, “module”)), “doctype”, scrub(doctype), force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 639, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 136, in reload_doc
return import_files(module, dt, dn, force=force)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 17, in import_files
return import_file(module, dt, dn, force=force, pre_process=pre_process)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 21, in import_file
path = get_file_path(module, dt, dn)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 28, in get_file_path
path = os.path.join(get_module_path(module),
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 128, in get_module_path
return frappe.get_module_path(module)
File “/home/ujjawal/frappe-bench/apps/frappe/frappe/init.py”, line 664, in get_module_path
return get_pymodule_path(local.module_app[module] + “.” + module, *joins)
KeyError: u’selling’

Please help.

If after backup is successfull will I get all the files that i have custom created in the erpnext?

@Ujjawal
You will get everything except the files which are attached with the documents.

Regards
Ruchin Sharma

Alright!
Please look into the matter and let me know what error i am getting.

@Ujjawal
Frankly speaking I do not have much idea about this error, even I also wanted to know the reason behind this error.

Regards
Rcuhin Sharma

Oh okay.
Anyways thanks for looking into the matter though.!
Thanks.

Hello,

i am trying to restore backup on new server and geting error

bench --site gramat --force restore /home/frappe/frappe-bench/sites/20170906_181411_df63b1c5_database.sql
gramat does not exist

I install fresh instalation of erpnext

Ii found solution. @netchampfaris describe it in the best way

bench --site yoursitename backup
Then create a new site and install erpnext:

bench new-site newsitename
bench --site newsitename install-app erpnext
Then restore the backup file(can be found in your oldsite folder):

bench --site newsitename restore path/to/backup/file

bench --site sitename --force restore /home/frappe/frappe-bench/sites/20170906_181411_df63b1c5_database.sql

then bench migrate

then bench update --upgrade

At the end clear browser cache.