Skip to content

Backing up a Refinery Instance

Jennifer Marx edited this page Apr 29, 2019 · 21 revisions

Content:

  1. Backup
  2. Restore

AWS backups

Note:

To ensure a full back up of one's Refinery instance, one must ensure that the following items are saved/copied elsewhere.

  • Local settings
  • PostgreSQL database
  • File store

Below are instructions on how to accomplish a complete backup.


Backup

Script:

For convenience we provide a backup script, which performs each step, creates a compressed archive and moves it into Refinery's synced directory. Follow the instructions below to backup your Refinery instance.

Note: If the enviornmental variable REFINERY_VM_TRANSFER_DIR is set up and you work with the dev vm the final tarball is moved to this transfer directory. Edit BACKUP_FINAL if you need to move the final tarball somewhere else.

$ vagrant ssh
$ workon refinery-platform
$ cd /vagrant
$ ./backup.sh

Note: The script does not take care of managing backup tarballs!

Local settings

$ gzip -c < /vagrant/refinery/config/config.json > /vagrant/transfer/backup/settings/config.json.gz

PostgreSQL database

According to: http://www.postgresql.org/docs/9.1/static/app-pgdump.html

$ pg_dump -Fc refinery > /vagrant/transfer/backup/postgresql/refinery.dump

File store

$ rsync -azP /vagrant/media/file_store/ /vagrant/transfer/backup/file_store

Restore

Follow the instructions regarding the installation of Refinery first and make sure that you replace your backed up settings before provisioning the vm. Then restore the other data step by step.

If you created your backups using our backup script, you can easily restore a backup using our restore script. Follow the instructions below.

$ vagrant ssh
$ workon refinery-platform
$ cd /vagrant
$ ./restore.sh /vagrant/transfer/20000101.tar.gz

Notes:

  • Do not rename the backup's tarball created by backup.sh, otherwise restore.sh will fail.
  • Make sure that all services are running properly; e.g. Solr.

Local settings

$ gzip -d < /vagrant/transfer/config.json.gz > /vagrant/refinery/config/config.json

PostgreSQL database

$ pg_restore -d refinery /vagrant/transfer/backup/postgresql/refinery.dump

File store

$ rsync -azP /vagrant/transfer/backup/file_store/ /vagrant/media/file_store

Solr's index

As we are not backing up Solr's index, it needs to be rebuild after restoring the data. Feel free to adjust (or remove) --batch-size depending on your server specs. Usually a batch size of 25 works fine even when developing locally.

Prerequisite:

  • Make sure that the VM is running and that all services started. You can check the status of services using supervisorctl status.
$ ./manage.py update_index --batch-size 25