ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

How to restore from backup when you have custom apps


#1

Hi,

What’s the easiest way to restore from a backup when you have custom apps? Just to be clear, I’m referring to apps that were created from bench and not installed from an external repository

Thanks


#2

i faced the same issue and ended up by installing the same app with same name.

and bench migrate

if that app is not installed, server will not respond…


#3

Hi @adnan

Thanks a lot for your response. What about DocTypes and Custom Methods that were created within the app? Do I need to create all those again also??

Kind regards,


#4

No.

those things (DocTypes) are already in your backup. just need to create custom app and restore DB
Custom Methods if it’s in PY file, then yes you need to pull that repo with custom methods. if those were added in Custom Script, they’ll come along with DB Backup.


#5

Thanks a lot @adnan

Yes, the Custom Methods are in the PY file so I guess we’ll need to manually copy those over to the new server since the app doesn’t have an external repo to pull from

Kind regards,


#6

If you are looking for restoring database and you already have .sql backup files then
try this command inside frappe-bench:

mysql -u ‘your dbname’ -p’yourpassword’ “again your dbname” <path upto the file where your backup .sql file is stored.
before this command check your dbname and password in site_config.json file.


#7

Hi @PrashantPatil

Thanks a lot for your response. My main concern was actually about the custom apps. I will follow the guidance given by @adnan and hopefully won’t run into any issues along the way :slight_smile:

Cheers!


#8

Hi @wale,

The easiest way would be to push your app to a repository (Github, Bitbucket, Gitlab,…) and to pull it on your new server.
This way you can be certain that both are on the same version.

Another method would be to rsync your app on both servers, but it may lead to version mismatch with Frappe and ERPNext if not done carefully.

Good luck!


#9

Hi @chdecultot

Thanks for your response. If I use this approach, at what point do I pull the app and install? As @adnan mentioned earlier, the database might not restore till I first install the app. If you could give some guidance on the order to follow, it would be much appreciated

I’m currently assuming the following:

  1. Install Frappe and create new site (on new server)
  2. Pull Custom App and install it on new site
  3. Restore database and files from previous site

I’m also assuming that I should not setup the new site (from UI) before restoring the database

Kind regards,


#10

Hi @wale,

You’re assumption is correct:

  1. Install Frappe (and ERPNext if needed) on a new site
  2. Install your app using bench get-app command
  3. Restore your database and files.

You don’t need to make the setup, because the installed database will be anyway overridden by your backup.

You can follow exactly the instructions on the wiki:


#11

Many thanks @chdecultot