Backup and Restore - myantandco/RA-BitnobiPilotJuly2020 GitHub Wiki

The backup-bitnobi.sh and restore-bitnobi.sh commands allow saving all Bitnobi state and user defined content so that it can be later restored into a new Bitnobi server. This allows you to do things like:

  • move the Bitnobi installation to another server while preserving all users, policies, workflows, etc.
  • duplicate the state of a Bitnobi system into another server
  • examine Bitnobi state for some previous date.
  • recover from a catastrophic hardware or software failure

Some limitation of the current implementation:

  • May not restore properly if the version of Bitnobi code has changed significantly.
  • Need to temporarily halt Bitnobi while backup or restore is in progress

Backup

  1. Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
  2. Halt the bitnobi process using the command ./stop.sh and wait for all of them to stop
  3. run ./backup-bitnobi.sh. This will create a .tar.gz file in the backup directory under your main bitnobi directory. The current date and time will be part of the backup name. For example running ./backup-bitnobi.sh on Febrary 13 at 15:39 would generate a file named backup-20200213_1539.tar.gz.
  4. restart the Bitnobi containers by running the ./start.sh command in the main Bitnobi directory.

Restore a backup from the same server

  1. Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
  2. Halt the bitnobi process using the command ./stop.sh and wait for all of them to stop
  3. run sudo ./restore-bitnobi.sh <backup-file-path> substituting the path to the Bitnobi backup file you wish to restore. This will over-write the following files and folders:
  common.sh
  config
  data
  export
  External
  jupyter-notebooks
  nginx
  uploads
  vault
  1. restart the Bitnobi containers by running the ./start.sh command in the main Bitnobi directory.
  2. go to the logs directory and examine the server-out.log file. The start of this file should show a successful connection to MongoDB, and a vault status of "sealed":false. There should be no error messages.

Restore a backup from a different server

  1. If Bitnobi has not been installed on the target server, then proceed with the normal deployment instructions.
  2. Tranfer a copy the desired backup.xxx.tar.gz file to the target Bitnobi server (e.g. into /tmp).
  3. Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
  4. Make copies of the docker-compose-bitnobi.yml and config/bitnobi_env.list files (e.g. naming the copies docker-compose-bitnobi.yml.bak and bitnobi_env.list.bak). The restore operation will exactly replicate the original Bitnobi configuration, but your target server might be using a different Bitnobi image names, different email server, different MAILER_FROM address, different CA certificate, different port numbers, etc. The .bak files can act as your reference to adjust the Bitnobi configuration.
  5. run sudo ./restore-bitnobi.sh <backup-file-path> substituting the path to the Bitnobi backup file you wish to restore. This will halt all Bitnobi containers and over-write the following files and folders:
 common.sh
  config
  data
  export
  External
  jupyter-notebooks
  nginx
  uploads
  vault
  1. If necessary, use a text editor to fix up the common.sh file and docker-compose-bitnobi.yml to adjust Bitnobi image names, CA certificate, port numbers, etc. Also edit the config/bitnobi_env.list file to correct the email server or service key, as well as the MAILER_FROM address, replica-synthesis URL, etc.
  2. restart the Bitnobi containers by running the ./start.sh command in the main Bitnobi directory.
  3. go to the logs directory and examine the server-out.log file. The start of this file should show a successful connection to MongoDB, and a vault status of "sealed":false. There should be no error messages.
⚠️ **GitHub.com Fallback** ⚠️