<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>opensoul.org - Awesomeness: database backups Changes</title>
  <id>tag:opensoul.org,2009:/2008/4/27/awesomeness-database-backups/changes</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://opensoul.org/2008/4/27/awesomeness-database-backups/changes.xml" rel="self" type="application/atom+xml"/>
  <link href="/2008/4/27/awesomeness-database-backups" rel="alternate" type="text/html"/>
  <updated>2008-05-01T14:01:21Z</updated>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>brandon</name>
    </author>
    <id>tag:opensoul.org,2008-05-01:430:4</id>
    <published>2008-04-27T22:09:00Z</published>
    <updated>2008-05-01T14:01:21Z</updated>
    <link href="http://opensoul.org/2008/4/27/awesomeness-database-backups" rel="alternate" type="text/html"/>
    <title>Awesomeness: database backups</title>
<content type="html">&lt;p&gt;At &lt;a href=&quot;http://collectiveidea.com&quot;&gt;Collective Idea&lt;/a&gt;, we have a plugin called &lt;a href=&quot;http://github.com/collectiveidea/awesomeness&quot;&gt;awesomeness&lt;/a&gt; that is…well, awesome. It&#8217;s a collection of things that we use in almost every project that aren&#8217;t generic enough to go into individual plugins (although some things may have evolved enough to be worthy of plugin status).&lt;/p&gt;


	&lt;p&gt;A while ago, I &lt;a href=&quot;/2007/2/9/automatically-backing-up-your-remote-database-on-deploy&quot;&gt;blogged a little snippet for backing up your remote database&lt;/a&gt;. Well, that snippet as evolved quite a bit, into it&#8217;s own set of rake and Capistrano tasks.&lt;/p&gt;


	&lt;p&gt;First, the rake tasks. You Can easily create a new local backup:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:create&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This creates a &lt;code&gt;backups&lt;/code&gt; directory in your project, with a subdirectory for each backup based on the timestamp.  A backup consists of the &lt;code&gt;schema.rb&lt;/code&gt; file and then a fixture for each table to hold the data. Why fixtures? Good question. Because we wanted the backups to be database independent.&lt;/p&gt;


	&lt;p&gt;You can easily restore your local database to the latest backup, or a specific version:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:restore VERSION=20080427214315&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;That&#8217;s nice, but what good are local backups? That&#8217;s where Capistrano comes in. Just add this to your &lt;code&gt;config/deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;load 'awesomeness/backup'&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This adds some nifty remote backup support. Now, whenever &lt;code&gt;cap deploy:migrations&lt;/code&gt; is run, a backup of your remote database will automagically be created and stored in the shared directory on the server. You can also have them transferred to your local machine by adding a callback in your &lt;code&gt;deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;after &quot;backup:create&quot;, &quot;backup:download&quot;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Sometimes, you just want to take a snapshot of the server and plop it into your local database.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ cap backup:mirror&lt;/code&gt;&lt;/pre&gt;


	&lt;h3&gt;How do I get this backup awesomeness?&lt;/h3&gt;


	&lt;p&gt;&lt;a href=&quot;http://github.com/collectiveidea/awesomeness/tree/master&quot;&gt;Awesomeness now lives on Github&lt;/a&gt; (like the rest of the world). Fork it and let us know what you think.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>brandon</name>
    </author>
    <id>tag:opensoul.org,2008-04-27:425:3</id>
    <published>2008-04-27T22:09:00Z</published>
    <updated>2008-04-27T22:15:39Z</updated>
    <link href="http://opensoul.org/2008/4/27/awesomeness-database-backups" rel="alternate" type="text/html"/>
    <title>Awesomeness: database backups</title>
