pleroma/aws-s3-backup/files/pleroma-s3-backup.sh
changeset 157 5e5c9e605142
parent 109 646e4b395cc8
--- a/pleroma/aws-s3-backup/files/pleroma-s3-backup.sh	Sat Jul 03 13:23:46 2021 -0500
+++ b/pleroma/aws-s3-backup/files/pleroma-s3-backup.sh	Sat Jul 03 13:24:52 2021 -0500
@@ -1,11 +1,10 @@
 #!/bin/bash
 
 INSTANCE=$1
-DATE=`date --iso-8601`
 
 BUCKET="pleroma-${INSTANCE//_/-}-backup"
 BACKUP_DIR="/tmp/s3-backup/$BUCKET"
-BACKUP_TAR="/tmp/s3-backup/$BUCKET-$DATE.tgz"
+BACKUP_TAR="/tmp/s3-backup/$BUCKET.tgz"
 
 DB_NAME="pleroma_$INSTANCE"
 CONFIG="/etc/pleroma/$INSTANCE.config.exs"
@@ -23,6 +22,8 @@
 
 tar -zc -f $BACKUP_TAR $BACKUP_DIR
 aws s3 mb "s3://$BUCKET/"
+aws s3api put-bucket-versioning --bucket "$BUCKET" --versioning-configuration Status=Enabled
+aws s3api put-bucket-lifecycle-configuration --bucket "$BUCKET" --lifecycle-configuration "file:///usr/local/share/pleroma-s3-backup-lifecycle.json"
 aws s3 cp $BACKUP_TAR "s3://$BUCKET/"
 
 rm $BACKUP_TAR