My previous post made use of duply as a wrapper around duplicity, but for some reason everything started going a bit wrong, with the cause being *something* that changed in the Python boto library config, but I couldn't work out what.
The solution was to stop using duply and to use duplicity directly. There are many guides that explain how to setup duplicity to use Amazon S3 storage, so I'll not reproduce that information here (Google is your friend), but it's useful to show the script I use to initiate a backup:
export PASSPHRASE="Add your GPG passphrase here"
export AWS_ACCESS_KEY_ID="Add your AWS access key here"
export AWS_SECRET_ACCESS_KEY="Add your AWS secret access key here"
duplicity -v6 --encrypt-key AddYourGPGkeyHere \
--exclude='**/Junk/*' \
--include='**/Music/*' \
--exclude='**/Documents/temp' \
--include='**/Documents/*' \
--exclude='**/.*' \
--exclude='**/' \
--exclude='**' \
--rsync-options="--size-only" \
/base/dir/to/backup/eg/home/patrick s3://s3-eu-west-1.amazonaws.com/path/to/s3/bucket/or/dir/in/bucket
The above script sets up the authentication variables and then performs a backup of the base directory. I've split the "duplicity" invocation over several lines to make it clearer what's going on.
Note that the final three "exclude" statements will exclude everything from the backup, so it's important to add "include" statements for anything you want backing up.
In the example above, just the "Music" and "Documents" directories in the specified base directory (/base/dir/to/backup/eg/home/patrick) will be backed up, and within the "Documents" directory, the "temp" directory will be excluded.
When deciding what to include or exclude, duplicity will use the first successful include/exclude match, so it's important that the "**/Documents/temp" exclude statement comes before the "**/Documents/*" include statement.
Restoring from backup
Again, there are plenty of guides on the web describing how to do a restore. The only thing to remember is that you will need the three environment variables, shown in the above script, to be setup before performing any duplicity commands. You'll also need to include the "--encrypt-key" argument in the duplicity invocation.
Handy tip
I store my backup script, including all the passphrases and keys, in a LastPass secure note in order that I always have all details needed in the event that some kind of total disaster has occurred.
No comments:
Post a Comment