Skip to content

Backup and Restore

AdaptAware edited this page Dec 8, 2024 · 2 revisions

Backing up and Restoring a ragit collection

The structure of the directory holding your ragit collection should be the following:

<your-collection-name>
├── backups
├── documents
├── registry
└── vectordb
    └── <your-collection-name>-chroma-vector.db

Backup the psql database

In postgres there should be a database named which holds the chunks used and also information about what has been inserted to the vectordb to keep housekpeeing clean. We need to create a backup of it to add it to the registry and the vectordb files so we will be able to completely restore all the related data.

From the vagrant machine to backup a RAG collection you need to run the make_backup.sh utility from the /vagrant/ragit/utils passing the name of the collection as the only argument to the command as can be seen here:

cd /vagrant/ragit/utils
 ./make_backup.sh dummy

The above command will create a tarball named dummy.tar.gz under the roor directory of the shared directory (by default ~/ragit-data)

This tarball we can move it to any directory we like to use as the backup container.

Restoring a RAG collection

To restore a RAG collection using its backup tarball we can use the restore_backup.py python script that is locatio under the /vagrant/ragit/utils directory as can be seen here:

cd /vagrant/ragit/utils
python3 restore_backup.py dummy.tar.gz

Upon completion of the above script the dummy directory will be created under the shared directory (by default ~/ragit-data).

Still we will need to create the database manually as can be seen here:

cd ~/ragit-data/dummy
dropdb -U postgres dummy
createdb -U postgres dummy
psql -U postgres -d dummy -f dummy.sql

At this point you should have a fully functional database and RAG collection in general and you should be able to start the front end and run it against it.

Clone this wiki locally