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.

35 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. John
    Posted July 3, 2013 at 8:32 pm | Permalink

    This is a neat tool, but I have a password on my mysql root user and it doesn’t work unless I remove the password. Is there any way to add mysql root user credentials for the snapshot script to work?

  3. Posted August 22, 2013 at 9:55 pm | Permalink

    Nice post. I used to be checking continuously this weblog and
    I’m inspired! Very helpful information specifically the last section :) I care for such info much. I used to be looking for this particular information for a long time. Thanks and good luck.

  4. Posted August 30, 2013 at 6:12 pm | Permalink

    whoah this blog is fantastic i love studying your articles.
    Stay up the great work! You know, lots of persons are searching round for this information, you could aid them greatly.

  5. Posted September 7, 2013 at 6:28 pm | Permalink

    I’m extremely pleased to discover this web site. I need to to thank you
    for ones time for this fantastic read!! I definitely really liked
    every little bit of it and i also have you book marked to check out new
    information in your web site.

  6. Posted September 8, 2013 at 6:44 pm | Permalink

    I use PPTP protocol with Overplay and on average, my downloads reach between 7-10Mbps.

    Which is much more than sufficient to stream vids and
    download larger content. I also have a connection hooked up to
    my iPhone and Xbox. Overplay is reliable and ticks all the boxes
    for me.

  7. Posted September 8, 2013 at 7:54 pm | Permalink

    Putting with like methods look is usually a pleasant yard, to currently have loads of pleasurable.
    I just ensure that backyard garden costly in the past could be viewed
    as just technique solution. Need it on condition that the costs are
    quite low. Included ad providers patio being a very good origin of drive to be able to this type of obtain.

    noclegi poznań

  8. Posted September 9, 2013 at 12:05 am | Permalink

    Especially for the reason that competitors is
    very fantastic, and therefore the guard a further fella without doing awkward exorcizes presently there.
    The most important thing is definitely an plan with an exciting and even distinctive likes and
    dislikes and as well tasty not to mention clean cuisine.

    Strengthening fresh produce is critical, and in some cases better when the meals is frequently awesome.
    A good remedy happens to be a modern day bemar that could solve this matter.

    poznań hostel

  9. Posted September 12, 2013 at 3:51 pm | Permalink

    Highly descriptive article, I loved that a lot.
    Will there be a part 2?

  10. Posted September 15, 2013 at 10:21 am | Permalink

    Have you ever considered about adding a little bit more than
    just your articles? I mean, what you say is important and all.
    However think of if you added some great images or video clips to
    give your posts more, “pop”! Your content is excellent but with pics and videos, this website could certainly be one of the
    very best in its niche. Good blog!

  11. Posted September 17, 2013 at 12:31 pm | Permalink

    Hi, I do think this is a great site. I stumbledupon it ;
    ) I will return yet again since I saved as a favorite it.
    Money and freedom is the greatest way to
    change, may you be rich and continue to guide other people.

  12. Posted September 19, 2013 at 5:15 pm | Permalink

    Its like you read my mind! You appear to know a lot about this, like you wrote the
    book in it or something. I think that you could do with some pics to drive the message home a bit,
    but other than that, this is magnificent blog.
    A great read. I will definitely be back.

  13. Posted September 20, 2013 at 11:06 pm | Permalink

    I do agree with all of the ideas you have presented in your post.
    They are very convincing and will definitely work. Still, the posts are
    too brief for beginners. May you please prolong them a bit from next time?

    Thank you for the post.

  14. Posted September 22, 2013 at 1:04 am | Permalink

    Super story on Simple backup and recovery with the snapshot command The Gitorious
    Blog.
    It is actually one of the best that Ive found in a long time

  15. Posted September 24, 2013 at 1:52 am | Permalink

    It is appropriate time to make a few plans for the longer term
    and itt iis time to be happy. I have read this put up
    and if I may just I wish to recommend you few interesting issues or tips.
    Maybe you can write next articles referring to ths article.
    I desire tto learn mmore issues approximaately it!

  16. Posted September 25, 2013 at 2:01 pm | Permalink

    Hey! I know this is somewhat off-topic however I
    had to ask. Does managing a well-established blog like yours require a lot of
    work? I am brand new to operating a blog but I do write in my journal daily.
    I’d like to start a blog so I will be able to share my own experience
    and views online. Please let me know if you have any suggestions or tips for brand new aspiring bloggers.
    Thankyou!

  17. Posted September 25, 2013 at 8:35 pm | Permalink

    Howdy! Do you know if they make any plugins to protect against hackers?

    I’m kinda paranoid about losing everything I’ve
    worked hard on. Any suggestions?

  18. Posted September 30, 2013 at 7:17 am | Permalink

    Hello There. I found your blog using msn. Thiss is a really well
    written article. I will be sure to bookmark iit and return too read more of your useful
    information. Thanks for thhe post. I’ll certainly comeback.

  19. Posted October 18, 2013 at 12:45 am | Permalink

    Wow! i’m so glad that if found your website I will be
    saving this for later! – real estate in hawaii is an interest of
    mine and and your “Simple backup and recovery with the snapshot command The Gitorious Blog”
    article is absolutely fantastic work.
    Keep it up!, I’ll check back again real soon!

  20. Posted October 18, 2013 at 4:01 am | Permalink

    I am in fact thankful to the owner of this site who
    has shared this impressive paragraph at here.|

  21. Posted October 20, 2013 at 4:53 pm | Permalink

    Everything is very open with a precise description of the
    issues. It was really informative. Your website is extremely helpful.
    Thank you for sharing!

  22. Posted November 22, 2013 at 6:10 am | Permalink

    nske virksomheder konkurrere p samme grundlag som udenlandske kolleger . * multilateralize us kontrol med eksport til kina for at fange milliarder af dollars af salget.det frste skridt i at
    [i][url=http://www.kobmonclervinterjakke.com]Moncler Jakke Danmark[/url][/i]
    hans kunstnervenner trustees . frem for alt , ppeger han , de bekymrer sig lidenskabeligt om de centrale indhold af institution.the tate har trustees der bekymre sig om boghandelen , om kono
    [i][url=http://www.skobilligeoutlet.com]Billige Nike Free sko[/url][/i]
    line ampamp colororiental grs til textureno man blive overrasket p mine suk (mindst jeg kan forsge at giveback til jorden, genopbygge levested lille pris relief krav ), og det er den tredj
    [url=http://www.kobmonclervinterjakke.com]www.kobmonclervinterjakke.com[/url]
    og 1984 , og de spnder over s uvant terrn som: telefontjeneste i alaska, landets lger i maine, vandkraft i lille skala i staten new york , og bjrne i new jersey.these stykker viser endn
    [u][url=http://www.skobilligeoutlet.com]www.skobilligeoutlet.com[/url][/u]

  23. Posted November 28, 2013 at 8:51 am | Permalink

    I’m curious to find out what blog system you are working with?
    I’m having some small security issuyes witgh mmy latest blog and I
    would like to find something more safeguarded.

    Do you have any suggestions?

  24. Posted December 5, 2013 at 8:00 am | Permalink

    There, you will see and get home furniture designed via the very system.

    Another option could be to buy a sample stained wood

  25. Posted January 14, 2014 at 2:14 pm | Permalink

    Great article! This is the kind of info that are supposed to be shared around the internet.
    Shame on the seek engines for no longer positioning this submit higher!
    Come on over and seek advice from my site . Thank you =)

  26. Posted February 7, 2014 at 5:12 pm | Permalink

    Ңoffentlich macɦt іhr weiter so, es sind գualifizierte Menschen unter euch!

  27. Posted March 13, 2014 at 6:19 pm | Permalink

    Pretty! This was an incredibly wonderful article. Thank you
    for supplying these details.

  28. Posted March 17, 2014 at 5:45 am | Permalink

    Right here is the perfect blog for anybody who wishes to find out about
    this topic. You realize so much its almost hard to argue with
    you (not that I actually will need to…HaHa). You definitely put a new spin on a subject which
    has been discussed for decades. Wonderful stuff,
    just wonderful!

  29. Posted March 17, 2014 at 6:43 am | Permalink

    Hey, I have noticed that this post is usually seen as spam but
    I want to let you guys know about there is currently a really excellent
    internet site which gives you the opportunity to get code xbox live gold gratuit.

    So just visit the site! You definitely won’t forget about
    the web site. Enjoy!

  30. Posted March 20, 2014 at 2:43 am | Permalink

    Ich deոke, ԁass diese Informatioոeո hier wirklich gut sinԁ und man sie nutzen kann.
    Ich habe nocҺ nie so etwas gelesen unɗ etwas anderes als ƅеi ɗeո anderen Seiten ƶu
    finden ist.

  31. Posted March 28, 2014 at 3:07 pm | Permalink

    Simply browse our website to learn more or contact us today at Houston Overhead Garage Doors.
    This article will take you through the steps to safely remove the hinge
    and roller assembly and replace the roller. If your
    garage door is old and worn out, a new one can do a lot to improve the
    look of your home.

  32. Posted April 1, 2014 at 3:43 pm | Permalink

    Hey there this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.

    I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  33. Posted April 4, 2014 at 7:49 pm | Permalink

    Good replies in return of this query with firm arguments
    and telling the whole thing about that.

  34. Posted April 11, 2014 at 11:07 am | Permalink

    You can definitely see your enthusiasm within the article you write.
    The arena hopes for more passionate writers like you who are not afraid to say how they believe.
    All the time follow your heart.

  35. Posted April 17, 2014 at 8:27 am | Permalink

    I’m not sure exactly why but this site is loading extremely
    slow for me. Is anyone else having this problem or is it a problem on my end?
    I’ll check back later and see if the problem still exists.


Post a Comment

Required fields are marked *

*
*

Follow

Get every new post delivered to your Inbox.

Join 716 other followers

%d bloggers like this: