Grab the credentials from the .env file.

This commit is contained in:
Ivaylo Novakov 2021-01-20 14:46:48 +01:00
parent feab19266e
commit 4b8dfd5d26
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,11 @@
#!/bin/bash
# Take the current datetime:
DT=`date +%Y-%m-%d`
# Set the environment:
set -o allexport
source ../.env
set +o allexport
# Take the current datetime:
DT=`date +%Y-%m-%d`
# Create the backup:
@ -7,4 +13,4 @@ docker exec cockroach \
cockroach sql \
--host cockroach:26257 \
--certs-dir=/certs \
--execute="BACKUP TO 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"
--execute="BACKUP TO 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';"

View File

@ -6,8 +6,13 @@ if [[ $BACKUP == "" ]]; then
exit 1
fi
# Set the environment:
set -o allexport
source ../.env
set +o allexport
# Restore the backup:
docker exec cockroach \
cockroach sql \
--host cockroach:26257 \
--certs-dir=/certs \
--execute="RESTORE DATABASE defaultdb FROM 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"
--execute="RESTORE DATABASE defaultdb FROM 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';"