From e50dae571bee9883b26efcfba8b305701f264a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Bour=C3=A9?= Date: Thu, 24 Sep 2020 20:52:37 +0200 Subject: [PATCH] Feat/s3 (#2) --- backups.sh | 4 +++- start.sh | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backups.sh b/backups.sh index b6f7337..2facbb3 100755 --- a/backups.sh +++ b/backups.sh @@ -14,10 +14,12 @@ cd ${MYBACKUPDIR} echo "Backup running to $MYBACKUPDIR" >> /var/log/cron.log +echo "Dump users and permisions" >> /var/log/cron.log +pg_dumpall --globals-only | aws s3 cp - s3://${S3_BUCKET}/${S3_BUCKET_PREFIX}/globals.dmp + # # Loop through each pg database backing it up # -#echo "Databases to backup: ${DBLIST}" >> /var/log/cron.log for DB in ${DBLIST} do FILENAME=${MYBACKUPDIR}/${DUMPPREFIX}_${DB}.${MYDATE}.dmp diff --git a/start.sh b/start.sh index b901bb2..9b44f36 100755 --- a/start.sh +++ b/start.sh @@ -67,10 +67,16 @@ export REMOVE_BEFORE=$REMOVE_BEFORE export DBLIST=\"$DBLIST\" export S3_BUCKET=\"$S3_BUCKET\" export S3_BUCKET_PREFIX=\"$S3_BUCKET_PREFIX\" + " > /pgenv.sh + +if [ "${AWS_ACCESS_KEY_ID}" ] && [ "$AWS_SECRET_ACCESS_KEY" ]; then +echo " export AWS_ACCESS_KEY_ID=\"$AWS_ACCESS_KEY_ID\" export AWS_SECRET_ACCESS_KEY=\"$AWS_SECRET_ACCESS_KEY\" +" +fi + - " > /pgenv.sh echo "Start script running with these environment options" cat /pgenv.sh set | grep PG