Code Monkey home page Code Monkey logo

backup's Introduction

Backup

Code Climate Build Status Join the chat at https://gitter.im/backup/backup

This project is welcoming new contributors and maintainers. See CONTRIBUTING.md

Backup is a system utility for Linux and Mac OS X, distributed as a RubyGem, that allows you to easily perform backup operations. It provides an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.

Installation · Release Notes · Documentation · Issues · Chat

Project Status: Looking for contributors and maintainers

This project is not under active development, although we will continue to provide support for current users, but you can change that by joining the team (see CONTRIBUTING.md)

If you use this project and would like to develop it further, please introduce yourself on the maintainers wanted ticket.

Copyright (c) 2009-2017 Michael van Rooijen ( @mrrooijen ) Released under the MIT LICENSE.

backup's People

Contributors

alexef avatar antonlindstrom avatar bastengao avatar braintreeps avatar elliottsj avatar elthariel avatar jamesjefferies avatar jessedearing avatar jlambert121 avatar joeyates avatar kikito avatar kronn avatar lazywei avatar manuelmeurer avatar mapopa avatar mikz avatar mrrooijen avatar nacengineer avatar paracycle avatar pat avatar phlipper avatar reedloden avatar rspeicher avatar stuartellis avatar szajbus avatar szimmermann avatar tmikoss avatar tomash avatar tombruijn avatar vkill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backup's Issues

Dry Run

Allow a --dry-run (or -n is used in cap and others) that shows what running the trigger is going to do but doesn't actually do it.

Multiple Storage

Right now if you specify 2 or more storage blocks within a backup it only does the last one. It would be nice if I could store a backup in 2 places within one backup block, that way I wouldn't have to create 2 identical tmp files and gzip them, etc.

Boot error: `no such file to load -- pony`

In attempting to install backup in my development environment I'm getting this error on boot:

