# HG changeset patch # User Luke Hoersten # Date 1625337482 18000 # Node ID 1b7ccb72916469a5b5b598711e403af87e77581c # Parent 5e5c9e605142d81508285603ba95961f1509716f Updated minecraft backup for lifecycles. diff -r 5e5c9e605142 -r 1b7ccb729164 mercurial/aws-s3-backup/files/mercurial-s3-backup-lifecycle.json --- a/mercurial/aws-s3-backup/files/mercurial-s3-backup-lifecycle.json Sat Jul 03 13:24:52 2021 -0500 +++ b/mercurial/aws-s3-backup/files/mercurial-s3-backup-lifecycle.json Sat Jul 03 13:38:02 2021 -0500 @@ -1,7 +1,7 @@ { "Rules": [ { - "ID": "pleroma-expiration", + "ID": "expiration", "Filter": {}, "Status": "Enabled", "NoncurrentVersionExpiration": { diff -r 5e5c9e605142 -r 1b7ccb729164 minecraft/aws-s3-backup/files/minecraft-s3-backup-lifecycle.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/minecraft/aws-s3-backup/files/minecraft-s3-backup-lifecycle.json Sat Jul 03 13:38:02 2021 -0500 @@ -0,0 +1,12 @@ +{ + "Rules": [ + { + "ID": "expiration", + "Filter": {}, + "Status": "Enabled", + "NoncurrentVersionExpiration": { + "NoncurrentDays": 5 + } + } + ] +} diff -r 5e5c9e605142 -r 1b7ccb729164 minecraft/aws-s3-backup/files/minecraft-s3-backup.sh --- a/minecraft/aws-s3-backup/files/minecraft-s3-backup.sh Sat Jul 03 13:24:52 2021 -0500 +++ b/minecraft/aws-s3-backup/files/minecraft-s3-backup.sh Sat Jul 03 13:38:02 2021 -0500 @@ -1,12 +1,13 @@ #!/bin/bash BUCKET=$1 -DATE=`date --iso-8601` BACKUP_DIR=$2 -BACKUP_TAR="/tmp/$BUCKET-$DATE.tgz" +BACKUP_TAR="/tmp/$BUCKET.tgz" 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/minecraft-s3-backup-lifecycle.json" aws s3 cp $BACKUP_TAR "s3://$BUCKET/" rm $BACKUP_TAR diff -r 5e5c9e605142 -r 1b7ccb729164 minecraft/aws-s3-backup/tasks/main.yaml --- a/minecraft/aws-s3-backup/tasks/main.yaml Sat Jul 03 13:24:52 2021 -0500 +++ b/minecraft/aws-s3-backup/tasks/main.yaml Sat Jul 03 13:38:02 2021 -0500 @@ -7,6 +7,13 @@ dest: "/usr/local/bin/minecraft-s3-backup.sh" mode: "0755" +- name: create s3 backup lifesycle json file + become: yes + copy: + src: "minecraft-s3-backup-lifecycle.json" + dest: "/usr/local/share/minecraft-s3-backup-lifecycle.json" + mode: "0755" + - name: configure minecraft s3 backup systemd service become: yes template: diff -r 5e5c9e605142 -r 1b7ccb729164 pleroma/aws-s3-backup/files/pleroma-lifecycle.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pleroma/aws-s3-backup/files/pleroma-lifecycle.json Sat Jul 03 13:38:02 2021 -0500 @@ -0,0 +1,12 @@ +{ + "Rules": [ + { + "ID": "expiration", + "Filter": {}, + "Status": "Enabled", + "NoncurrentVersionExpiration": { + "NoncurrentDays": 30 + } + } + ] +}