ajctrl
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
4 deletions
-
postgres-backup-s3/backup.sh
|
|
@ -94,7 +94,10 @@ else |
|
|
|
|
|
|
|
SRC_FILE=dump.sql.gz |
|
|
|
DEST_FILE=${DB}_$(date +"%Y-%m-%dT%H:%M:%SZ").sql.gz |
|
|
|
|
|
|
|
|
|
|
|
echo "Creating dump of ${DB} database from ${POSTGRES_HOST}..." |
|
|
|
pg_dump $POSTGRES_HOST_OPTS $DB | gzip > $SRC_FILE |
|
|
|
|
|
|
|
if [ "${ENCRYPTION_PASSWORD}" != "**None**" ]; then |
|
|
|
echo "Encrypting ${SRC_FILE}" |
|
|
|
openssl enc -aes-256-cbc -in $SRC_FILE -out ${SRC_FILE}.enc -k $ENCRYPTION_PASSWORD |
|
|
@ -106,9 +109,6 @@ else |
|
|
|
DEST_FILE="${DEST_FILE}.enc" |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Creating dump of ${DB} database from ${POSTGRES_HOST}..." |
|
|
|
pg_dump $POSTGRES_HOST_OPTS $DB | gzip > $SRC_FILE |
|
|
|
|
|
|
|
echo "Uploading dump to $S3_BUCKET" |
|
|
|
cat $SRC_FILE | aws $AWS_ARGS s3 cp - "s3://${S3_BUCKET}${S3_PREFIX}${DEST_FILE}" || exit 2 |
|
|
|
|
|
|
|