Migration of ERPNext from one server to another

I have to migrate ERPNext from my to server to a client server for production purpose. How can i do this without any data loss.

First take backup

For backup with file:

:~/frappe-bench$ bench --site [sitename] backup --with-files

Transfer file from server to Client Server

scp -P 22 [user]@server:/home/user/[path]/filename ~/localpath/filename

Restore the file:

Copy the file inside frappe-bench directory then run the following command

bench --site [sitename] --force restore [path sql database which file name] --with-private-files [file location and filename] --with-public-files [file location and filename]

bench migrate or bench --site [sitename] migrate
3 Likes

Thank you for your response @mohitchechani . Do you happen to have any documentation for this. If so can you kindly share it to me. It would be more helpful.

https://frappeframework.com/docs/user/en/bench/reference/restore

I have tried this method but I could’nt restore the files. It is installing as a new application. In addition to this I also have few custom scripts which I need to migrate with it. So is there any other method?

1 Like

how about if i just want to transfer the private and public files and link them …

like i have a brand new version installed , i don’t want the entire database,but i just uploaded the item list from old server which had images and its links , i want the images .

so can i just transfer the old image files to the new server same folder and the link will be re-established ?

or is there some other way

edit: just checked , just restoring the files in the public directory of the site and doing bench migrate does not restore the files ,
they dont even show up in file list …

please guide on how to link , because its not possible to re-add them one by one , or even to migrate the whole db