Saw quite a number of post regarding backup/restore issue and wanted to list out what I have done to take the hosted (erpnext.com) auto backup - dropbox, and restore it to a VM (Vbox) installed locally. I did encounter a couple of error initially, first figuring out how to do the restore (it has changed substantially since I tried the backup restore of yesteryear version of ERPNext), and figuring out why I get internal error after restoration.
Hosted version :
VM version :
Frappe : 12.13
VM ova downloaded current as of the time of this posting from https://erpnext.org/download
Step done :
- Import OVA to Virtualbox
- Change NAT port forwarding from host 8080 to host 9080, guest stays at 80. I dont like 8080 as it is quite common and might crash with other server running in the local host that expect port 8080 (you can use any port, just use something that is unique and not really used by other)
- Start VM - (optional to do the bench update as per website recommendation, I did not do so… hence my lower ERPNext/Frappe version if yours showed a much bigger difference it might cause error during restoration)
- Open chrome or your other favourite browser from host and browse to http://localhost:9080 (or other port you have specified to be forwarded to the VM)
- Start your site configuration to get ERPNext up and running, I set up the user name and password to mimic what is used in ERPNext.com hosted login/password.
- Download your back up from dropbox or from other location that you have been using. Im downloading the database (compressed .gz), public files and private files.
- Use your favourite FTP client to transfer the database file to VM inside /frappe-bench directory. To connect to the VM, use port 3022 (same as ssh port) for the ftp connection.
- Use the command line as mentioned in https://github.com/frappe/erpnext/wiki/Restoring-From-ERPNext-Backup to force restore the db. Here’s what I used from frappe-bench directory :
bench --site site1.local --force restore ./2021db.sql.gz
- FTP transfer all the private files and public files to site1.local/private/files and site1.local/public/files
- At this point if you try to access the ERPNext in the VM you will get internal server error, this happen because the hosted instance have 2 additional apps installed as you can see from the screen shot above. - ERPNext support and Journeys. I am not familiar on what these 2 apps does, but removing them does not harm my ERPNext functionality that I used (only the inventory and invoicing/quotation portion) YMMV.
- Remove the apps from the restored ERPNext instance : bench --site site1.local remove-from-installed-apps erpnext_support and bench --site site1.local remove-from-installed-apps journeys
- Installed apps may differ, type bench migrate under frappe-bench directory and it will spew out any apps that is not available in the VM, uninstall them or find a way to install them to your VM
- I did bench restart and everything is good
- In case you can’t use your password, to login to your VM instance after the DB restore just click the reset password but remember to change the link that the program emailed out to include your port number e.g. link sent out will be to click to http://localhost/blabla, remember to add port number http://localhost:9080/blabla
Enjoy your locally installed VM ERPNext
I obmitted 1 step from the restoration which is the siteconfig.json file that is also being automatically backed up to dropbox, it contain the db password and key. I dable with it initially thinking that the restored db password differ compared to the back up files and causing internal error. But changing the local site json file does not solve the internal error issue (it is caused by apps installation difference). I left the edited json config file with original password setting (that comes together with the VM after setup) but also added to it field that seems to be only needed for hosted instance. I guess it is not necessary to restore the json file using backed up file, instead just use the locally created json file and live long-er…
Got my local VM running ERPNext although it seems to be slower than hosted… at least it’s running and you can do whatever you need to do locally…