Backups & Restoring Data
Keep in mind…¶
These are general notes and technical details on basic VECTR maintenance tasks and functionality. This should not be considered prescriptive to your environment nor is it a recommendation. You should assess your business needs and internal policies before putting these in place.
The "install" directory for VECTR only contains the .env file which may contain required secrets. No database files are stored in that directory.
VECTR Data is stored in its MongoDB container. This container has a mounted volume where the data is stored on the Linux host.
With this in mind it is not recommended to attempt to copy the volume off the disk directly. The file system Docker creates is not intended to be copied in that way.
Mongodump from the container then copying this out of the container to the host is the easiest method for pulling a backup.
Note the variables in the following commands, you will need to replace them with information from your environment.
#!/bin/bash #run mongodump in the container, put it in the /tmp/ directory in the container. This is using the default password and default container name: docker exec -w /tmp <mongo_container_name> /bin/bash -c 'mongodump --username <admin_username> --password <mongo_password> --authenticationDatabase admin; tar -zcvf dump.tgz -C dump .' #copy the file out of the container: docker cp <mongo_container_name>:/tmp/dump.tgz .
This will copy the dump to the directory where you ran the command. Make sure to store it in a secure location.
This is general guidance to restore data from a backup. This assumes your containers are not up and have not been created. Any data in the docker volumes must be removed before starting a restore from backup.
Make a directory /opt/vectr/user/mongo (assuming VECTR is installed under /opt/vectr). This directory will have to have the uid/gid that VECTR is using inside the container (10001:10001). You can read about that here.
Once the directory is created, untar the contents to that directory
tar -zxvf dump.tgz -C /opt/vectr/user/mongo
This data will restore into the mongo database once the containers are started.