Simple backup and recovery with the ‘snapshot’ command

Backup, disaster recovery and migrations of Gitorious has been a somewhat manual process up till now. Though all you really need to do is to dump the mysql database and save the repository folders, setting up and performing those backup tasks has been an ad-hoc task for each installation. Furthermore any disaster recovery work has been quite the forensic process.

To address this we’ve added convenience commands for simple snapshots and restore of Gitorious installations. The snapshot/restore commands are available on the Gitorious mainline now, and are present if you update to the newly released v2.3.

Using the snapshot/restore commands

If you’re on a recent version of Gitorious you’ll find two new commands under the scripts directory: scripts/snapshot and scripts/restore. Each of them takes a single parameter: the path of the tar file you want your Gitorious installation backed up to, or restored from. Note that you’ll need to launch the commands from the root directory of your Gitorious install (the directory where you find your Rakefile, Gemfile, config directory etc).

How to perform snapshots in older Gitorious versions

It’s fairly straightforward to add these new snapshot|restore commands to an older Gitorious instance a well: you only need to clone the latest version of the Gitorious code, and copy the following files to the same locations in your current, older installation:

script/restore

script/snapshot  

lib/tasks/backup.rake

Assumptions and caveats

  • For disaster recovery, you’ll first need to get a functional installation of Gitorious up and running, after which you can run the restore command to bring in your data again. Note that the snapshot tarball also includes the configuration files from your old Gitorious installation. They are not automatically copied into your new installation, but can be used to recreate your old config in your new Gitorious installation (useful if your previous Gitorious installation had custom LDAP integration, custom hooks etc).
  • Snapshots will not preserve any custom code or theming you may have added to your Gitorious installation: any such local modifications will need to be backed up and restored separately
  • Some operations in Gitorious are asynchronous, meaning they are performed by publishing/consuming messages on a queue. The snapshot/restore commands don’t currently capture or restore the state of the queue, so any current work on the queue will be lost.
  • The snapshot/recovery commands assume that you have the time and disk-space to slurp down all your hosted repos into a local tarball. Sites with huge amounts of git repository data may therefore need more custom backup schemes.
  • The restore command assumes that no breaking changes have happened between the version you snapshot from, and the version you restore your data into. In the future, major Gitorious version jumps may necessitate a more manual restore procedure due to changes in configurations, db schema, folder structure etc.

Usage scenarios

The snapshot|restore commands are useful for multiple tasks beyond just standard backups.

Backup and disaster recovery

Run periodic backups, for instance via cron. Execute the snapshot command, for example like this script/snapshot /tmp/todays-snapshot.tar. Transfer the newly created tarball to another server, offsite location or something like Amazon S3.

If disaster strikes on your Gitorious installation, install a new instance of Gitorious, then run script/restore todays-snapshot.tar to restore your old state in the new installation.

Migrating

The same procedure is useful if you just need to move or clone your Gitorious state from one server to another. Snapshot the old one, copy the tarball file over to the other installation and restore there. Simple.

Upgrading

Different scenario, same procedure: if you need to upgrade from an older version of Gitorious and don’t want to bother with carefully upgrading your Gitorious instance across multiple versions, you can simply snapshot the state of your old Gitorious site, install a fresh new Gitorious instance and just restore your state there.

Snapshots and rollbacks for development and testing

If you’re a developer extending, customizing or developing new features for Gitorious, you can use the snapshot|restore commands to simply setting up and restoring multiple standard database/repository states in order to simplify testing.

Let us know if you hit any snags

We’ve been testing and using these features internally at Gitorious AS for a while so they should be reliable by now, but do let us know if you find any issues.