$ ./script/about 
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
<SNIP RAILS_ROOT>/vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip.rb:47: warning: already initialized constant VERSION
** Erubis 2.6.5
no such file to load -- pony
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
<SNIP RAILS_ROOT>/vendor/gems/backup-2.3.1/lib/backup.rb:7
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
<SNIP RAILS_ROOT>/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:208:in `load'
./script/../config/../vendor/rails/railties/lib/initializer.rb:307:in `load_gems'
./script/../config/../vendor/rails/railties/lib/initializer.rb:307:in `each'
./script/../config/../vendor/rails/railties/lib/initializer.rb:307:in `load_gems'
./script/../config/../vendor/rails/railties/lib/initializer.rb:169:in `process'
./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
<SNIP RAILS_ROOT>/config/environment.rb:10
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
<SNIP RAILS_ROOT>/vendor/rails/railties/lib/commands/about.rb:1
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
./script/about:4
Missing these required gems:
  backup  

You're running:
  ruby 1.8.7.173 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  rubygems 1.3.6 at <SNIP HOME_ROOT>/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

I have declared the backup gem in environment.rb and installed and unpacked the backup gem and its dependencies. I have tried unvendoring pony and have tried both versions 0.9 and 0.9.1, all with the same result. We have vendored rails. Firing up an irb console and doing a require 'pony' works as expected. All gems appear to have installed correctly (no errors reported).

As a side note, there do seem to be quite a few dependencies for this gem, might it be possible to somehow lazy-load the dependencies based on the specific functionality desired?

$ ./script/about
About your application's environment
Ruby version              1.8.7 (universal-darwin10.0)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Action Pack version       2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Edge Rails revision       624af6f386fcc6220aec30c406cdbd0348a09492
Application root          <SNIP RAILS_ROOT>
Environment               development
Database adapter          mysql
Database schema version   20100420133541

S3 dependency conflicts with AWS/S3 in Paperclips

I've got the following in my Gemfile (using Rails 3):

gem 'backup', '2.4.0'
gem 'paperclip', '2.3.3'
gem 's3', '0.3.4'
gem 'aws-s3', '0.6.2', :require => 'aws/s3'

and I cannot start the server or do any backup. It seems that I have to take out either s3 (used by backup) or aws-s3 (used by paperclip) - but I need both... any ideas how to get this working?

Steve

Multiple Databases

Allow multiple or :all databases for the mysql and postgresql adapters. You can make this work now, sort of, but it's kind of a hack.

Crontab need full paths

It would seem that the Crontab needs full paths to for example:

/opt/local/bin/mysql5
/opt/local/bin/mysqldump5

rather than just mysql5 or mysqldump5 when executing these commands.

(This is an issue for some people depending on their hosting provider/OS settings and such)

Need to find a way to resolve this issue by dynamically finding and adding the full path to all these commands for the Crontab rather than just using the short-hand commands for it.

Error starting server under Rails, in dev mode (mac 10.6)

Hi.

I have a simple app,
and while configuring backup, the development server cannot start if I call
config.gem "backup"

(Which is a bummer, since it appears to be exactly the simple backup solution I need :) )

Rails is 2.3.4 (frozen)

Here is the error stack :
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:270:in activate': undefined methodmap' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:296:in activate' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:295:ineach'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:295:in activate' from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:68:ingem'
from /[REDACTED]/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:73:in add_load_paths' from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:301:inadd_gem_load_paths'
from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:301:in each' from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:301:inadd_gem_load_paths'
from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:132:in process' from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:113:insend'
from /[REDACTED]/config/../vendor/rails/railties/lib/initializer.rb:113:in run' from /[REDACTED]/config/environment.rb:5 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /[REDACTED]/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:inrequire'
from /[REDACTED]/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in' from /[REDACTED]/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:inrequire'
from /[REDACTED]/vendor/rails/railties/lib/commands/server.rb:84
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from ./script/server:3

here are the Gems installed on the machine :
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
acts-as-taggable-on (1.0.16)
ambethia-smtp-tls (1.1.2)
authlogic (2.1.3)
aws-s3 (0.6.2)
backup (2.3.1)
be9-acl9 (0.11.0)
builder (2.1.2)
calendar_date_select (1.15)
cgi_multipart_eof_fix (2.5.0)
chronic (0.2.3)
daemons (1.0.10)
fastthread (1.0.7)
gem_plugin (0.2.3)
gemcutter (0.3.0)
hirb (0.2.9)
hoe (2.5.0)
json_pure (1.2.0)
mime-types (1.16)
mongrel (1.1.5)
mysql (2.8.1)
net-scp (1.0.2)
net-sftp (2.0.4)
net-ssh (2.0.17)
pony (0.6)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
RedCloth (4.2.2)
rmagick (2.12.2)
rubyforge (2.0.3)
sqlite3-ruby (1.2.5)
tmail (1.2.6)
whenever (0.4.1)
will_paginate (2.3.11)
xml-simple (1.0.12)

I didn't install the sqlite lib, since it's already installed with the OS.
(and, by rthe way, what is it needed for, since the migration is supposed to choose the adaptater ?)

Would you know where the issue comes from ?

thank you.

raphael.

return non-zero code if something is wrong

I think it would be good to detect any fatal errors during backup (i.e. anything that causes backup not to be uploaded to destination) and return a non-zero code so that it's easier to detect that error. Right now, if you e.g. define backup 'images' but call 'backup --run image', the returned code seems to be zero. (I'm running the task in cron through a wrapper that sends an email if status code is nonzero, and I do get an email if I mistype 'backup', but not if I mistype the backup name.)

Removed dependencies that aren't always used.

So for example, looking at our gemspec file:

##
# Dependencies
gem.add_dependency('s3',            [">= 0.3.0"])
gem.add_dependency('net-ssh',       [">= 2.0.15"])
gem.add_dependency('net-scp',       [">= 1.0.2"])
gem.add_dependency('net-sftp',      [">= 2.0.4"])
gem.add_dependency('activerecord',  [">= 2.3.5"])
gem.add_dependency('sqlite3-ruby',  [">= 1.2.5"])
gem.add_dependency('hirb',          [">= 0.2.9"])
gem.add_dependency('pony',          [">= 0.5"])
gem.add_dependency('cloudfiles',    [">= 1.4.7"])

it is going to install a bunch of things. But maybe we should not do this and instead, like how Paperclip does it. If you want to use S3 storage, and the user tries to run it, then prompt something like this:

Could not load s3 gem. Install and require it in your environment.

Instead of adding a bunch of dependencies to the gem as shown above.
For example if you could care less about CloudFiles or Pony for Email nofications, then why install it?
Install it manually or add it to gemfile if you are using Rails when needed, notify the user with a prompt when trying to load in something that doesn't exist.

Who here likes the approach? Cause maybe when working with bundler for example, it might become a dependency hell for anyone that has gems that depend on different versions of the gem above.

slow dumping of mysql in production

Just to let people know, I have a very large mysql database, and dumping it using backup gem takes a LONG time, and it locks all the tables, making the site unusable.

A solution is to add --single-transaction to the mysql dump command.
More info at http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_single-transaction

Perhaps meskyanichi will integrate this?
It's pretty straight forward and it means it can then be used in production for large mysql databases.

Steve

Refactoring Backup Initializers

Because this really looks ugly:

case backup.procedure.storage_name.to_sym
  when :cloudfiles then records = Backup::Record::CloudFiles.all :conditions => {:trigger => trigger}
  when :s3         then records = Backup::Record::S3.all         :conditions => {:trigger => trigger}
  when :scp        then records = Backup::Record::SCP.all        :conditions => {:trigger => trigger}
  when :ftp        then records = Backup::Record::FTP.all        :conditions => {:trigger => trigger}
  when :sftp       then records = Backup::Record::SFTP.all       :conditions => {:trigger => trigger}
  when :local      then records = Backup::Record::Local.all      :conditions => {:trigger => trigger}
end

Would be nice to have some kind of Dynamic-ness that would only take up ONE line rather than one for every adapter. It's causing various files to look very messy.

Backup Restore/Pull

This is a feature that will probably be added in the near future.

This will enable the user to pull a backup from S3 or the remote server back to the production server.

Additionally, and I believe this will be added later, after the "pull" feature, the ability to do a sort of a "rollback" that will basically restore an older state. Whether it's a single file, an archive, or a MySQL or PostgreSQL database. This feature however will take some more time to develop so I will probably be releasing a "pull" function before that so people can at least have a very easy way of pulling stored backups back to the production box.

SFTP Port

Currently I use a nonstandard port on my server for SFTP, I know that in Net::SFTP.start you can add the port. I know where to modify it, but how do I install THAT which I modified, if I do gem install backup I will install one from the sources not from the local file im working with right?

warn when BACKUP_PATH constant is overwritten

I defined BACKUP_PATH constant in my file to point to the path on the remote server to which the backups should be scp'd, and apparently it has overwritten Backup's own BACKUP_PATH and it tried to create a backup in a directory which shouldn't exist on the local machine. For some reason I didn't get any warnings about overwriting an existing constant...

Path Issues

I am aware that Backup won't play nice with paths that contain "spaces".
I will look into this issue soon.

notifications fail

Hi,

I can't make backup to send notifications.
Here's the trace output:

rake aborted!
You may need: gem install smtp_tls
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/pony-0.9/lib/pony.rb:94:in transport_via_smtp' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/pony-0.9/lib/pony.rb:24:insend'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/pony-0.9/lib/pony.rb:24:in mail' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/backup-2.3.1/lib/backup/mail/base.rb:37:innotify!'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/backup-2.3.1/lib/backup/adapters/base.rb:78:in notify' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/backup-2.3.1/lib/backup/adapters/mysql.rb:28:ininitialize'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/backup-2.3.1/lib/backup.rb:85:in new' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/backup-2.3.1/lib/backup.rb:85:ininitialize_adapter'
/var/www/domains/blabla.com/releases/20100412081718/lib/tasks/backup/backup.rake:6
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/1.8/monitor.rb:242:insynchronize'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /opt/ruby-enterprise/bin/rake:19:inload'
/opt/ruby-enterprise/bin/rake:19

I tried gmail and another mailserver, both fail.
I have the smtp_tls gem installed and I'm running on Ubuntu 8.04with ruby EE 1.8.6 and Rails 2.3.5.

Backups are made but notifications fail.
Wout

DRYing out the configuration DSL and extraction of sensitive data

Hey meskyanichi,

I haven't seen any examples of this and was wondering whether the configuration DSL allow you to define configuration for adapters and storage methods just the once? The use case being the need for multiple triggers all having the same storage configuration (with minor differences for each i.e. buckets).

Also does backup or aws-s3 provide any explicit/automagic support for moving aspects of the configuration out into yaml files in the same way ActiveRecord and its ilk use a database.yml? The current DSL seems to merge functionality and configuration into one which doesn't feel quite right to me. Ideally the credentials for say your S3 account would live in a separate multi-environment supporting s3.yml file that you wouldn't commit to the repository while the configuration of the actual backup procedures would live in the backup.rb configuration file as they currently do.

Thanks.

blank? is a Rails extension, does not work standalone

had to change port.blank? ot port.empty? to get it to work standalone

Returns a list of options in PostgreSQL syntax

def options
options = String.new
options += " --port='#{port}' " unless port.empty?
options += " --host='#{host}' " unless host.empty?
options += " --host='#{socket}' " unless socket.empty? unless options.include?('--host=')
options
end

Must we have Pony as a dependency?

It interferes with my plugin action_mailer_optional_tls (I use rails)

It would be good if we can have it as a config in backup.rb

eg. use_rails_default_mailer = true

or something like that.

anyhow, I've removed the line which uses Pony below. It should be simple enough to change. That would be very nice. If you are going to incorporate this I could write a patch for it, but only if you're going to do that :)

  # Delivers the backup details by email to the recipient
  # Requires the Backup Object
  def self.notify!(backup)
    if self.setup? and backup.procedure.attributes['notify'].eql?(true)
      @backup = backup
      self.parse_body
      PersonMailer.deliver_backup_notification(@backup.trigger, @content, :stream => :support)
      # Pony.mail({
      #   :subject  => "Backup for \"#{@backup.trigger}\" was successfully created!",
      #   :body     => @content
      #   }.merge(self.smtp_configuration))
      puts "Sending notification to #{self.to}."
    end
  end

undefined method `backup'

