Skip to content

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.

Backups

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 Postgres 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.

Pgdump 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 pg_dump from 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 sandbox1-vectr-postgres-1 /bin/bash -c 'pg_dump -v -U vectr -d vectr' | gzip > postgres.sql.gz

#copy the file out of the container:
docker cp "postgres.sql.gz" "/your/host/location/postgres.sql.gz"

This will copy the dump to the directory where you ran the command. Make sure to store it in a secure location.

Restoring

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/postgres (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/postgres

This data will restore into the Postgres database once the containers are started. If your data is not restored check your tomcat container logs for any errors and check file permissions mentioned above.