19 Comments

  1. Posted December 20, 2012 at 3:55 am | Permalink

    “perform snapshots in older Gitorious versions”
    I did as your suggest, but get error message “: No such file or directory” when running snapshot command

  2. Posted June 13, 2013 at 3:52 pm | Permalink

    hey there and thank you for your information –
    I have certainly picked up something new from right here.
    I did however expertise several technical issues using this web
    site, since I experienced to reload the website many times previous to I could get it
    to load correctly. I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will sometimes affect your placement in google and can damage your quality score if advertising and marketing with Adwords. Well I’m adding this RSS to my
    email and can look out for much more of your respective interesting content.
    Ensure that you update this again soon.

  3. Posted June 13, 2013 at 9:23 pm | Permalink

    salut,hello,ça roule ? Je suis agée de trente-neuf ans !

    Je porte le joli nom de Sabine.
    Mon occupation principale, conductrice de travaux . Est-ce un défaut que d’être une vraie mère poule ?

  4. Posted June 14, 2013 at 2:20 am | Permalink

    I used to be recommended this blog by my cousin.
    I’m no longer sure whether or not this submit is written by means of him as nobody else recognise such exact approximately my difficulty. You’re incredible!
    Thanks!

  5. Posted June 14, 2013 at 6:30 am | Permalink

    When you are on the roads near to car drivers, be aware
    of your surroundings; and presuppose that no driver sees you.
    Lots of coupon web-sites have special partnerships with many dining establishments and other
    businesses, so some provides are solely uncovered
    on the web. Apply some oil on your palms before you firmly grip on her shoulders with your thumbs
    press on her upper back.

  6. Posted June 14, 2013 at 11:04 pm | Permalink

    An intriguing discussion is definitely worth comment.
    I do think that you need to publish more
    on this subject, it might not be a taboo subject but typically
    people do not speak about such issues. To the next!

    Cheers!!

  7. Posted June 15, 2013 at 4:22 am | Permalink

    you’re in point of fact a excellent webmaster. The site loading pace is incredible. It kind of feels that you are doing any unique trick. Moreover, The contents are masterpiece. you have performed a fantastic job in this topic!

  8. Posted June 15, 2013 at 6:33 pm | Permalink

    I was suggested this website by my cousin. I am not sure whether
    this post is written by him as nobody else know such detailed about my trouble.
    You are wonderful! Thanks!

  9. http://pinterest.
    Posted June 15, 2013 at 6:38 pm | Permalink

    Magnificent beat ! I would like to apprentice even as you amend your site, how can i subscribe for a weblog website?
    The account aided me a appropriate deal. I have been tiny bit familiar of this your broadcast offered vibrant transparent idea

  10. Posted June 16, 2013 at 12:49 pm | Permalink

    La principale question qui se pose avant de realiser un
    voyage est quels genres de bagages on va emmener ?
    Un choix qui parait aise mais quand le temps de faire les bagages arrive, on s’aperçoit qu’il est complique de trouver la valise adequate surtout en cas d’un long voyage.
    Il existe plusieurs moyen de trouver ces bagages sans faire trop d’effort
    ni de depenses.
    La vente en ligne pour bagages pas chers s’accroit de plus en plus.

    De plus, differents choix de tarif et de qualites sont offerts.

    On peut distinguer diverses marques sur ces boutiques, Samsonite, Tumi, Little Marcel et autres.

    Les prix sont moins chers a cause de la competition.
    Ces boutiques en ligne offrent, presque tout le temps, des prix inhabituels et
    font des promotions.
    Ces boutiques en ligne sont, de nos jours, le bon moyen de bien ordonner
    un sejour.

    Pour un voyage d’affaire, un long ou court sejour, ces boutiques en ligne sont toujours capables de repondre a nos attentes.
    Par exemple la boutique en ligne Bagage Bagage, Mesbagages et autres qui offrent plusieurs types de bagages de toutes dimensions et de differentes marques.

    Bref, chacun a son choix car il y a ceux qui restent amoureux du shopping et choisissent de faire directement les magasins.
    Pour une facilite d’achat, ces boutiques ont ete crees.
    Il faut quand meme noter que le nombre d’acheteurs sur internet s’accroit de plus en plus avec le temps.

  11. Posted June 16, 2013 at 10:08 pm | Permalink

    bonjour Ici Adélaïde
    Je suis une femme de trente-cinq printemps .

    Je voudrais devenir secrétaire . Il est dit que je suis un phénomène.

  12. Posted June 17, 2013 at 9:33 am | Permalink

    Hmm….impressive article and articles here.

    These material on this web site are actually interesting!
    Any specific Feed on this web site? :-) I had been researching for often new material to do with skin care step program.

  13. Posted June 17, 2013 at 3:17 pm | Permalink

    hey ! Je suis une jeune fille de 35 piges !
    Mon nom est Natalie.
    je suis en ce moment des études de scénariste .

    Mon naturel est plutôt enjoué.

  14. Posted June 17, 2013 at 5:40 pm | Permalink

    Je suis agée de trente ans .
    Mes parents m’ont appellée Pansy et j’aime beaucoup ce prénom.

    Je voudrais être chargée de communication . Il est dit que je parais taciturne.

  15. Posted June 18, 2013 at 4:46 am | Permalink

    If you would like to improve your familiarity just keep visiting
    this site and be updated with the most up-to-date news posted
    here.

  16. Posted June 18, 2013 at 5:13 am | Permalink

    If some one wishes expert view about blogging after that i advise him/her to go to see this weblog, Keep up the pleasant work.

  17. Posted June 18, 2013 at 9:17 am | Permalink

    Salut la compagnie, je suis Magnolia
    J’ai 44A .
    Je bosse comme accompagnatrice de tourisme ! Il est dit de moi que je suis curieuse.

  18. Posted June 19, 2013 at 1:02 am | Permalink

    bonjour Ici Auda
    Je suis une fille de 40 berges , et j’assume totalement .
    Ce que je fais dans la vie, accessoiriste de spectacles . Est-ce un défaut que d’être attentionnée ?

  19. Posted June 19, 2013 at 11:14 am | Permalink

    Je suis une jeune femme de trente et un printemps .
    Je m’appelle Fanette.
    Ce que je fais de beau dans la vie, agent de change . Il est dit souvent que je semble farceuse.


Post a Comment

Required fields are marked *

*
*

Follow

Get every new post delivered to your Inbox.

Join 43 other followers

%d bloggers like this: