How to move ERPNext from the server to the local

I am new here, I took over the code from senior, but the senior did not create test environment at the time of development, I am Chinese, and I don’t speak English. I really appreciate your help.

I used to 7z to pack frappe-bench and decompression it in local file ,but it does work when I eccute “sudo bench --site production serve --port 9000”, it is reported that some CSS and JS can not be found in the background

1 Like

@xu_qian

You simply need following steps to move the ERPNext setup from Server to Local

(Assumption: You want to move your setup from Self-hosted server to Local, and not from ERPNext Cloud Platform.)

  1. Take a backup of you ERPNext site by executing following command bench --site site_name backup

  2. Setup Development environment on your machine using steps in the following link,

  1. Now, copy the backup file which should be present in frappe-bench/sites/site_name/private/backups/latest_date_time.sql.gz to your local machine.

  2. Create a new site on your local using bench new-site dev-site-name

  3. Execute following command on your local, bench --site site_name --force restore /path/to/copied/latest_date_time_sql.gz

  4. Run bench start to run development environment.

Hope this helps in setting up the server environment on your local.

3 Likes

what to do if I have to move from ERPNext Cloud Platform to self hosted, how to take the backup and restoration process

###On Cloud Platform:

###On your local:

But the backups are old, looks like they are taken at an interval of 4-5 hours. We want to first stop the request from going to Cloud ERP. and then we want to take backup and apply it to new server. We don’t want to loose any data.

@binodmainali1

That is not possible with ERPNext cloud, you will have to ask your internal users to stop posting new entries or take a backup on a weekend, when no new entries would be posted to ERP’s cloud version.

P.S.: Backups on the cloud occur at interval 6 hours.

After execute the restore command, i am facing this error:- _mysql_exceptions.ProgrammingError: (1146, “Table ‘1c9bb4bf2ef78827.tabCustom DocPerm’ doesn’t exist”)

After several hours R&D but still no clue how to resolve it.

How Can I fill this command
bench --site site_name --force restore /path/to/copied/latest_date_time_sql.gz

how I can get the path?
my backup file
20200411_060030_sql.gz downloaded from the cloud platform, to the desktop
thank you in advance