I get

undefined method `backup' for #<Object:0x1001972a0 @svn=#Subversion:0x1020c1450>

when running the command

rake backup:run trigger='mysql-backup-s3' RAILS_ENV=development_staging --trace

Full trace below...

rake backup:run trigger='mysql-backup-s3' RAILS_ENV=development_staging --trace
(in /webapps/project)
** Invoke backup:run (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method backup' for #<Object:0x1001972a0 @svn=#<Subversion:0x1020c1450>> /webapps/project/config/backup.rb:21 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in require' /webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inrequire'
/webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in' /webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inrequire'
/webapps/project/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:94:in load' /webapps/project/config/../vendor/rails/railties/lib/initializer.rb:281:inload_gems'
/webapps/project/config/../vendor/rails/railties/lib/initializer.rb:281:in each' /webapps/project/config/../vendor/rails/railties/lib/initializer.rb:281:inload_gems'
/webapps/project/config/../vendor/rails/railties/lib/initializer.rb:159:in process' /webapps/project/config/../vendor/rails/railties/lib/initializer.rb:112:insend'
/webapps/project/config/../vendor/rails/railties/lib/initializer.rb:112:in run' /webapps/project/config/environment.rb:14 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in require' /webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inrequire'
/webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in' /webapps/project/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inrequire'
/webapps/project/vendor/rails/railties/lib/tasks/misc.rake:3
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:insynchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:ininvoke_prerequisites'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ininvoke_prerequisites'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:insynchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /opt/local/bin/rake:19:inload'
/opt/local/bin/rake:19

The error occurred while evaluating nil.each

Got this error when do rake backup:run trigger=xx

The error occurred while evaluating nil.each
/home/songrit/.rvm/gems/ree-1.8.7-2010.02/gems/backup-2.4.0/lib/backup.rb:114:in `find_triggered_procedure'

