Skip to main content
Duplicity
Last update:

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 and uploads it to a local or remote file server, and encrypts data using the GnuPG utility.

Customize Duplicity

  1. Configure access.
  2. Install client.
  3. Create Duplicity Configuration.

1. Configure access

Access can be configured by a user with role Account Owner or User Administrator.

Create a service user with a role with access to object storage, see Role Model Access for details.

2. Install the client

  1. Open the terminal.

  2. Set Duplicity:

    sudo apt-get install duplicity
  3. Install the python-swiftclient and librsync packages:

    sudo apt-get install python-swiftclient
    sudo apt-get install librsync-dev
  4. Install the Bazaar version control system and download the swiftbackend:

    sudo apt-get install bzr
    bzr branch lp:~mhu-s/duplicity/swiftbackend
  5. Set swiftbackend:

    cd swiftbackend && sudo python dist/setup.py install

3. Customize Duplicity

  1. In a text editor, add a script for the backup:

    # Authorization data for connection to the storage
    SWIFT_PASSWORD="<password>"
    SWIFT_AUTHVERSION=2
    SWIFT_TENANTNAME="<username>"
    SWIFT_AUTHURL=https://swift.ru-1.storage.selcloud.ru
    SWIFT_USERNAME="<username>"
    # Performing archiving
    duplicity <path> swift://<container_name>

    # Clearing authorization data for security
    unset SWIFT_PASSWORD
    unset SWIFT_AUTHVERSION
    unset SWIFT_TENANTNAME
    unset SWIFT_AUTHURL
    unset SWIFT_USERNAME

    Specify:

    • <password> — service user password. If you forget your password, create a new one;
    • <username> — service user name;
    • ru-1 — pool, which hosts the object store;
    • <path> is the path to the folder on the local machine;
    • <container_name> is the name of the container.
  2. Save the file and make it executable:

    chmod +x <file_name>

    Specify <file_name> as the file name.

  3. Start executing commands from the file:

    ./<file_name>
  4. Specify a code word to access the files. The backup will start. The statistics will be displayed in the console.

  5. To download an encrypted backup from the repository to your local machine, copy the script from step 1.

  6. In the script, replace the command duplicity <path> swift://<container_name> with duplicity swift://<container_name> <path>.

  7. Save the script to a file named restore.sh and make it executable. When the ./restore.sh command is executed, a code word will be requested. After entering the code word, all files from the backup will be downloaded to the specified directory on the local machine.