From f1bf7d6f605ed68e8b898c7af0bf27f631ee1743 Mon Sep 17 00:00:00 2001 From: NyashaMuusha Date: Mon, 9 Sep 2024 14:37:30 +0200 Subject: [PATCH] updated back backup and restore --- documentation/backup-and-restore.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/documentation/backup-and-restore.md b/documentation/backup-and-restore.md index ad07140cc..ab238e635 100644 --- a/documentation/backup-and-restore.md +++ b/documentation/backup-and-restore.md @@ -22,6 +22,23 @@ b. Get the list of Golden Record Source Ids \ c. Get the list of interactions \ d. Write the data to file (JSON) +## Prerequisites +- PostgreSQL Version: Ensure that PostgreSQL 15.5.0 is installed. +- The backup and restore operations are validated on this version. +Verify the installation by running psql --version + +**Python Installation** +- Make sure Python and the python-dotenv package are installed to manage environment variables. +- Verify the installation by running python3 -m dotenv --version + +**Using python-dotenv** + Load these variables using python-dotenv: +- from dotenv import load_dotenv +- import os +- load_dotenv(/path/to/your/.env) +- print(os.getenv(environment variable name)) +- python3 test_dotenv.py (This should load the environment variables from your .env.local file) + ## Backup Dgraph and Postgres Process - **Backup Directory Dgraph:** \ JeMPI/devops/linux/docker/docker_data/data/backups/dgraph @@ -44,6 +61,14 @@ The backup process creates a folder with a timestamp. Inside this folder, backup ![Backup Postgres and Dgraph](../.gitbook/assets/14) +**Manual Backup Process** + +- pg_dump -U -d > /path/to/backup_file.sql + +**Verify if process was successful** +- echo $? (This variable holds the exit status of the last command executed. An exit status of 0 indicates that the last command (pg_dump) completed successfully.) +- ls -lh + ## Restore Dgraph and Postgres Process - **Backup Directory:** JeMPI/devops/linux/docker/docker_data/data/backups/dgraph