<content type="html">&lt;p&gt;At &lt;a href=&quot;http://collectiveidea.com&quot;&gt;Collective Idea&lt;/a&gt;, we have a plugin called &lt;a href=&quot;http://github.com/collectiveidea/awesomeness&quot;&gt;awesomeness&lt;/a&gt; that is…well, awesome. It&#8217;s a collection of things that we use in almost every project that aren&#8217;t generic enough to go into individual plugins (although some things may have evolved enough to be worthy of plugin status).&lt;/p&gt;


	&lt;p&gt;A while ago, I &lt;a href=&quot;/2007/2/9/automatically-backing-up-your-remote-database-on-deploy&quot;&gt;blogged a little snippet for backing up your remote database&lt;/a&gt;. Well, that snippet as evolved quite a bit, into it&#8217;s own set of rake and Capistrano tasks.&lt;/p&gt;


	&lt;p&gt;First, the rake tasks. You Can easily create a new local backup:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:create&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This creates a &lt;code&gt;backups&lt;/code&gt; directory in your project, with a subdirectory for each backup based on the timestamp.  A backup consists of the &lt;code&gt;schema.rb&lt;/code&gt; file and then a fixture for each table to hold the data. Why fixtures? Good question. Because we wanted the backups to be database independent.&lt;/p&gt;


	&lt;p&gt;You can easily restore your local database to the latest backup, or a specific version:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:restore VERSION=20080427214315&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;That&#8217;s nice, but what good are local backups? That&#8217;s where Capistrano comes in. Just add this to your &lt;code&gt;config/deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;load 'awesomeness/backup'&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This adds some nifty remote backup support. Now, whenever &lt;code&gt;cap deploy:migrations&lt;/code&gt; is run, a backup of your remote database will automagically be created and stored in the shared directory on the server. You can also have them transferred to your local machine by adding a callback in your &lt;code&gt;deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;after &quot;backup:create&quot;, &quot;backup:get&quot;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Sometimes, you just want to take a snapshot of the server and plop it into your local database.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ cap backup:clone&lt;/code&gt;&lt;/pre&gt;


	&lt;h3&gt;How do I get this backup awesomeness?&lt;/h3&gt;


	&lt;p&gt;&lt;a href=&quot;http://github.com/collectiveidea/awesomeness/tree/master&quot;&gt;Awesomeness now lives on Github&lt;/a&gt; (like the rest of the world). Fork it and let us know what you think.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>brandon</name>
    </author>
    <id>tag:opensoul.org,2008-04-27:424:2</id>
    <published>2008-04-27T22:09:00Z</published>
    <updated>2008-04-27T22:14:05Z</updated>
    <link href="http://opensoul.org/2008/4/27/awesomeness-database-backups" rel="alternate" type="text/html"/>
    <title>Awesomeness: database backups</title>
<content type="html">&lt;p&gt;At &lt;a href=&quot;http://collectiveidea.com&quot;&gt;Collective Idea&lt;/a&gt;, we have a plugin called &lt;a href=&quot;http://github.com/collectiveidea/awesomeness&quot;&gt;awesomeness&lt;/a&gt; that is…well, awesome. It&#8217;s a collection of things that we use in almost every project that aren&#8217;t generic enough to go into individual plugins (although some things may have evolved enough to be worthy of plugin status).&lt;/p&gt;


	&lt;p&gt;A while ago, I &lt;a href=&quot;/2007/2/9/automatically-backing-up-your-remote-database-on-deploy&quot;&gt;blogged a little snippet for backing up your remote database&lt;/a&gt;. Well, that snippet as evolved quite a bit, into it&#8217;s own set of rake and Capistrano tasks.&lt;/p&gt;


	&lt;p&gt;First, the rake tasks. You Can easily create a new local backup:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:create&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This creates a &lt;code&gt;backups&lt;/code&gt; directory in your project, with subdirectory for each backup base on the timestamp.  A backup consists of the &lt;code&gt;schema.rb&lt;/code&gt; file and then a fixture for each table to hold the data. Why fixtures? Good question. Because we wanted the backups to be database independent.&lt;/p&gt;


	&lt;p&gt;You can easily restore your local database to the latest backup, or a specific version:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:restore VERSION=20080427214315&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;That&#8217;s nice, but what good are local backups? That&#8217;s where Capistrano comes in. Just add this to your &lt;code&gt;config/deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;load 'awesomeness/backup'&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This adds some nifty remote backup support. Now, whenever &lt;code&gt;cap deploy:migrations&lt;/code&gt; is run, a backup of your remote database will automagically be created and stored in the shared directory on the server. You can also have them transferred to your local machine by adding a callback in your &lt;code&gt;deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;after &quot;backup:create&quot;, &quot;backup:get&quot;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Sometimes, you just want to take a snapshot of the server and plop it into your local database.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ cap backup:clone&lt;/code&gt;&lt;/pre&gt;


	&lt;h3&gt;How do I get this backup awesomeness?&lt;/h3&gt;


	&lt;p&gt;&lt;a href=&quot;http://github.com/collectiveidea/awesomeness/tree/master&quot;&gt;Awesomeness now lives on Github&lt;/a&gt; (like the rest of the world). Fork it and let us know what you think.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://opensoul.org/">
    <author>
      <name>brandon</name>
    </author>
    <id>tag:opensoul.org,2008-04-27:423:1</id>
    <updated>2008-04-27T22:09:32Z</updated>
    <link href="http://opensoul.org/2009/3/12/awesomeness-database-backups" rel="alternate" type="text/html"/>
    <title>Awesomeness: database backups</title>
