Generally helpful rake tasks to backup code/scm/database to and from S3
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with skippy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



= S3 Rake - Use S3 as a backup repository for your SVN repository, code directory, and MySQL database

Author::    Adam Greene
Copyright:: (c) 2006 6 Bar 8, LLC.,
License::   GNU

Feedback appreciated: adam at [nospam] 6bar8 dt com

== Synopsis

 from the CommandLine within your RubyOnRails application folder
 $ rake -T
   rake s3:backup                      # Backup code, database, and scm to S3
   rake s3:backup:code                 # Backup the code to S3
   rake s3:backup:db                   # Backup the database to S3
   rake s3:backup:scm                  # Backup the scm repository to S3
   rake s3:manage:clean_up             # Remove all but the last 10 most recent backup archive or optionally specify KEEP=5 to keep
                                           the last 5
   rake s3:manage:delete_bucket        # delete bucket.  You need to pass in NAME=bucket_to_delete.  Set FORCE=true if you want to 
                                       #   delete the bucket even if there are items in it.
   rake s3:manage:list                 # list all your backup archives
   rake s3:manage:list_buckets         # list all your S3 buckets
   rake s3:retrieve                    # retrieve the latest revision of code, database, and scm from S3. 
                                       #   If  you need to specify a specific version, call the individual retrieve tasks
   rake s3:retrieve:code               # retrieve the latest code backup from S3, or optionally specify a VERSION=this_archive.tar.gz
   rake s3:retrieve:db                 # retrieve the latest db backup from S3, or optionally specify a VERSION=this_archive.tar.gz
   rake s3:retrieve:scm                # retrieve the latest scm backup from S3, or optionally specify a VERSION=this_archive.tar.gz

== Description

 There are a few prerequisites to get this up and running:
   * please download the Amazon S3 ruby library and place it in your ./lib/ directory
   * You will need a 's3.yml' file in ./config/.  Sure, you can hard-code the information in this rake task,
     but I like the idea of keeping all your configuration information in one place.  The File will need to look like:
       aws_access_key: '<YOUR ACCESS KEY HERE>'
       aws_secret_access_key: '<YOUR _SECRET_ ACCESS KEY HERE>'
           use_ssl: true #set it to true or false

 Once these two requirements are met, you can easily integrate these rake tasks into capistrano tasks or into cron.
   * For cron, put this into a file like <>.backup.cron.  You can drop this file into /etc/cron.daily,
     and make sure you chmod +x <>.backup.cron.  Also make sure it is owned by the appropriate user (probably 'root'.):


     # change the paths as you need...
     cd /var/www/apps/<>/current/ && rake s3:backup >/dev/null 2>&1
     cd /var/www/apps/staging.<>/current/ && rake s3:backup >/dev/null 2>&1

   * within your capistrano recipe file, you can tasks like these:

    task :before_update_code, :roles => [:app, :db, :web] do
       # this will back up your svn repository, your code directory, and your mysql db.
       run "cd #{current_path} && rake --trace RAILS_ENV=production s3:backup"

== Credits and License

 inspired by rshll, developed by Dominic Da Silva:

This library is licensed under the GNU General Public License (GPL)