diff --git a/scripts/crdb_backup.sh b/scripts/crdb_backup.sh index 9e928160..eb87dcdb 100644 --- a/scripts/crdb_backup.sh +++ b/scripts/crdb_backup.sh @@ -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';" diff --git a/scripts/crdb_restore.sh b/scripts/crdb_restore.sh index b78b0061..4892201e 100644 --- a/scripts/crdb_restore.sh +++ b/scripts/crdb_restore.sh @@ -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';"