Skip to content

Commit

Permalink
fix small issues in new scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigabig committed Nov 20, 2024
1 parent c5f20fc commit ae47762
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 3 additions & 1 deletion bin/backup-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fi
set -o allexport
source docker/.env

cd docker || exit

# Create a dump of the database
docker compose -f compose.yml -f compose.production.yml exec -e PGPASSWORD="$POSTGRES_PASSWORD" -T postgres pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" > "backups/postgres/dump_$(date +%Y_%m_%d_%H_%M).sql"
docker compose -f compose.yml -f compose.production.yml exec -e PGPASSWORD="$POSTGRES_PASSWORD" -T postgres pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" > "../backups/postgres/dump_$(date +%Y_%m_%d_%H_%M).sql"
echo "Database dump created successfully."
10 changes: 1 addition & 9 deletions bin/backup-weaviate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,12 @@ if [ ! -d ".git" ]; then
exit 1
fi

# Ensure that the docker/.env file exists
if [ ! -f "docker/.env" ]; then
echo "The docker/.env file does not exist. Please create it by copying the docker/.env.example file."
exit 1
fi

# Ensure that the directory backups/weaviate exists
if [ ! -d "backups/weaviate" ]; then
mkdir -p backups/weaviate
fi

# Load environment variables from the docker/.env file
set -o allexport
source docker/.env
cd docker || exit

BACKUP_NAME="backup_$(date +%Y_%m_%d_%H_%M)"
docker compose -f compose.yml -f compose.production.yml exec -i weaviate sh -c "wget --header='Content-Type: application/json' --post-data='{
Expand Down
2 changes: 2 additions & 0 deletions bin/restore-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ fi
# Restore the repository from the backup
# 1) Make sure that no container is running
echo "Stopping all containers..."
cd docker || exit
docker compose -f compose.yml -f compose.production.yml down
cd .. || exit
# 2) Delete the existing repository
echo "Deleting the existing repository..."
rm -rf docker/backend_repo
Expand Down

0 comments on commit ae47762

Please sign in to comment.