interu-backup 3.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +31 -0
  3. data/Gemfile.lock +117 -0
  4. data/Guardfile +17 -0
  5. data/LICENSE.md +24 -0
  6. data/README.md +332 -0
  7. data/backup.gemspec +31 -0
  8. data/bin/backup +267 -0
  9. data/lib/backup.rb +181 -0
  10. data/lib/backup/archive.rb +73 -0
  11. data/lib/backup/cli.rb +82 -0
  12. data/lib/backup/compressor/base.rb +17 -0
  13. data/lib/backup/compressor/bzip2.rb +64 -0
  14. data/lib/backup/compressor/gzip.rb +61 -0
  15. data/lib/backup/configuration/base.rb +15 -0
  16. data/lib/backup/configuration/compressor/base.rb +10 -0
  17. data/lib/backup/configuration/compressor/bzip2.rb +23 -0
  18. data/lib/backup/configuration/compressor/gzip.rb +23 -0
  19. data/lib/backup/configuration/database/base.rb +18 -0
  20. data/lib/backup/configuration/database/mongodb.rb +41 -0
  21. data/lib/backup/configuration/database/mysql.rb +37 -0
  22. data/lib/backup/configuration/database/postgresql.rb +37 -0
  23. data/lib/backup/configuration/database/redis.rb +35 -0
  24. data/lib/backup/configuration/encryptor/base.rb +10 -0
  25. data/lib/backup/configuration/encryptor/gpg.rb +17 -0
  26. data/lib/backup/configuration/encryptor/open_ssl.rb +26 -0
  27. data/lib/backup/configuration/helpers.rb +54 -0
  28. data/lib/backup/configuration/notifier/base.rb +39 -0
  29. data/lib/backup/configuration/notifier/campfire.rb +25 -0
  30. data/lib/backup/configuration/notifier/mail.rb +52 -0
  31. data/lib/backup/configuration/notifier/presently.rb +25 -0
  32. data/lib/backup/configuration/notifier/twitter.rb +21 -0
  33. data/lib/backup/configuration/storage/base.rb +18 -0
  34. data/lib/backup/configuration/storage/cloudfiles.rb +21 -0
  35. data/lib/backup/configuration/storage/dropbox.rb +29 -0
  36. data/lib/backup/configuration/storage/ftp.rb +25 -0
  37. data/lib/backup/configuration/storage/rsync.rb +25 -0
  38. data/lib/backup/configuration/storage/s3.rb +25 -0
  39. data/lib/backup/configuration/storage/scp.rb +25 -0
  40. data/lib/backup/configuration/storage/sftp.rb +25 -0
  41. data/lib/backup/configuration/syncer/rsync.rb +45 -0
  42. data/lib/backup/configuration/syncer/s3.rb +33 -0
  43. data/lib/backup/database/base.rb +33 -0
  44. data/lib/backup/database/mongodb.rb +179 -0
  45. data/lib/backup/database/mysql.rb +104 -0
  46. data/lib/backup/database/postgresql.rb +111 -0
  47. data/lib/backup/database/redis.rb +105 -0
  48. data/lib/backup/dependency.rb +96 -0
  49. data/lib/backup/encryptor/base.rb +17 -0
  50. data/lib/backup/encryptor/gpg.rb +78 -0
  51. data/lib/backup/encryptor/open_ssl.rb +67 -0
  52. data/lib/backup/exception/command_not_found.rb +8 -0
  53. data/lib/backup/finder.rb +39 -0
  54. data/lib/backup/logger.rb +102 -0
  55. data/lib/backup/model.rb +272 -0
  56. data/lib/backup/notifier/base.rb +29 -0
  57. data/lib/backup/notifier/binder.rb +32 -0
  58. data/lib/backup/notifier/campfire.rb +194 -0
  59. data/lib/backup/notifier/mail.rb +141 -0
  60. data/lib/backup/notifier/presently.rb +105 -0
  61. data/lib/backup/notifier/templates/notify_failure.erb +33 -0
  62. data/lib/backup/notifier/templates/notify_success.erb +16 -0
  63. data/lib/backup/notifier/twitter.rb +87 -0
  64. data/lib/backup/storage/base.rb +67 -0
  65. data/lib/backup/storage/cloudfiles.rb +95 -0
  66. data/lib/backup/storage/dropbox.rb +91 -0
  67. data/lib/backup/storage/ftp.rb +114 -0
  68. data/lib/backup/storage/object.rb +45 -0
  69. data/lib/backup/storage/rsync.rb +129 -0
  70. data/lib/backup/storage/s3.rb +180 -0
  71. data/lib/backup/storage/scp.rb +106 -0
  72. data/lib/backup/storage/sftp.rb +106 -0
  73. data/lib/backup/syncer/base.rb +10 -0
  74. data/lib/backup/syncer/rsync.rb +152 -0
  75. data/lib/backup/syncer/s3.rb +118 -0
  76. data/lib/backup/version.rb +43 -0
  77. data/lib/templates/archive +7 -0
  78. data/lib/templates/compressor/bzip2 +7 -0
  79. data/lib/templates/compressor/gzip +7 -0
  80. data/lib/templates/database/mongodb +14 -0
  81. data/lib/templates/database/mysql +14 -0
  82. data/lib/templates/database/postgresql +14 -0
  83. data/lib/templates/database/redis +13 -0
  84. data/lib/templates/encryptor/gpg +12 -0
  85. data/lib/templates/encryptor/openssl +8 -0
  86. data/lib/templates/notifier/campfire +11 -0
  87. data/lib/templates/notifier/mail +17 -0
  88. data/lib/templates/notifier/presently +12 -0
  89. data/lib/templates/notifier/twitter +12 -0
  90. data/lib/templates/readme +15 -0
  91. data/lib/templates/storage/cloudfiles +10 -0
  92. data/lib/templates/storage/dropbox +12 -0
  93. data/lib/templates/storage/ftp +11 -0
  94. data/lib/templates/storage/rsync +10 -0
  95. data/lib/templates/storage/s3 +21 -0
  96. data/lib/templates/storage/scp +11 -0
  97. data/lib/templates/storage/sftp +11 -0
  98. data/lib/templates/syncer/rsync +17 -0
  99. data/lib/templates/syncer/s3 +15 -0
  100. data/spec/archive_spec.rb +90 -0
  101. data/spec/backup_spec.rb +11 -0
  102. data/spec/compressor/bzip2_spec.rb +59 -0
  103. data/spec/compressor/gzip_spec.rb +59 -0
  104. data/spec/configuration/base_spec.rb +35 -0
  105. data/spec/configuration/compressor/gzip_spec.rb +28 -0
  106. data/spec/configuration/database/base_spec.rb +16 -0
  107. data/spec/configuration/database/mongodb_spec.rb +30 -0
  108. data/spec/configuration/database/mysql_spec.rb +32 -0
  109. data/spec/configuration/database/postgresql_spec.rb +32 -0
  110. data/spec/configuration/database/redis_spec.rb +30 -0
  111. data/spec/configuration/encryptor/gpg_spec.rb +25 -0
  112. data/spec/configuration/encryptor/open_ssl_spec.rb +31 -0
  113. data/spec/configuration/notifier/campfire_spec.rb +20 -0
  114. data/spec/configuration/notifier/mail_spec.rb +32 -0
  115. data/spec/configuration/notifier/twitter_spec.rb +22 -0
  116. data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
  117. data/spec/configuration/storage/dropbox_spec.rb +43 -0
  118. data/spec/configuration/storage/ftp_spec.rb +40 -0
  119. data/spec/configuration/storage/rsync_spec.rb +37 -0
  120. data/spec/configuration/storage/s3_spec.rb +37 -0
  121. data/spec/configuration/storage/scp_spec.rb +40 -0
  122. data/spec/configuration/storage/sftp_spec.rb +40 -0
  123. data/spec/configuration/syncer/rsync_spec.rb +46 -0
  124. data/spec/configuration/syncer/s3_spec.rb +43 -0
  125. data/spec/database/base_spec.rb +30 -0
  126. data/spec/database/mongodb_spec.rb +181 -0
  127. data/spec/database/mysql_spec.rb +150 -0
  128. data/spec/database/postgresql_spec.rb +164 -0
  129. data/spec/database/redis_spec.rb +122 -0
  130. data/spec/encryptor/gpg_spec.rb +57 -0
  131. data/spec/encryptor/open_ssl_spec.rb +102 -0
  132. data/spec/logger_spec.rb +58 -0
  133. data/spec/model_spec.rb +236 -0
  134. data/spec/notifier/campfire_spec.rb +96 -0
  135. data/spec/notifier/mail_spec.rb +97 -0
  136. data/spec/notifier/presently_spec.rb +99 -0
  137. data/spec/notifier/twitter_spec.rb +86 -0
  138. data/spec/spec_helper.rb +25 -0
  139. data/spec/storage/base_spec.rb +33 -0
  140. data/spec/storage/cloudfiles_spec.rb +102 -0
  141. data/spec/storage/dropbox_spec.rb +105 -0
  142. data/spec/storage/ftp_spec.rb +133 -0
  143. data/spec/storage/object_spec.rb +74 -0
  144. data/spec/storage/rsync_spec.rb +131 -0
  145. data/spec/storage/s3_spec.rb +110 -0
  146. data/spec/storage/scp_spec.rb +129 -0
  147. data/spec/storage/sftp_spec.rb +125 -0
  148. data/spec/syncer/rsync_spec.rb +195 -0
  149. data/spec/syncer/s3_spec.rb +139 -0
  150. data/spec/version_spec.rb +21 -0
  151. metadata +231 -0
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,31 @@
1
+ ##
2
+ # RubyGems Source
3
+ source 'http://rubygems.org'
4
+
5
+ ##
6
+ # Load Backup::Dependency
7
+ %w[cli dependency].each do |path|
8
+ require File.expand_path("../lib/backup/#{path}", __FILE__)
9
+ end
10
+
11
+ ##
12
+ # Dynamically define the dependencies specified in Backup::Dependency.all
13
+ Backup::Dependency.all.each do |name, gemspec|
14
+ gem(name, gemspec[:version])
15
+ end
16
+
17
+ ##
18
+ # Define gems to be used in the 'test' environment
19
+ group :test do
20
+ gem 'rspec'
21
+ gem 'mocha'
22
+ gem 'timecop'
23
+ gem 'fuubar'
24
+
25
+ gem 'guard'
26
+ gem 'guard-rspec'
27
+ gem 'rb-fsevent' # guard notifications for osx
28
+ gem 'growl' # $ brew install growlnotify
29
+ gem 'rb-inotify' # guard notifications for linux
30
+ gem 'libnotify' # $ apt-get install ???
31
+ end
@@ -0,0 +1,117 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.0.5)
5
+ addressable (2.2.4)
6
+ builder (3.0.0)
7
+ crack (0.1.8)
8
+ diff-lcs (1.1.2)
9
+ dropbox (1.2.3)
10
+ json (>= 1.2.0)
11
+ mechanize (>= 1.0.0)
12
+ multipart-post (>= 1.0)
13
+ oauth (>= 0.3.6)
14
+ excon (0.5.6)
15
+ faraday (0.5.7)
16
+ addressable (~> 2.2.4)
17
+ multipart-post (~> 1.1.0)
18
+ rack (< 2, >= 1.1.0)
19
+ faraday_middleware (0.3.2)
20
+ faraday (~> 0.5.4)
21
+ ffi (1.0.9)
22
+ fog (0.7.0)
23
+ builder
24
+ excon (>= 0.5.5)
25
+ formatador (>= 0.1.1)
26
+ json
27
+ mime-types
28
+ net-ssh (>= 2.0.23)
29
+ nokogiri (>= 1.4.4)
30
+ ruby-hmac
31
+ formatador (0.1.1)
32
+ fuubar (0.0.5)
33
+ rspec (~> 2.0)
34
+ rspec-instafail (~> 0.1.4)
35
+ ruby-progressbar (~> 0.0.10)
36
+ growl (1.0.3)
37
+ guard (0.3.4)
38
+ thor (~> 0.14.6)
39
+ guard-rspec (0.3.1)
40
+ guard (>= 0.2.2)
41
+ hashie (1.0.0)
42
+ httparty (0.7.4)
43
+ crack (= 0.1.8)
44
+ i18n (0.5.0)
45
+ json (1.5.1)
46
+ libnotify (0.5.5)
47
+ mail (2.2.15)
48
+ activesupport (>= 2.3.6)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mechanize (1.0.0)
53
+ nokogiri (>= 1.2.1)
54
+ mime-types (1.16)
55
+ mocha (0.9.12)
56
+ multi_json (0.0.5)
57
+ multi_xml (0.2.1)
58
+ multipart-post (1.1.0)
59
+ net-scp (1.0.4)
60
+ net-ssh (>= 1.99.1)
61
+ net-sftp (2.0.5)
62
+ net-ssh (>= 2.0.9)
63
+ net-ssh (2.1.3)
64
+ nokogiri (1.4.4)
65
+ oauth (0.4.4)
66
+ polyglot (0.3.1)
67
+ rack (1.2.2)
68
+ rb-fsevent (0.4.0)
69
+ rb-inotify (0.8.5)
70
+ ffi (>= 0.5.0)
71
+ rspec (2.5.0)
72
+ rspec-core (~> 2.5.0)
73
+ rspec-expectations (~> 2.5.0)
74
+ rspec-mocks (~> 2.5.0)
75
+ rspec-core (2.5.1)
76
+ rspec-expectations (2.5.0)
77
+ diff-lcs (~> 1.1.2)
78
+ rspec-instafail (0.1.7)
79
+ rspec-mocks (2.5.0)
80
+ ruby-hmac (0.4.0)
81
+ ruby-progressbar (0.0.10)
82
+ simple_oauth (0.1.4)
83
+ thor (0.14.6)
84
+ timecop (0.3.5)
85
+ treetop (1.4.9)
86
+ polyglot (>= 0.3.1)
87
+ twitter (1.1.2)
88
+ faraday (~> 0.5.4)
89
+ faraday_middleware (~> 0.3.1)
90
+ hashie (~> 1.0.0)
91
+ multi_json (~> 0.0.5)
92
+ multi_xml (~> 0.2.0)
93
+ simple_oauth (~> 0.1.3)
94
+
95
+ PLATFORMS
96
+ ruby
97
+
98
+ DEPENDENCIES
99
+ dropbox (~> 1.2.3)
100
+ fog (~> 0.7.0)
101
+ fuubar
102
+ growl
103
+ guard
104
+ guard-rspec
105
+ httparty (~> 0.7.4)
106
+ json (~> 1.5.1)
107
+ libnotify
108
+ mail (~> 2.2.15)
109
+ mocha
110
+ net-scp (~> 1.0.4)
111
+ net-sftp (~> 2.0.5)
112
+ net-ssh (~> 2.1.3)
113
+ rb-fsevent
114
+ rb-inotify
115
+ rspec
116
+ timecop
117
+ twitter (~> 1.1.2)
@@ -0,0 +1,17 @@
1
+ ##
2
+ # To run the test suite against all 3 rubies: 1.9.2, 1.8.7 and REE, simply run the following command:
3
+ # $ guard start
4
+ #
5
+ # Be use you are using RVM and have Ruby 1.9.2, 1.8.7 and REE installed as well as all
6
+ # Backup's gem dependencies for each of these Ruby intepreters.
7
+
8
+ guard 'rspec',
9
+ :version => 2,
10
+ :rvm => ['1.9.2', '1.8.7', 'ree'],
11
+ :bundler => true,
12
+ :cli => '--color --format Fuubar --fail-fast' do
13
+
14
+ watch(%r{^spec/.+_spec\.rb})
15
+ watch(%r{^lib/(.+)\.rb}) { 'spec' }
16
+ watch('spec/spec_helper.rb') { 'spec' }
17
+ end
@@ -0,0 +1,24 @@
1
+
2
+ Copyright (c) 2009-2011 Michael van Rooijen ( [@meskyanichi](http://twitter.com/#!/meskyanichi) )
3
+ =================================================================================================
4
+
5
+ The "Backup" RubyGem is released under the **MIT LICENSE**
6
+ ----------------------------------------------------------
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
@@ -0,0 +1,332 @@
1
+ Backup 3
2
+ ========
3
+
4
+ Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily perform backup operations on both your remote, as well as your local environment. It provides you with an elegant DSL in Ruby for modeling (configuring) 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.
5
+
6
+
7
+ Author
8
+ ------
9
+
10
+ **[Michael van Rooijen](http://michaelvanrooijen.com/) ( [@meskyanichi](http://twitter.com/#!/meskyanichi) )**
11
+
12
+ Drop me a message for any questions, suggestions, requests, bugs or submit them to the [issue log](https://github.com/meskyanichi/backup/issues).
13
+
14
+
15
+ Installation
16
+ ------------
17
+
18
+ To get the latest stable version
19
+
20
+ gem install backup
21
+
22
+ You can view the list of released versions over at [RubyGems.org (Backup)](https://rubygems.org/gems/backup/versions)
23
+
24
+ Getting Started
25
+ ---------------
26
+
27
+ I recommend you read this README first, and refer to the [Wiki pages](https://github.com/meskyanichi/backup/wiki) afterwards. There's also a [Getting Started wiki page](https://github.com/meskyanichi/backup/wiki/Getting-Started).
28
+
29
+ What Backup 3 currently supports
30
+ ================================
31
+
32
+ Below you find a list of components that Backup currently supports. Each of these compontents is isolated, meaning that adding new databases, storage location / service, compressor, encryptor or notifier is easy to do.
33
+
34
+ Database Support
35
+ ----------------
36
+
37
+ - MySQL
38
+ - PostgreSQL
39
+ - MongoDB
40
+ - Redis
41
+
42
+ [Database Wiki Page](https://github.com/meskyanichi/backup/wiki/Databases)
43
+
44
+ Filesystem Support
45
+ ------------------
46
+
47
+ - Files
48
+ - Directories
49
+
50
+ [Archive Wiki Page](https://github.com/meskyanichi/backup/wiki/Archives)
51
+
52
+ Storage Locations and Services
53
+ ------------------------------
54
+
55
+ - Amazon Simple Storage Service (S3)
56
+ - Rackspace Cloud Files (Mosso)
57
+ - Dropbox
58
+ - Remote Servers *(Available Protocols: FTP, SFTP, SCP and RSync)*
59
+
60
+ [Storage Wiki Page](https://github.com/meskyanichi/backup/wiki/Storages)
61
+
62
+ Storage Features
63
+ ----------------
64
+
65
+ - Backup Cycling, applies to:
66
+ - Amazon Simple Storage Service (S3)
67
+ - Rackspace Cloud Files (Mosso)
68
+ - Dropbox
69
+ - Remote Servers *(Only Protocols: FTP, SFTP, SCP)*
70
+ - Incremental Backups, applies to:
71
+ - Remote Servers *(Only Protocols: RSync)*
72
+
73
+ [Storage Wiki Page](https://github.com/meskyanichi/backup/wiki/Storages)
74
+
75
+ Syncers
76
+ -------
77
+
78
+ - RSync
79
+ - Amazon Simple Storage Service (S3)
80
+
81
+ [Syncer Wiki Page](https://github.com/meskyanichi/backup/wiki/Syncers)
82
+
83
+ Compressors
84
+ -----------
85
+
86
+ - Gzip
87
+ - Bzip2
88
+
89
+ [Compressors Wiki Page](https://github.com/meskyanichi/backup/wiki/Compressors)
90
+
91
+ Encryptors
92
+ ----------
93
+
94
+ - OpenSSL
95
+ - GPG
96
+
97
+ [Encryptors Wiki Page](https://github.com/meskyanichi/backup/wiki/Encryptors)
98
+
99
+ Notifiers
100
+ ---------
101
+
102
+ - Mail
103
+ - Twitter
104
+ - Campfire
105
+ - Presently
106
+
107
+ [Notifiers Wiki Page](https://github.com/meskyanichi/backup/wiki/Notifiers)
108
+
109
+ Supported Ruby versions (Tested with RSpec)
110
+ -------------------------------------------
111
+
112
+ - Ruby 1.9.2
113
+ - Ruby 1.8.7
114
+ - Ruby Enterprise Edition 1.8.7
115
+
116
+
117
+ A sample Backup configuration file
118
+ ==================================
119
+
120
+ This is a Backup configuration file. Check it out and read the explanation below. Backup has a [great wiki](https://github.com/meskyanichi/backup/wiki) which explains each component of Backup in detail.
121
+
122
+ Backup::Model.new(:sample_backup, 'A sample backup configuration') do
123
+
124
+ database MySQL do |database|
125
+ database.name = 'my_sample_mysql_db'
126
+ database.username = 'my_username'
127
+ database.password = 'my_password'
128
+ database.skip_tables = ['logs']
129
+ database.additional_options = ['--single-transaction', '--quick']
130
+ end
131
+
132
+ database MongoDB do |database|
133
+ database.name = 'my_sample_mongo_db'
134
+ database.only_collections = ['users', 'events', 'posts']
135
+ end
136
+
137
+ archive :user_avatars do |archive|
138
+ archive.add '/var/apps/my_sample_app/public/avatars'
139
+ end
140
+
141
+ archive :logs do |archive|
142
+ archive.add '/var/apps/my_sample_app/logs/production.log'
143
+ archive.add '/var/apps/my_sample_app/logs/newrelic_agent.log'
144
+ archive.add '/var/apps/my_sample_app/logs/other.log'
145
+ end
146
+
147
+ encrypt_with OpenSSL do |encryption|
148
+ encryption.password = 'my_secret_password'
149
+ end
150
+
151
+ compress_with Gzip do |compression|
152
+ compression.best = true
153
+ end
154
+
155
+ store_with S3 do |s3|
156
+ s3.access_key_id = 'my_access_key_id'
157
+ s3.secret_access_key = 'my_secret_access_key'
158
+ s3.region = 'us-east-1'
159
+ s3.bucket = 'my_bucket/backups'
160
+ s3.keep = 20
161
+ end
162
+
163
+ sync_with S3 do |s3|
164
+ s3.access_key_id = "my_access_key_id"
165
+ s3.secret_access_key = "my_secret_access_key"
166
+ s3.bucket = "my-bucket"
167
+ s3.path = "/backups"
168
+ s3.mirror = true
169
+
170
+ s3.directories do |directory|
171
+ directory.add "/var/apps/my_app/public/videos"
172
+ directory.add "/var/apps/my_app/public/music"
173
+ end
174
+ end
175
+
176
+ notify_by Mail do |mail|
177
+ mail.on_success = false
178
+ mail.on_failure = true
179
+ end
180
+
181
+ notify_by Twitter do |tweet|
182
+ tweet.on_success = true
183
+ tweet.on_failure = true
184
+ end
185
+
186
+ end
187
+
188
+ ### Brief explanation for the above example configuration
189
+
190
+ It will dump two databases (MySQL and MongoDB), it'll create two (.t)archives (user_avatars and logs). It'll package the two database and two archives together in a single (.t)archive. It'll run the Gzip compressor to compress that archive, and then it'll run the OpenSSL encryptor to encrypt the compressed archive. Then that encrypted archive will be stored to your Amazon S3 account. If all goes well, and no exceptions are raised, you'll be notified via the Twitter notifier that the backup succeeded. If there was an exception raised during the backup process, then you'd receive an email in your inbox containing detailed exception information, as well as receive a simple Twitter message that something went wrong.
191
+
192
+ As you can see, you can freely mix and match **archives**, **databases**, **compressors**, **encryptors**, **storages** and **notifiers** for your backups. You could even specify 3 storage locations: Amazon S3, Rackspace Cloud Files and Dropbox, it'd then store your packaged backup to 3 separate locations for high redundancy. This also applies to encryptors, you could double encrypt your backup with OpenSSL followed by GPG if you wanted.
193
+
194
+ Additionally we have also defined a **S3 Syncer** ( `sync_with S3` ), which does not follow the above process of archiving/compression/encryption, but instead will directly sync the whole `videos` and `music` folder structures from your machine to your Amazon S3 account. (very efficient and cost-effective since it will only transfer files that were changed!)
195
+
196
+ There are more **archives**, **databases**, **compressors**, **encryptors**, **storages** and **notifiers** than displayed in the example, all available components are listed at the top of this README, as well as in the [Wiki](https://github.com/meskyanichi/backup/wiki).
197
+
198
+ ### Running the example
199
+
200
+ Notice the `Backup::Model.new(:sample_backup, 'A sample backup configuration') do` at the top of the above example. The `:sample_backup` is called the **trigger**. This is used to identify the backup procedure/file and initialize it.
201
+
202
+ backup perform -t [--trigger] sample_backup
203
+
204
+ Now it'll run the backup, it's as simple as that.
205
+
206
+ ### Automatic backups
207
+
208
+ Since Backup is a simple command line utility, you should write a crontask to invoke it periodically. I recommend you use [Whenever](https://github.com/javan/whenever) to manage your crontab. It'll allow you to write to the crontab in pure Ruby, it provides an elegant DSL to do so, for example:
209
+
210
+ every 6.hours do
211
+ command "backup perform --trigger sample_backup"
212
+ end
213
+
214
+ With this in place, run `whenever --update-crontab backup` to write this Ruby syntax to the crontab in cron-syntax. The operating system will now invoke `backup perform --trigger sample_backup` every 6 hours. Check out the Whenever project page for more information.
215
+
216
+ Documentation
217
+ -------------
218
+
219
+ See the [Wiki Pages](https://github.com/meskyanichi/backup/wiki). The subjects labeled **without** the "Backup 2)"-prefix are meant for Backup 3 users.
220
+
221
+
222
+ Suggestions, Bugs, Requests, Questions
223
+ --------------------------------------
224
+
225
+ View the [issue log](https://github.com/meskyanichi/backup/issues) and post them there.
226
+
227
+ Contributors
228
+ ------------
229
+
230
+ <table>
231
+ <tr>
232
+ <th>Contributor</th>
233
+ <th>Contribution</th>
234
+ </tr>
235
+ <tr>
236
+ <td><a href="https://github.com/asanghi" target="_blank">Aditya Sanghi ( asanghi )</a></td>
237
+ <td>Twitter Notifier, Dropbox Timeout Configuration</td>
238
+ </tr>
239
+ <tr>
240
+ <td><a href="https://github.com/phlipper" target="_blank">Phil Cohen ( phlipper )</a></td>
241
+ <td>Exclude Option for Archives</td>
242
+ </tr>
243
+ <tr>
244
+ <td><a href="https://github.com/arunagw" target="_blank">Arun Agrawal ( arunagw )</a></td>
245
+ <td>Campfire notifier</td>
246
+ </tr>
247
+ <tr>
248
+ <td><a href="https://github.com/szimmermann" target="_blank">Stefan Zimmermann ( szimmermann )</a></td>
249
+ <td>Enabling package/archive (tar utility) support for more Linux distro's (FreeBSD, etc)</td>
250
+ </tr>
251
+ <tr>
252
+ <td><a href="https://github.com/trystant" target="_blank">Mark Nyon ( trystant )</a></td>
253
+ <td>Helping discuss MongoDump Lock/FSync problem</td>
254
+ </tr>
255
+ <tr>
256
+ <td><a href="https://github.com/imanel" target="_blank">Bernard Potocki ( imanel )</a></td>
257
+ <td>Helping discuss MongoDump Lock/FSync problem + Submitting a patch</td>
258
+ </tr>
259
+ <tr>
260
+ <td><a href="https://github.com/tomash" target="_blank">Tomasz Stachewicz ( tomash )</a></td>
261
+ <td>Helping discuss MongoDump Lock/FSync problem + Submitting a patch</td>
262
+ </tr>
263
+ <tr>
264
+ <td><a href="https://github.com/lapluviosilla" target="_blank">Paul Strong ( lapluviosilla )</a></td>
265
+ <td>Helping discuss MongoDump Lock/FSync problem</td>
266
+ </tr>
267
+ <tr>
268
+ <td><a href="https://github.com/rgnitz" target="_blank">Ryan ( rgnitz )</a></td>
269
+ <td>Helping discuss MongoDump Lock/FSync problem</td>
270
+ </tr>
271
+ <tr>
272
+ <td><a href="https://github.com/tsigo" target="_blank">Robert Speicher ( tsigo )</a></td>
273
+ <td>Adding the --quiet [-q] feature to Backup to silence console logging</td>
274
+ </tr>
275
+ <tr>
276
+ <td><a href="https://github.com/jwhitcraft" target="_blank">Jon Whitcraft ( jwhitcraft )</a></td>
277
+ <td>Adding the ability to add additional options to the S3Syncer</td>
278
+ </tr>
279
+ <tr>
280
+ <td><a href="https://github.com/bgarret" target="_blank">Benoit Garret ( bgarret )</a></td>
281
+ <td>Presently notifier</td>
282
+ </tr>
283
+ </table>
284
+
285
+
286
+ Want to contribute?
287
+ -------------------
288
+
289
+ - Fork/Clone the **develop** branch
290
+ - Write RSpec tests, and test against:
291
+ - Ruby 1.9.2
292
+ - Ruby 1.8.7
293
+ - Ruby Enterprise Edition 1.8.7
294
+ - Try to keep the overall *structure / design* of the gem the same
295
+
296
+ I can't guarantee I'll pull every pull request. Also, I may accept your pull request and drastically change parts to improve readability/maintainability. Feel free to discuss about improvements, new functionality/features in the [issue log](https://github.com/meskyanichi/backup/issues) before contributing if you need/want more information.
297
+
298
+ Easily run tests against all three Ruby versions
299
+ ------------------------------------------------
300
+
301
+ Install [RVM](https://rvm.beginrescueend.com/) and use it to install Ruby 1.9.2, 1.8.7 and REE.
302
+
303
+ rvm install 1.9.2 && rvm install 1.8.7 && rvm install ree
304
+
305
+ Once these are installed, go ahead and install all the necessary dependencies.
306
+
307
+ cd backup
308
+ rvm use 1.9.2 && gem install bundler && bundle install
309
+ rvm use 1.8.7 && gem install bundler && bundle install
310
+ rvm use ree && gem install bundler && bundle install
311
+
312
+ The Backup gem uses [Guard](https://github.com/guard/guard) along with [Guard::RSpec](https://github.com/guard/guard-rspec) to quickly and easily test Backup's code against all three Rubies. If you've done the above, all you have to do is run:
313
+
314
+ guard start
315
+
316
+ from Backup's root and that's it. It'll now test against all three Rubies each time you adjust a file in the `lib` or `spec` directories.
317
+
318
+
319
+ Or contribute by writing blogs/tutorials
320
+ ----------------------------------------
321
+
322
+ - http://erik.debill.org/2011/03/26/csing-backup-with-rails
323
+ - http://blog.noizeramp.com/2011/03/31/backing-up-backup-ruby-gem/
324
+ - http://www.sebaugereau.com/using-ruby-to-backup-with-beauty
325
+ - http://outofti.me/post/4159686269/backup-with-pgbackups
326
+ - http://h2ik.co/2011/03/backing-up-with-ruby/
327
+
328
+
329
+ Backup 2 - Issues, Wiki, Source, Gems
330
+ =====================================
331
+
332
+ I won't actively support Backup 2 anymore. The source will remain on [a separate branch](https://github.com/meskyanichi/backup/tree/backup-2). [The Issues](https://github.com/meskyanichi/backup/issues) that belong to Backup 2 have been tagged with a black label "Backup 2". The Backup 2 specific [Wiki pages](https://github.com/meskyanichi/backup/wiki) have been prefixed with "Backup 2) <Article>". [The Backup 2 Gems](http://rubygems.org/gems/backup) will always remain so you can still use Backup 2. I might still accept pull requests, but would highly encourage anyone to [move to __Backup 3__ once it's here](https://github.com/meskyanichi/backup).