Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic setup for implementing S3 support #28

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _Bring back life form. Priority One. All other priorities rescinded._
- Percona 5.5+
- Percona Xtrabackup 2.0.1 or later
- Ample disk space (even with compression backups are only 2:1 ratio)
- [S3tools](http://s3tools.org/s3cmd) installed and configured

#### Usage

Expand Down
3 changes: 3 additions & 0 deletions files/conf/surrogate.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# surrogate
# config file

# define the name of your S3 bucket
s3bucket=

# define your basedir or everything breaks
my_root=/usr/local/lib/surrogate

Expand Down
14 changes: 13 additions & 1 deletion files/lib/actions/full
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,16 @@ function perform_action() {
echo $full_backup_path > $backup_directory/.digest
echo "status=0" > $backup_directory/backup.status
echo "Backup Completed OK!"
}

if tail $logfile_f -n 1 | grep completed.OK
then
echo "Creating archive for S3.."
tar -czf /tmp/$(basename ${full_backup_path}).tar.gz ${last_backup}

echo "Copying archive to S3"
s3cmd put -e -f /tmp/$(basename ${full_backup_path}).tar.gz s3://${s3bucket}$(dirname ${full_backup_path})/

echo "Removing cached archive"
rm /tmp/$(basename ${full_backup_path}).tar.gz
fi
}
12 changes: 12 additions & 0 deletions files/lib/actions/inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ function perform_action() {
echo $inc_backup_path >> $backup_directory/.digest
echo "status=0" > $backup_directory/backup.status
echo "Backup Completed OK!"

if tail $logfile_i -n 1 | grep completed.OK
then
echo "Creating archive for S3.."
tar -czf /tmp/$(basename ${inc_backup_path}).tar.gz ${inc_backup_path}

echo "Copying archive to S3"
s3cmd put -e -f /tmp/$(basename ${inc_backup_path}).tar.gz s3://${s3bucket}$(dirname ${inc_backup_path})/

echo "Removing cached archive"
rm /tmp/$(basename ${inc_backup_path}).tar.gz
fi
}

# fin