backup

Duplicity

Backup an encrypted directory on s3

#!/usr/bin/env sh

# Your GPG key
GPG_KEY=<the-gpg-key>

SOURCE=/
# The S3 destination followed by bucket name
DEST="s3://the-bucket"

alias duplicity="docker run --rm  --user root \
    -e AWS_ACCESS_KEY_ID=<id> \
    -e AWS_SECRET_ACCESS_KEY=<key> \
    -e PASSPHRASE=<gpg pass> \
    -v /root/.cache:/home/duplicity/.cache/duplicity \
    -v /root/.gnupg:/home/duplicity/.gnupg \
    -v /:/data:ro \
    wernight/duplicity \
    duplicity"


duplicity \
    --full-if-older-than 1M \
    --encrypt-key=${GPG_KEY} \
    --sign-key=${GPG_KEY} \
    --allow-source-mismatch \
    --s3-use-glacier \
    --s3-region-name=<s3-region> \
    --s3-endpoint-url=<s3-endpoint>> \
    --include=/opt \
    --exclude=/** \
    ${SOURCE} ${DEST}

duplicity remove-all-but-n-full 1 --force  ${DEST}

Restore the backup

This will restore the lastest state of the backup. Apparently, it is also possible to play with time --restore-time.

SOURCE="s3://the-bucket"
DEST=/mnt/backup/mailu

duplicity \
    restore \
    --encrypt-key=${GPG_KEY} \
    --sign-key=${GPG_KEY} \
    --s3-region-name=<s3-region> \
    --s3-endpoint-url=<s3-endpoint>> \
     ${SOURCE} ${DEST}

React ?

This page was last modified: