I mentioned HubiC in my last post, and in it i said that you could use Duplicity for backups. Well, this is how you get it to work…
First, i am using Ubuntu 14.04 (i think…). I use Ubuntu in house for a few things:
- its running Tiernan’s Comms Closet, GeekPhotographer and Tiernan’s Podcast all in house, aswell as being used to build this site. The Web Server and MySQL Server are seperated, MySQL running on Windows, web on Ubuntu… but thats a different story…
- I have a couple of proxy servers running Ubuntu also
- Other general servers running Ubuntu… dont ask, cause i cant remember what they do half the time…
So, Duplicity is a backup application. From their website:
What is it?
Duplicity backs directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server.
The duplicity package also includes the rdiffdir utility. Rdiffdir is an extension of librsync’s rdiff to directories—it can be used to produce signatures and deltas of directories as well as regular files. These signatures and deltas are in GNU tar format.
So, how do we get it working? Well, givin that i am on Ubuntu, these are the steps i needed to do:
- first, we need some credentials and API keys… If you havent signed up for HubiC Do so now… That url gets you an extra 5Gb if you sign up for free (usually 25Gb) or if you pay 1EUR a month, you get 110Gb (usually 100Gb) and 5EUR a month gets you a staggering 10TB (yup! Terabytes!).
- Login to Hubic, and in the menu go to ‘My Account’, ‘Developers’. in here, create a new application (name and URL to redirect to… http://localhost seems to work correctly). Get the Client ID and Secret ID that was given to you.
- take the contents of the following gist and replace your own details… I know, i am not a fan of sticking my password in a txt file… but it should be your local machine…
- that file should be in your home directory and should be called .hubic_credentials.
- add the duplicity PPA project (https://launchpad.net/~duplicity-team/+archive/ubuntu/ppa) to ubuntu using the add-apt-repository command (details on the link above, under the link ‘read about installing’). for me, i just called ‘sudo add-apt-repository ppa:duplicity-team/ppa’
- install duplicity by doing ‘sudo apt-get install duplicity’. Dont forget (its in the tutorial above!) to do an ‘sudo apt-get update’ first!
- When i ran that, there where a few extra Python packages to be installed, so i was asked did i want to install them… Say, yes.
- Now, to run a backup we run the following command:
duplicity ~/ cf+hubic://location
- cf+hubic is the backend to use, ~/ is the url to backup (my home directory in this case) and location is where on Hubic we want it stored. If this doesent exist, not a problem… it will create it.
- after we run this we… ahhh… i get an error:
BackendException: This backend requires the pyrax library available from Rackspace.
- right… pyrax library is from Rackspace and is available to download though pip…
- I seem to have python and a few other bits installed on this machine, so running ‘sudo pip install pyrax’ works… Your millage may vary… [eg, this is out of scope for this tutorial! your on your own!]
- Other problem… I got a load of weird and wondering errors like this:
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'SplitResult'
- I fixed these by running:
sudo pip install furl --upgrade
- FINALLY! ITS ALIVE!!! by default, it asks you for a key for the GnuPG encryption… and its all good! the first backup creates the directories, required files, etc. the next time you run the command, it will only upload changes. it will also ask for your GnuPG code you entered, so remember it!
And thats all folks! Any questions, leave them in the comments!
This site is hosted on my own ASN on AS204994. More details about that over there. I also use Vultr for transit services and HostUs for LIR Services. Check them out. You can also check some of the gear I use on a daily basis over on kit.co/tiernano. Looking for a Backup Option? Check out Backblaze and get a month free.
Leave a Reply