Duplicity
Duplicity is a command-line interface for backups. Duplicity supports SSH/SCP, FTP, HSI, WebDAV, Tahoe-LAFS, and Amazon S3 protocols to connect to a file server, archives data, uploads it to a local or remote file server, and encrypts data using the GnuPG utility.
Configure Duplicity
1. Configure S3 access
Access can be configured by the Account Owner or a user with the iam.admin role.
- Create a service user with a role with access to S3. If you use a service user with the
s3.user,object_storage_user, ors3.bucket.userrole, an access policy must be configured in the bucket, and its rules must allow access to this user. - Issue an S3 key to the user.
2. Install the client
Ubuntu
-
Open the terminal.
-
Install Duplicity:
sudo apt-get install duplicity -
Install the
python-swiftclientandlibrsyncpackages:sudo apt-get install python-swiftclientsudo apt-get install librsync-dev -
Install the Bazaar version control system and download
swiftbackend:sudo apt-get install bzrbzr branch lp:~mhu-s/duplicity/swiftbackend -
Install
swiftbackend:cd swiftbackend && sudo python dist/setup.py install
3. Configure Duplicity settings
5.1. Copy the script from step 1.
S3
-
Create a file with the backup script:
export SWIFT_PASSWORD=<password>export SWIFT_AUTHVERSION=3export SWIFT_TENANTNAME=<project_name>export SWIFT_AUTHURL="https://cloud.api.selcloud.ru/identity"export SWIFT_REGIONNAME=<pool>export SWIFT_USERNAME=<username>export SWIFT_USER_DOMAIN_NAME=<account_id>export SWIFT_PROJECT_DOMAIN_NAME=<account_id>duplicity <path> swift://<bucket_name>unset SWIFT_PASSWORDunset SWIFT_AUTHVERSIONunset SWIFT_TENANTNAMEunset SWIFT_AUTHURLunset SWIFT_USERNAMESpecify:
<password>— service user password. If you forgot the password, create a new one;<project_name>— project name;<pool>— pool where S3 is located;<username>— service user name;<account_id>— Control panel account ID, can be found in the control panel in the upper-right corner;<path>— path to the folder on the local machine;<bucket_name>— bucket name.
-
Make the file executable:
chmod +x <file_name>Specify
<file_name>— name of the script file. -
Run the script:
./<file_name> -
Enter the passphrase. The backup will start, and statistics will be displayed in the console.
-
Optional: to download an encrypted backup from storage to a local machine:
5.1. Copy the script from step 1.
5.2. In the script, replace the
duplicity <path> swift://<bucket_name>command withduplicity swift://<bucket_name> <path>.5.3. Save the script to a file named
restore.sh.5.4. Make the file executable:
chmod +x restore.sh5.5. Run the script:
./restore.sh5.6. Enter the passphrase. All files from the backup will be downloaded to the specified directory on the local machine.