How to backup ERPNext?

Time needed:ย 30 minutes.

Backups are ridiculously important and absurdly overlooked. To perform a manual backup of ERPNext, follow these steps:

  1. Log in to the server console using SSH

    You can use private keys or passwords to login to your server depending on your setup.

  2. Change to bench directory

    At the server console, execute the following command to bench directory.
    cd frappe-bench

  3. Backup Site

    Execute the following command to back up the site.
    bench --site <sitename> backup --with-files
    Your backups will be in ~/frappebench/sites/[sitename]/private/backups/
    The above command will generate 3 files per site, database backup, private files backup, public files backup. You need all these files to successfully restore the site.
    Check out for the most recent backup with the current time, there may be backups there already. If you have multiple sites on the same server repeat this step for all sites.

  4. Transfer / Download Backup files

    You should not keep the backup files on the same server. In the event of server failure, you will lose your backup. So always download or transfer the backup files to different computers/servers. You can use sftp software such as WinSCP to download files from the server.

Backing up your site is necessary if you want to make sure your site stays safe and secure. It gives you peace of mind that you can easily restore your site and continue doing business as usual, instead of suffering downtime while you rebuild your site.

You now know how to backup and restore your ERPNext site so there is no excuse to delay.