Remove "Optional" Dependencies?

Like for example the Pony gem. If someone isn't going to use email notifications, then this isn't really a dependency for that person. Same goes for Amazon S3, Rackspace Cloud Files.

Then instead of a simple

require 's3'

We could do something alone the lines of

begin
  require 's3'
rescue LoadError
  puts "Using Amazon S3 requires the s3 gem: gem install s3"
  puts "or if you're using Bundler, add it to your Gemfile"
  exit
end

This way Backup can remove 3-4 gem dependencies from the backup.gemspec and people will have to explicitly require the gems to enable the functionality.

Multiple Databases

For mysql and postgres adapters, allow for backing up multiple databases. mysqldump can do this with the --databases switch, and postgres can use pg_dumpall or something

Mail template parsed using ERB

At this moments there's an email template named "mail.txt" which contains a "custom" markup language. What do you think in replacing that file by an ERB file?

Licence

Hi there,

What kind of licence is that? It looks like freeware rather than open source?

tar output on stderr

When I make a backup with archive adapter, I get this line in the output:

tar: Removing leading `/' from member names

It's not a problem if I run it manually, but if it's run from cron, this makes a difference between having empty stderr and not getting an email, and having a non-empty stderr and getting an email...

Confirm Ruby on Rails 3 compatibility.

Have not yet tested Backup on Rails 3. Noticed there was a branch that was working on it, but seems to be inactive at the moment and never received a pull request. Will look into this soon.

If anyone has Backup running with Rails 3 at the moment, please comment below.

uninitialized constant Backup::Setup

Hello,
first congratulations on the wonderful gem.

I recently encountered the following error, when I try to initiate backup with rake task:

rake backup:run trigger=xxx-db RAILS_ENV=production --trace
(in /home/web/public_html/xxx/releases/20100127153720)
** Invoke backup:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute backup:run
Running: xxx-db.
rake aborted!
uninitialized constant Backup::Setup
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in const_missing' /home/web/public_html/radimpesko/releases/20100127153720/lib/tasks/backup/backup.rake:6 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

rails 2.3.5 gem installed (no other rails versions)
backup (2.3.1) gem installed
config.gem "backup" in environment.rb
Ubuntu 9

The weirdest thing is that it used to work. Any ideas?

Thank you,
Tomas

issue with skip_tables in postgres backup

ruby version
ruby 1.9.1p430 (2010-08-16 revision 28998) [i686-linux]
PostgreSQL version 8.3
gems installed
aaronh-chronic (0.3.9)
actionmailer (2.3.8)
actionpack (2.3.8)
activemodel (3.0.0)
activerecord (3.0.0, 2.3.8)
activeresource (2.3.8)
activesupport (3.0.0, 2.3.8)
arel (1.0.1)
backup (2.4.0)
builder (2.1.2)
cloudfiles (1.4.8)
hirb (0.3.4)
i18n (0.4.1)
mail (2.2.6.1)
mime-types (1.16)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.0.23)
polyglot (0.3.1)
pony (1.0.1)
proxies (0.2.1)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
s3 (0.3.4)
sqlite3-ruby (1.3.1)
treetop (1.4.8)
tzinfo (0.3.23)
whenever (0.5.3)
and the backup.rb file
backup 'postgresql-xxxx-xxxx_prod' do

adapter :postgresql do
    user    'xxx'
    password 'xxxx'
    database    'xxx_prod'
    skip_tables ['audit_log_history']
    options do
        host    '127.0.0.1'
        port    '5432'
    end
    additional_options '--clean --blobs'
end
storage :local do
    path    "/backup/databases/postgresql/xxx/xxx"
end

keep_backups 30
notify false

end

when i run this command
backup --run postgresql-xxxx-xxxx_prod i get this message
Running: postgresql-xxxx-xxxx_prod.
Backup (2010-10-06 02:44:18 UTC) => Creating PostgreSQL dump..
Backup (2010-10-06 02:44:18 UTC) => Compressing backup..
pg_dump: too many command-line arguments (first is "xxx_prod")
Try "pg_dump --help" for more information.

If I remove the skip_tables ['audit_log_history'] then it works fine. Any pointer on what I am doing wrong will be great.

one more question can i have two storage commands in the same backup trigger, one is local and other s3?

-iMohan

remove directories from tmp path

I make a backup with custom adapter, calling mongodump, which creates a subdirectory inside tmp path. When Backup cleans up that directory after finishing the backup, it tries to remove the contents of the tmp directory, but calls rm without -r, so it can't remove that subdirectory.

Alternative compressors

I've done a rough implementation of adding 7zip's PPMd algorithm as an alternative to gzip (MySQL adapter only). A couple of basic tests on 3Gb plain-text SQL dump shown 40% better performance and 10% smaller output compared to 'gzip --best'.

All the changes are in my fork. Also pushed to rubygems.org as dmitryv-backup.
To make it use 7zip add the following to your backup.rb config:

compressor :seven_zip

Regards,
Dmitry

Selectively backup only certain mysql tables

Is it possible to add the feature to backup only a few tables?

I modified the code myself but it would be nice to include this in the proper gem...

Should be fairly straight forward, but I don't know how to contribute to the project and issue changes...

I literally just added a 'table_to_include' option here...

lib/backup/adapters/mysql.rb

attr_accessor :dumped_file, :compressed_file, :encrypted_file, :user, :password, :database, :skip_tables, :tables, :host, :port, :socket, :additional_options

Dumps and Compresses the MySQL file

    def mysqldump
      puts system_messages[:mysqldump]; puts system_messages[:compressing]
      %x{ mysqldump -u #{user} --password='#{password}' #{options} #{additional_options} #{database} #{tables_to_include} #{tables_to_skip} | gzip -f --best > #{File.join(tmp_path, compressed_file)} }
    end

    # Returns a list of tables to include in MySQL syntax
    def tables_to_include
      if tables.is_a?(Array)
        tables.join(" ")
      elsif skip_tables.is_a?(String)
        tables
      else
        ""
      end
    end

FTP support

Great work - just noticed you released a new gem

wondering if you might consider support FTP? I know it's a bit old fashioned but it's fairly widely used still and some hosts (like mine) provide backup space over FTP only.

Cheers

Steve

Use DataMapper over ActiveRecord?

This might simplify particular gem updates/migrations from older to newer versions.

I know DataMapper has a nice command that auto-migrates a database when new migrations are available. So when new columns/tables are added, these will automatically be upgraded. Other than that I am not sure whether DataMapper is more lightweight than ActiveRecord.

Might be a good idea to step away from ActiveRecord I see it more a part of Ruby on Rails, rather than a "stand-alone" tool. Plus it might conflict when using in combination with a different Rails version in production as well.

Email Notifications

This is a feature that will probably be added in the near future.

It will optionally notify you when a backup was successfully created and transferred.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.