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
- Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
- Halt the bitnobi process using the command
./stop.sh
and wait for all of them to stop - run
./backup-bitnobi.sh
. This will create a .tar.gz file in thebackup
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 namedbackup-20200213_1539.tar.gz
. - restart the Bitnobi containers by running the
./start.sh
command in the main Bitnobi directory.
- Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
- Halt the bitnobi process using the command
./stop.sh
and wait for all of them to stop - 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
- restart the Bitnobi containers by running the
./start.sh
command in the main Bitnobi directory. - 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.
- If Bitnobi has not been installed on the target server, then proceed with the normal deployment instructions.
- Tranfer a copy the desired backup.xxx.tar.gz file to the target Bitnobi server (e.g. into /tmp).
- Open a terminal session on your Bitnobi server (e.g. through SSH) and navigate to the main bitnobi directory (e.g. ~/ra-bitnobi).
- Make copies of the
docker-compose-bitnobi.yml
andconfig/bitnobi_env.list
files (e.g. naming the copiesdocker-compose-bitnobi.yml.bak
andbitnobi_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. - 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
- If necessary, use a text editor to fix up the
common.sh
file anddocker-compose-bitnobi.yml
to adjust Bitnobi image names, CA certificate, port numbers, etc. Also edit theconfig/bitnobi_env.list
file to correct the email server or service key, as well as the MAILER_FROM address, replica-synthesis URL, etc. - restart the Bitnobi containers by running the
./start.sh
command in the main Bitnobi directory. - 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.