Skip to content

Commit

Permalink
Exclude resource_v4 objects from backups
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnavarro committed Nov 1, 2024
1 parent f444069 commit a1744a4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.0.4-20241101 JP
- Exclude resource_v4 objects from backups

v1.0.3-20241101 JP
- Backup the development Service Index database also
- Backup the development Warehouse database also
Expand Down
32 changes: 32 additions & 0 deletions sbin/database_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,48 @@ DATE=`date +'%s'`

DUMPNAME=django.${DBNAME1}.dump.${DATE}
pg_dump -h ${DBHOST1} -U ${DBUSER1} -n public -d ${DBNAME1} \
--exclude-table=public.resource_v4_resourcev4 \
--exclude-table=public.resource_v4_resourcev4local \
--exclude-table=public.resource_v4_resourcev4relation \
>${BACKUP_DIR}/${DUMPNAME}
gzip -9 ${BACKUP_DIR}/${DUMPNAME}
aws s3 cp ${BACKUP_DIR}/${DUMPNAME}.gz ${S3DIR} --only-show-errors --profile newbackup

# Minimum backup without history for development environments
MINDUMPNAME=django.${DBNAME1}.mindump.${DATE}
pg_dump -h ${DBHOST1} -U ${DBUSER1} -n public -d ${DBNAME1} \
--exclude-table=public.resource_v4_resourcev4 \
--exclude-table=public.resource_v4_resourcev4local \
--exclude-table=public.resource_v4_resourcev4relation \
--exclude-table=public.glue2_entityhistory \
--exclude-table=public.warehouse_state_processingerror \
>${BACKUP_DIR}/${MINDUMPNAME}
gzip -9 ${BACKUP_DIR}/${MINDUMPNAME}
aws s3 cp ${BACKUP_DIR}/${MINDUMPNAME}.gz ${S3DIR} --only-show-errors --profile newbackup

###

DUMPNAME=django.${DBNAME2}.dump.${DATE}
pg_dump -h ${DBHOST2} -U ${DBUSER2} -n public -d ${DBNAME2} \
--exclude-table=public.resource_v4_resourcev4 \
--exclude-table=public.resource_v4_resourcev4local \
--exclude-table=public.resource_v4_resourcev4relation \
>${BACKUP_DIR}/${DUMPNAME}
gzip -9 ${BACKUP_DIR}/${DUMPNAME}
aws s3 cp ${BACKUP_DIR}/${DUMPNAME}.gz ${S3DIR} --only-show-errors --profile newbackup

# Minimum backup without history for development environments
MINDUMPNAME=django.${DBNAME2}.mindump.${DATE}
pg_dump -h ${DBHOST2} -U ${DBUSER2} -n public -d ${DBNAME2} \
--exclude-table=public.resource_v4_resourcev4 \
--exclude-table=public.resource_v4_resourcev4local \
--exclude-table=public.resource_v4_resourcev4relation \
--exclude-table=public.glue2_entityhistory \
--exclude-table=public.warehouse_state_processingerror \
>${BACKUP_DIR}/${MINDUMPNAME}
gzip -9 ${BACKUP_DIR}/${MINDUMPNAME}
aws s3 cp ${BACKUP_DIR}/${MINDUMPNAME}.gz ${S3DIR} --only-show-errors --profile newbackup

#aws s3 ls s3://xci.xsede.org/info.xsede.org/rds.backup/\*.${DATE} --profile newbackup

#Cleanup backups older than 2 days
Expand Down

0 comments on commit a1744a4

Please sign in to comment.