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.

9 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 May 17, 2013 at 10:08 pm | Permalink

    J’ai quarante et unA .
    Je porte le joli nom de Angelique.
    Je suis pilote de ligne . Si je suis parfois farceuse, ce n’est pas un défaut ?

  3. Posted May 18, 2013 at 8:28 am | Permalink

    Excellent blog here! Also your website loads up fast! What web host are you using?
    Can I get your affiliate link to your host? I wish my web site loaded up as quickly as yours
    lol

  4. Posted May 18, 2013 at 3:03 pm | Permalink

    Un sourire resplendissant ça se reprenne.

    Votre dentiste est autorise a devenir un vrai
    seducteur.
    Pour les personnes qui ne veulent pas voir la preuve du
    temps sur ses dents,
    il est conseille de suivre des therapies
    esthetique dentaire 93.
    Pour le cas des facettes en ceramique elles sont employees pour recouvrir l’imperfection.

    Au moyen des facettes, on se plonge dans le secteur
    de la chirurgie esthetique.
    Le travail exige une prudence et le cout est assez consequent.

    les memes comme les faux ongles,
    fixe en hauteur des dents et recouvrent les anomalies, pareil que les dents felees.

    Cette technique est aussi utilise pour faire disparaitre l’espace constate sur les dents de devant.

    La majorite du traitement se confectionne en une
    unique campagne et le traitement se preserve approximativement dix ans.

    Pour ce qui souhaite un sourire resplendissant, souligne par un email absolument blanche, ci-apres les recommandations
    Les techniques et technologies a present continu de s’améliorer tout en protegeant votre dentition.

    Des appreils de blanchiment chez soi ainsi que des soins en
    dentisterie sont des techniques qui fonctionnent.
    L’acceptation des soins orthodontiques est penibles a accepter
    aussi bien pour les jeunes que les grandes
    personnes.
    Cependant l’aboutissement de ce genre de therapies ne sont plus a
    proner

  5. Posted May 18, 2013 at 11:38 pm | Permalink

    Generally I don’t read post on blogs, however I would like to say that this write-up very compelled me to try and do so! Your writing style has been surprised me. Thank you, very great article.

  6. Posted May 19, 2013 at 1:24 am | Permalink

    Hello! I could have sworn I’ve visited your blog before but after browsing through some of the posts I realized it’s new
    to me. Nonetheless, I’m certainly delighted I stumbled upon it and I’ll be book-marking it and checking back regularly!

  7. Posted May 21, 2013 at 1:08 am | Permalink

    And in a morgue. When Disney announced a recall of the stereotypes when comparing the sexes, there seems to appear that way.
    2.Goodfellas – This 1995 film is intense, and tackles such a good movie
    that really received a bad wrap, and as far
    as a parody of James Bond type spy films. Gender is defined
    as a con in order to come out, so I am sure in the word
    SEX just appear in the library.

  8. Posted May 21, 2013 at 11:10 pm | Permalink

    Right here is the right site for anybody who hopes to understand this
    topic. You know so much its almost tough to argue with you (not that I really will need to…HaHa).

    You certainly put a new spin on a topic that’s been discussed for decades. Wonderful stuff, just great!

  9. Posted May 23, 2013 at 3:22 am | Permalink

    Blop, Je suis une jeune femme de 26 années .
    Mes parents m’ont appellée Gallia et j’aime beaucoup
    ce prénom.
    Mon métier, ambulancière . On dit régulièrement de moi que je
    semble geignarde.


Post a Comment

Required fields are marked *

*
*

Follow

Get every new post delivered to your Inbox.

Join 41 other followers

%d bloggers like this: