Backup from Bitnami instance and restore to ERPNext Ubuntu on google cloud

I want to backup my ERPNext data private as well as public files to newly configured ERPNext on google cloud Ubuntu platform. How do I do this?

Take backup using this command
bench backup --with-files
then copy pase that file to your cloud server and move public and private file at desire location in server
and restore your database usign following command
bench --site site-name --force restore database-file-location-absolute-path

I tried from all the directories in SSH of bitnami instance but it says missing “site” I don’t know how to go to my site and take backup. When I go to SSH it

I am pasting the commands and their results from SSH window.

amar@erpnext-1-vm:/home/jazkukreja$ cd stack
amar@erpnext-1-vm:/home/jazkukreja/stack$ dir
apache2 changelog.txt git manager-linux-x64.run properties.ini scripts var
apps common img modules python sqlite
bnsupport config letsencrypt mysql README.txt stats
bnsupport-tool ctlscript.sh licenses nodejs redis use_erpnext
amar@erpnext-1-vm:/home/jazkukreja/stack$ cd …
amar@erpnext-1-vm:/home/jazkukreja$ cd apps
amar@erpnext-1-vm:/home/jazkukreja/apps$ dir
bitnami erpnext
amar@erpnext-1-vm:/home/jazkukreja/apps$ cd erpnemxt
-bash: cd: erpnemxt: No such file or directory
amar@erpnext-1-vm:/home/jazkukreja/apps$ cd erpnext
amar@erpnext-1-vm:/home/jazkukreja/apps/erpnext$ dir
bnconfig conf htdocs scripts updateip
amar@erpnext-1-vm:/home/jazkukreja/apps/erpnext$ bench backup
Usage: bench backup [OPTIONS] SITE
Error: Missing argument “site”.
amar@erpnext-1-vm:/home/jazkukreja/apps/erpnext$ bench backup jazkukreja
Traceback (most recent call last):
File “/opt/bitnami/apps/erpnext/htdocs/venv/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/opt/bitnami/apps/erpnext/htdocs/bench/bench/cli.py”, line 40, in cli
bench_command()
File “/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/opt/bitnami/apps/erpnext/htdocs/bench/bench/commands/utils.py”, line 106, in backup_site
if not site in get_sites(bench_path=‘.’):
File “/opt/bitnami/apps/erpnext/htdocs/bench/bench/utils.py”, line 201, in get_sites
sites = [site for site in os.listdir(sites_dir)
OSError: [Errno 2] No such file or directory: ‘./sites’
amar@erpnext-1-vm:/home/jazkukreja/apps/erpnext$ bench backup --with --files
Error: no such option: --with
amar@erpnext-1-vm:/home/jazkukreja/apps/erpnext$

I don’t know how do go to site and take backup

How do I find site name?

Try this
bench --site site-name backup --with-files
no space after --with
for check site name see in site folder you will get folder name as your site name

Thanks sir, but there is no sites folder at all. I looked for it under all the folders.

your are in wrong folder execute above commanad from jazkukkreja folder
inside this folder you will find site folder

1 Like

I was able to backup using bench backup --with-files. In SSH of google cloud it shows the tar files but now I don’t know how to restore them to google cloud Ubuntu instance. Please tell me step by step if I will have to download the backup files to my computer hard disk or I would be able to restore them directly form google cloud? I don’t know the path of backup files.

If Bitnami instance is hosted locally and if it does have internet access? then
then simply use https://transfer.sh to move files
or rsync as follows:
Example:

rsync -chavzP --stats /path/to/backup-file-1.tar root@google-cloud-server:/path/to/frappe/erpnext/users/dir

Repeat this command for all files and you will have all files transported to google cloud server. Then perform restore.

I will recommend to hire service providers (https://erpnext.org/service-providers) if you are not sure and stuck with restore/migration.

If you are using the SSH drop down menu in the GCP server list, then there is a button in the upper right corner of the black command window. click on it and select “Dowload File”

This will allow yo to download the backup file from one GCP server and then you log into the GCP ubuntu instance using the same concept. In the ubuntu instance, click on the button in the top right corner of the black command (ssh) window and select “Upload File” to upload the backup file from your local PC back to the GCP ubuntu server.

Once the file is up on the ubuntu GCP instance, you will need to de-compress the file into your home directory and then issue the bench restore command mentioned earlier. (You may need to lookup the comand to decompress the file to get clean *.sql file)

GCP (google cloud platforrm) is fairly easy to work on, but it does have it’s limits. You will likely never get the email to work unless you are using gmail.

Hope this helps.

BKM