<content type="html">&lt;p&gt;At &lt;a href=&quot;http://collectiveidea.com&quot;&gt;Collective Idea&lt;/a&gt;, we have a plugin called &lt;a href=&quot;http://github.com/collectiveidea/awesomeness&quot;&gt;awesomeness&lt;/a&gt; that is…well, awesome. It&#8217;s a collection of stuff that we use in almost every project, that aren&#8217;t generic enough to go into individual plugins (although some things may have evolved enough to be worthy of plugin status).&lt;/p&gt;


	&lt;p&gt;A while ago, I &lt;a href=&quot;/2007/2/9/automatically-backing-up-your-remote-database-on-deploy&quot;&gt;blogged a little snippet about automatically backing up your database when you deploy&lt;/a&gt;. Well, that snippet as evolved quite a bit, into it&#8217;s own set of rake and Capistrano tasks.&lt;/p&gt;


	&lt;p&gt;First, the rake tasks. You Can easily create a new local backup:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:create&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;This creates a &lt;code&gt;backups&lt;/code&gt; directory in your project, with subdirectory for each backup base on the timestamp.  A backup consists of the &lt;code&gt;schema.rb&lt;/code&gt; file and then a fixture for each table to hold the data. Why fixtures? Good question. Because we wanted the backups to be database independent.&lt;/p&gt;


	&lt;p&gt;You can easily restore your local database to the latest backup, or a specific version:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ rake db:backup:restore VERSION=20080427214315&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;That&#8217;s nice, but what good are local backups? That&#8217;s where Capistrano comes in.&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;config/deploy.rb
load &#8216;awesomeness/backup&#8217;&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;This adds some nifty remote backup support. Now, whenever &lt;code&gt;cap deploy:migrations&lt;/code&gt; is run, a backup of your remote database will automagically be created and stored in the shared directory on the server. You can also have them transferred to your local machine by adding a callback in your &lt;code&gt;deploy.rb&lt;/code&gt;:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;after &quot;backup:create&quot;, &quot;backup:get&quot;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Sometimes, you just want to take a snapshot of the server and plop it into your local database.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;$ cap backup:clone&lt;/code&gt;&lt;/pre&gt;


	&lt;h3&gt;How do I get this backup awesomeness?&lt;/h3&gt;


	&lt;p&gt;&lt;a href=&quot;http://github.com/collectiveidea/awesomeness/tree/master&quot;&gt;Awesomeness&lt;/a&gt; now lives on Github (like the rest of the world): http://github.com/collectiveidea/awesomeness/tree/master. Fork it and let us know what you think.&lt;/p&gt;</content>  </entry>
</feed>
