Backup your SVN/CVS Repository…

Did you ever think about what happens if your office/server location is on fire? We all do backup (hopefully) our data frequently - but let’s be honest - most of the time we simply store the data on some other machine located in the same place. In some cases this is not enough - therefore you must store your data in some other physical location.

In my past companies we solved this usually by storing a CD somewhere in a bank case - every 6 months…. Luckily nothing bad happend to our Servers in the past - but you can never know. And I’ve seen this happening recently (no I won’t tell you where) and it’s hell of a work to merge all the CVS copies on the developer laptops back - and for sure some history was lost.

Here at swoodoo we do have our main SVN Server running in a VMWare Image - and this Image is fully backed up frequently - in the same location. Therefore I was searching for a easy solution - and do not underestimate the word “easy”! I’ve seen so many cool backup solutions which slowly disappeared over the time as people did not like to use it - or simply did not understand fully how they must use them.

Fortunately there is a perfect solution for lazy people like me. The “Gigabank“. It’s a WORM storage over the Internet somewhere locked away in switzerland. This data is safe and won’t be deleted or removed as this is technically impossible.

Background infos:

Your files are protected in the Gigabank using the unrivaled, patent pending FAST LTA WORM technology. WORM stands for write once, read many and that means your files cannot be deleted or altered accidentally by FAST LTA or by yourself. All files are also secured against attacks from viruses or other kind of malware and hackers.

FAST LTA has no insight into your files, and we make sure no-one else has access by storing all data in Switzerland, in modern data centers run by Swisscom…

Gigabank uses a combination of AES 256 encryption and SSL secure data transmission to ensure the safety of data.When a client has to transfer data to the LTA-CH1, it connects using a secure SSL (1024bit RSA key exchange, 128 bit RC4 stream cipher and 160 bit SHA-1 integrity checking) connection to transfer the data. Signed SSL certificates are used to verify server integrity.
Gigabank uses AES 256 end-to-end encryption. All data is encrypted before it leaves the client system. The data remains continuously encrypted while in storage and during over-the-wire transmissions. Decryption following a restore only occurs on the client system when the encryption key holder enters the encryption key. The encryption key is only known by the client.It will never be transmitted over the Internet and it is never stored on any FAST server.

For more info about the technical details point your browser here.

Enough blabla let’s see how it works.

Create your account here - 1 GByte is for free, for more you need to pay. And please note - nothing is deleted - so each backup will add up to the quota.

Now let’s setup a short bash script which dump’s the repo, zip it and then let’s upload the file automatically. Zipping is VERY important otherwise you will have a massive amount of files in your storage which might screw up at least the browser interface ;)

Our script could look like this:

#!/bin/sh

svnadmin dump /var/svn/swoodoo > /backup/swoodoo-goa.dump &&
tar -czf /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.tgz /backup/swoodoo-goa.dump &&
md5sum /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.tgz > /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.md5 &&
gbcopy –source /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.tgz -u $1 -p $2 &&
gbcopy –source /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.md5 -u $1 -p $2 &&
rm /home/swoodoo/svn-backup/swoodoo-goa-`date +%F`.tgz &&
rm /backup/swoodoo-goa.dump

So what do we do here ? First dump, then zip (tar) it, set a good filename and upload using gbcopy which is the linux commandline tool from Gigabank. Additionally for security reasons we store the md5 key separate - and finally, cleanup.

That’s it. Add a cron job to be executed every 14days or so - and you will sleep better ;)