|
|
@ -43,6 +43,12 @@ if [ "${POSTGRES_PASSWORD}" = "**None**" ]; then |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "${S3_ENDPOINT}" == "**None**" ]; then |
|
|
|
AWS_ARGS="" |
|
|
|
else |
|
|
|
AWS_ARGS="--endpoint-url ${S3_ENDPOINT}" |
|
|
|
fi |
|
|
|
|
|
|
|
# env vars needed for aws tools |
|
|
|
export AWS_ACCESS_KEY_ID=$S3_ACCESS_KEY_ID |
|
|
|
export AWS_SECRET_ACCESS_KEY=$S3_SECRET_ACCESS_KEY |
|
|
@ -53,11 +59,11 @@ POSTGRES_HOST_OPTS="-h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER" |
|
|
|
|
|
|
|
echo "Finding latest backup" |
|
|
|
|
|
|
|
LATEST_BACKUP=$(aws s3 ls s3://$S3_BUCKET/$S3_PREFIX/ | sort | tail -n 1 | awk '{ print $4 }') |
|
|
|
LATEST_BACKUP=$(aws $AWS_ARGS s3 ls s3://$S3_BUCKET/$S3_PREFIX/ | sort | tail -n 1 | awk '{ print $4 }') |
|
|
|
|
|
|
|
echo "Fetching ${LATEST_BACKUP} from S3" |
|
|
|
|
|
|
|
aws s3 cp s3://$S3_BUCKET/$S3_PREFIX/${LATEST_BACKUP} dump.sql.gz |
|
|
|
aws $AWS_ARGS s3 cp s3://$S3_BUCKET/$S3_PREFIX/${LATEST_BACKUP} dump.sql.gz |
|
|
|
gzip -d dump.sql.gz |
|
|
|
|
|
|
|
if [ "${DROP_PUBLIC}" == "yes" ]; then |
|
|
|