Has anyone ever successfully moved a working ERPNext system to another server without using a server image?

I move sites multiple times, from a server to another or from a multitenant configuration to a single tenant.
The key is to create a backup with bench backup, database backup are stored in my_site/files/private/backup/

So here my workflow :
In the new server :

  1. Install bench manually or with installation script
  2. Setup a new bench with specific frappe version bench init --python python3 --frappe-branch version-11 my-bench for example
  3. From your new bench instance get your app : bench get-app --branch version erpnext
  4. Next is where you will need to copy files from your backup server to your new server in a backup directory (not inside the current bench)
  5. Get your backup site (only the site folder is required unless you have configured some elements globally)
  6. unzip your last database backup inside your new server : gunzip my_site/files/private/backup/my_sitexxxx.sql.gz
  7. From your new bench install a new site with this backup : bench new-site --source_sql /full/path/to/your/backup.sql my_new_site Now you will have your site inside your new bench
  8. Copy files from your backup inside your new new site : cp -R backup/my-site/files/private/ my-bench/sites/my-site/files/ and cp -R backup/my-site/files/public/ my-bench/sites/my-site/files/
  9. Next you must copy the “encryption_key” from your backup my-site/site_config.json, to your new-site if you want to be able to read emails in your new instance
  10. now all is prepared to run the bench setup production, bench setup lets-encrypt and another bench update

I have script that in a bash script to ‘restore-site’ with all this steps in my servers.
And I also backup only datas (databases, files folder and site_config.json)

Regards.

10 Likes