azureerpnext

Migrate an ERPNext installation

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.

There are two important steps when migrating ERPNext: create a backup of your system and database on the old server, and restore it on the new one. Follow the instructions below:

  • Log in to the server console. Learn how to connect to the server through SSH.

  • Navigate to the frappe-bench directory of your ERPNext installation. Depending on your installation type, execute the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/frappe-bench
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/erpnext/htdocs/frappe-bench
      
  • Create a backup of your ERPNext site:

      $ bench backup-all-sites
    

    The command above will generate three files in the frappe-bench/sites/erpnext/private/backups directory. Read more about the backup process.

  • Download the generated backup files to your desktop.

  • Upload the generated backup files to the /home/bitnami directory of the new server.

  • Log in to the server console. Learn how to connect to the server through SSH.

  • Uncompress the backup file with extension .sql.gz using the command below. Remember to replace the FILENAME placeholder with the correct file name and path.

      $ gunzip FILENAME
    

    This will extract the contents of the backup file into a new directory.

  • Connect to the MariaDB database server using the MySQL CLI and run the command below to delete the existing ERPNext database and all its contents.

      $ DROP DATABASE bitnami_erpnext;
    
  • Navigate to the frappe-bench directory of your ERPNext installation. Depending on your installation type, execute the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/frappe-bench
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/erpnext/htdocs/frappe-bench
      
  • Restore the database backup from the old server by running the commands below. Remember to replace the DIRNAME placeholder with the correct name of the directory containing the extracted contents of the backup file.

      $ bench restore /home/bitnami/DIRNAME
    
  • Uncompress the backup file with extension -files.tar and copy the extracted contents to the new ERPNext site. Remember to replace the FILENAME placeholder with the correct file name and path.

      $ mkdir -p ~/extracted
      $ tar -xf FILENAME -C ~/extracted/
      $ cp -r ~/extracted/erpnext/public/files/* sites/erpnext/public/files/
    
  • Repeat the previous step for the -private-files.tar backup file.

  • Restart the servers:

      $ sudo /opt/bitnami/ctlscript.sh restart
    

You should now be able to access the ERPNext site from the older server using the new ERPNext instance. Use the credentials from the old server to log in.

Last modification September 6, 2021