Backup and Restore from the web?


I just wondered if it’s possible to backup site1 on web bench manager/erpnext web and then restore to site2 using the web bench manager/erpnext?

It would be great to be able to take a snapshot of the live website and restore to test site and test any journals etc without having to go via SSH.

Thank you.

If you are using the Frappe/ERPNext cloud service, then I believe that you are limited to only what you can get their service department to provide you with on a “one off” basis.

However, if you are hosting it yourself on an alternate VPS service, then you can easily make a backup of your entire server and restore it to another VPS server of the same specifications (usually on the same vendor service). I do this all the time even now. I maintain at least 3 VPS servers for every client.

  • The first one is their primary “Live” server for daily operation
  • The second one is a backup server that can be made active in less than 30 min in the event of a catastrophic failure of the main LIVE server.
  • The third one is a sandbox for the client to teach their staff and work out new workflow issues without impacting their live daily work.

Aside from the main Live server, the second one is the most important. I use a crontab job entry to run a manual data backup every hour during the business day (11 hrs from 7am to 7pm) and then a final one for the day at 2 minutes before midnight, This is a total of 12 backups for the day.

Those backups are created in a specific directory in the default user directory. Part of the script that creates the backups, also takes care of moving the last backup to a different directory before dropping in the new one. It also uses the “scp” command to move a copy of the most recent backup from the live server to the backup server.

On the backup server, there are other crontab job scripts that detect the transferred file and manage a regulated storage scheme while also setting up the most recent backup file in a specific directory so that it could be restored quickly and the server restarted to take the place of the main live server in the event of a catastrophic failure.

All this means that “if” a failure occurs, I can get them running again on the backup server in less than 30 min and at worst case they are only missing an hour worth of work. This beats losing everything and having to wait several hours or more and maybe losing more data.

I know there are more expensive ways of doing this using server mirroring and automatic switch-over, etc. but those are expensive to setup and even more expensive to maintain. My simpler solution is not as wonderful as the auto-switching method, but it gets the job done at about 2% or 3% of the cost of setting up and maintaining the more expensive solutions… and for what exactly?!? Maybe only 3 minutes down time and little or no loss of data versus possibly having to repeat up to an hour worth of work? When given the choice almost every one of my clients chooses the cheaper method.

Anyway, here is the command I use for running the backup every hour:

mysqldump -u root -pMySqlPassword 1ba3e0274ad89191 | gzip > /home/DefUser/backups/current/"$(date '+%m%d-%H%M').sql.gz"

I put that command in my script and it generates the backup file in gzip form just like the built-in backup feature does. The strange string following the “MySqlPassword” is the actual name of the sql file in the system. You can find this in the site_config.json file in your sites default directory.

Here is the command that I use to transfer the file to the backup host:

scp /home/DefUser/backups/current/*.sql.gz DefUser@

Of course you would have to use your specific default user account and replace the made-up ip address here with the real ip address of your backup host.

There are a few more things that need to be setup to make this work, but you should pretty much get the idea from this.

Finally, I have a script that sends the last backup file of the week to the sandbox server and as part of my regular maintenance I restore that file to the sandbox server on Monday mornings so they have a fresh set of data to experiment and train from for the week.

Hope this helps… :sunglasses:



Thank you @bkm for this. Didn’t know this was possible. We usually use Digital Ocean with image back up. But that is only happening once weekly. ERPNext is usually set for 4 backup per day. Plus we advise clients to store backup offline ona set frequency.

Can you kindly put up a guide as to how you achieve this? Would really help large clients who cannot afford to loose on downtime due to production server having issues. Thank you.

1 Like

@bkm sounds like a nice yet simple piece of production infrastructure you built.

Do you happen to have that set of scripts mentioned in your post on github (or elsewhere available) and would be able to share this with us here?

Really?!? I never really considered it to be overly impressive. I just thought it up as a poor mans backup function because my clients couldn’t justify the costs of an auto-switch-over solution. I thought everyone else already had elaborate backup processes. Most of them done by developers much smarter than myself. My solution is much less elegant but it works for my clients.

Ok, If you think it has some value, then I will find a way to post the all scripts and instructions for setting it a up. Probably over the weekend sometime and I will post a link to it back here.

Check back after the weekend.


Hi @bkm

Thank you for the response, You actually answered another question I was thinking about! How to restore to a backup server. I intend to use Erpnext for e-commerce so have purchase>manufacture->sales on ERPNext so single system so it is vital I have a quick method of restoring when a server goes down!

My original question related to using the web front end to run a backup from one site and restore onto another site. Rather then SSH in and running scripts.

I am using DNS multi-site with www.domain (live) and test.domain (test). I couldn’t find the option in the Web Bench Manager so I am guessing it might not be a feature??

Alternatively, I am thinking I might knock up a password protected web page where I can press a button and have the site backup and restore onto the test site (i.e. run the bench commands).

Thank you!

Ok, looks like the option is there…

Run backup by going to Bench Manager >> Site >> Select you site. Then click “backup” button.

This will then run the backup.

To restore backup, Bench Manager >> Site Backup, select the relevant backup and then click Restore.

Now the only problem I have noticed is when running backup using the Bench Manager, it does not appear in this Backup List above and the actual restore fails due to invalid paths.

I will look into this now…

Ok, as promised… @vrms @Muzzy

I have tracked down all of notes on how I setup my simple backup scheme and I have posted a Step by Step tutorial on how I did it. Hopefully is will help someone else.

When investigating methods for doing backups, I ran into many things like the “fail-over” method. I was surprised at just how many people recommended this, but after a lot of research I found it is not easy to implement and not easy to debug if something goes wrong. It is also quite expensive!!! The cost to just set it up can exceed $2,000 US easily and then can run over $400 US each month to keep it active because it requires a separate monitoring server and a service to keep it going. I know that there are some on this very forum that even swear by this process.

I am sorry, but that cost model just does NOT fit with the target ERPNext client! Small to medium business cannot afford that and wouldn’t even understand how to use it properly. So, I had to come up with something else that would fit my needs and cost much much less to maintain.

You can read about it in the link above.



Thank you @bkm this is perfect.

Any chance you have used the restore feature in Bench Manager. I keep getting invalid path when selecting the backup file?

I am running Stock Install via the install script so everything should be working out of the box, so not sure why there would be a location error. The only difference could be is that I am using a different username then bench-name in the install script?


No. Not for a very long time. I have never found it to work properly for me. Also, because it is running from Bench Manager, it seems to require much more in the way of server resources (CPU, memory,etc.) so it also tended to fail with larger files when I tried using it.

Also, I am not sure that you would be able to get Bench Manager to recognize a backup file taken from another server source without using SSH to place it properly. So, since already having to be in SSH, might as well use the command that works every time like the one I referenced near the end of my main post.


Unfortunately, the playbook is always changing and not everything is tested after a change. So I have seen many instances where the playbook changed to fix one install issue, and it also broke some other simple issue. In fact one of those instances broke the Awesome Bar and nobody believed me about it for many months. It only recently got fixed.

Try making an issue of it on GitHub. That gets much more attention than postings here.

Hope that helps…


Thank you for the reply.

Searching the forum, there is little on the Bench Manager, so I am guessing people don’t use it.

I will just go with plan b and have a little webpage which has the key features I need (i.e. backup and restore to new test site).

Thank you!