|
@ -43,6 +43,12 @@ if [ "${POSTGRES_PASSWORD}" = "**None**" ]; then |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "${S3_ENDPOINT}" == "**None**" ]; then |
|
|
|
|
|
AWS_ARGS="" |
|
|
|
|
|
else |
|
|
|
|
|
AWS_ARGS="--endpoint-url ${S3_ENDPOINT}" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
# env vars needed for aws tools |
|
|
# env vars needed for aws tools |
|
|
export AWS_ACCESS_KEY_ID=$S3_ACCESS_KEY_ID |
|
|
export AWS_ACCESS_KEY_ID=$S3_ACCESS_KEY_ID |
|
|
export AWS_SECRET_ACCESS_KEY=$S3_SECRET_ACCESS_KEY |
|
|
export AWS_SECRET_ACCESS_KEY=$S3_SECRET_ACCESS_KEY |
|
@ -57,6 +63,6 @@ pg_dump $POSTGRES_HOST_OPTS $POSTGRES_DATABASE | gzip > dump.sql.gz |
|
|
|
|
|
|
|
|
echo "Uploading dump to $S3_BUCKET" |
|
|
echo "Uploading dump to $S3_BUCKET" |
|
|
|
|
|
|
|
|
cat dump.sql.gz | aws s3 cp - s3://$S3_BUCKET/$S3_PREFIX/${POSTGRES_DATABASE}_$(date +"%Y-%m-%dT%H:%M:%SZ").sql.gz || exit 2 |
|
|
|
|
|
|
|
|
cat dump.sql.gz | aws $AWS_ARGS s3 cp - s3://$S3_BUCKET/$S3_PREFIX/${POSTGRES_DATABASE}_$(date +"%Y-%m-%dT%H:%M:%SZ").sql.gz || exit 2 |
|
|
|
|
|
|
|
|
echo "SQL backup uploaded successfully" |
|
|
echo "SQL backup uploaded successfully" |