backup 3.0.19 → 3.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +9 -8
  3. data/Gemfile.lock +19 -1
  4. data/Guardfile +13 -9
  5. data/README.md +93 -31
  6. data/backup.gemspec +3 -3
  7. data/bin/backup +6 -283
  8. data/lib/backup.rb +101 -72
  9. data/lib/backup/archive.rb +21 -9
  10. data/lib/backup/binder.rb +22 -0
  11. data/lib/backup/cleaner.rb +36 -0
  12. data/lib/backup/cli/helpers.rb +103 -0
  13. data/lib/backup/cli/utility.rb +308 -0
  14. data/lib/backup/compressor/base.rb +2 -2
  15. data/lib/backup/compressor/pbzip2.rb +76 -0
  16. data/lib/backup/configuration/compressor/pbzip2.rb +28 -0
  17. data/lib/backup/configuration/database/riak.rb +25 -0
  18. data/lib/backup/configuration/encryptor/open_ssl.rb +6 -0
  19. data/lib/backup/configuration/helpers.rb +5 -18
  20. data/lib/backup/configuration/notifier/base.rb +13 -0
  21. data/lib/backup/configuration/notifier/hipchat.rb +41 -0
  22. data/lib/backup/configuration/notifier/mail.rb +38 -0
  23. data/lib/backup/configuration/notifier/prowl.rb +23 -0
  24. data/lib/backup/configuration/storage/cloudfiles.rb +4 -0
  25. data/lib/backup/configuration/storage/dropbox.rb +8 -4
  26. data/lib/backup/database/base.rb +10 -2
  27. data/lib/backup/database/mongodb.rb +16 -19
  28. data/lib/backup/database/mysql.rb +2 -2
  29. data/lib/backup/database/postgresql.rb +2 -2
  30. data/lib/backup/database/redis.rb +15 -7
  31. data/lib/backup/database/riak.rb +45 -0
  32. data/lib/backup/dependency.rb +21 -7
  33. data/lib/backup/encryptor/base.rb +1 -1
  34. data/lib/backup/encryptor/open_ssl.rb +20 -5
  35. data/lib/backup/errors.rb +124 -0
  36. data/lib/backup/finder.rb +11 -3
  37. data/lib/backup/logger.rb +121 -82
  38. data/lib/backup/model.rb +103 -44
  39. data/lib/backup/notifier/base.rb +50 -0
  40. data/lib/backup/notifier/campfire.rb +32 -52
  41. data/lib/backup/notifier/hipchat.rb +99 -0
  42. data/lib/backup/notifier/mail.rb +100 -61
  43. data/lib/backup/notifier/presently.rb +31 -40
  44. data/lib/backup/notifier/prowl.rb +73 -0
  45. data/lib/backup/notifier/twitter.rb +29 -39
  46. data/lib/backup/packager.rb +25 -0
  47. data/lib/backup/splitter.rb +62 -0
  48. data/lib/backup/storage/base.rb +178 -18
  49. data/lib/backup/storage/cloudfiles.rb +34 -28
  50. data/lib/backup/storage/dropbox.rb +64 -67
  51. data/lib/backup/storage/ftp.rb +48 -40
  52. data/lib/backup/storage/local.rb +33 -28
  53. data/lib/backup/storage/ninefold.rb +40 -26
  54. data/lib/backup/storage/object.rb +8 -6
  55. data/lib/backup/storage/rsync.rb +61 -51
  56. data/lib/backup/storage/s3.rb +29 -27
  57. data/lib/backup/storage/scp.rb +56 -36
  58. data/lib/backup/storage/sftp.rb +49 -33
  59. data/lib/backup/syncer/base.rb +1 -1
  60. data/lib/backup/syncer/rsync.rb +1 -1
  61. data/lib/backup/template.rb +46 -0
  62. data/lib/backup/version.rb +1 -1
  63. data/spec/archive_spec.rb +34 -9
  64. data/spec/backup_spec.rb +1 -1
  65. data/spec/cli/helpers_spec.rb +35 -0
  66. data/spec/cli/utility_spec.rb +38 -0
  67. data/spec/compressor/bzip2_spec.rb +1 -1
  68. data/spec/compressor/gzip_spec.rb +1 -1
  69. data/spec/compressor/lzma_spec.rb +1 -1
  70. data/spec/compressor/pbzip2_spec.rb +63 -0
  71. data/spec/configuration/base_spec.rb +1 -1
  72. data/spec/configuration/compressor/bzip2_spec.rb +1 -1
  73. data/spec/configuration/compressor/gzip_spec.rb +1 -1
  74. data/spec/configuration/compressor/lzma_spec.rb +1 -1
  75. data/spec/configuration/database/base_spec.rb +1 -1
  76. data/spec/configuration/database/mongodb_spec.rb +1 -1
  77. data/spec/configuration/database/mysql_spec.rb +1 -1
  78. data/spec/configuration/database/postgresql_spec.rb +1 -1
  79. data/spec/configuration/database/redis_spec.rb +1 -1
  80. data/spec/configuration/database/riak_spec.rb +31 -0
  81. data/spec/configuration/encryptor/gpg_spec.rb +1 -1
  82. data/spec/configuration/encryptor/open_ssl_spec.rb +4 -1
  83. data/spec/configuration/notifier/campfire_spec.rb +1 -1
  84. data/spec/configuration/notifier/hipchat_spec.rb +43 -0
  85. data/spec/configuration/notifier/mail_spec.rb +34 -22
  86. data/spec/configuration/notifier/presently_spec.rb +1 -1
  87. data/spec/configuration/notifier/prowl_spec.rb +28 -0
  88. data/spec/configuration/notifier/twitter_spec.rb +1 -1
  89. data/spec/configuration/storage/cloudfiles_spec.rb +19 -16
  90. data/spec/configuration/storage/dropbox_spec.rb +1 -1
  91. data/spec/configuration/storage/ftp_spec.rb +1 -1
  92. data/spec/configuration/storage/local_spec.rb +1 -1
  93. data/spec/configuration/storage/ninefold_spec.rb +1 -1
  94. data/spec/configuration/storage/rsync_spec.rb +1 -1
  95. data/spec/configuration/storage/s3_spec.rb +1 -1
  96. data/spec/configuration/storage/scp_spec.rb +1 -1
  97. data/spec/configuration/storage/sftp_spec.rb +1 -1
  98. data/spec/configuration/syncer/rsync_spec.rb +1 -1
  99. data/spec/configuration/syncer/s3_spec.rb +1 -1
  100. data/spec/database/base_spec.rb +10 -1
  101. data/spec/database/mongodb_spec.rb +34 -7
  102. data/spec/database/mysql_spec.rb +8 -7
  103. data/spec/database/postgresql_spec.rb +8 -7
  104. data/spec/database/redis_spec.rb +39 -9
  105. data/spec/database/riak_spec.rb +50 -0
  106. data/spec/encryptor/gpg_spec.rb +1 -1
  107. data/spec/encryptor/open_ssl_spec.rb +77 -20
  108. data/spec/errors_spec.rb +306 -0
  109. data/spec/finder_spec.rb +91 -0
  110. data/spec/logger_spec.rb +254 -33
  111. data/spec/model_spec.rb +120 -15
  112. data/spec/notifier/campfire_spec.rb +127 -52
  113. data/spec/notifier/hipchat_spec.rb +193 -0
  114. data/spec/notifier/mail_spec.rb +290 -74
  115. data/spec/notifier/presently_spec.rb +290 -73
  116. data/spec/notifier/prowl_spec.rb +149 -0
  117. data/spec/notifier/twitter_spec.rb +106 -41
  118. data/spec/spec_helper.rb +8 -2
  119. data/spec/splitter_spec.rb +71 -0
  120. data/spec/storage/base_spec.rb +280 -19
  121. data/spec/storage/cloudfiles_spec.rb +38 -22
  122. data/spec/storage/dropbox_spec.rb +17 -13
  123. data/spec/storage/ftp_spec.rb +145 -55
  124. data/spec/storage/local_spec.rb +6 -6
  125. data/spec/storage/ninefold_spec.rb +70 -29
  126. data/spec/storage/object_spec.rb +44 -44
  127. data/spec/storage/rsync_spec.rb +186 -63
  128. data/spec/storage/s3_spec.rb +23 -24
  129. data/spec/storage/scp_spec.rb +116 -41
  130. data/spec/storage/sftp_spec.rb +124 -46
  131. data/spec/syncer/rsync_spec.rb +3 -3
  132. data/spec/syncer/s3_spec.rb +1 -1
  133. data/spec/version_spec.rb +1 -1
  134. data/templates/cli/utility/archive +13 -0
  135. data/{lib/templates → templates/cli/utility}/compressor/bzip2 +1 -1
  136. data/{lib/templates → templates/cli/utility}/compressor/gzip +1 -1
  137. data/{lib/templates → templates/cli/utility}/compressor/lzma +0 -0
  138. data/templates/cli/utility/compressor/pbzip2 +7 -0
  139. data/templates/cli/utility/config +31 -0
  140. data/{lib/templates → templates/cli/utility}/database/mongodb +1 -1
  141. data/{lib/templates → templates/cli/utility}/database/mysql +1 -1
  142. data/{lib/templates → templates/cli/utility}/database/postgresql +1 -1
  143. data/{lib/templates → templates/cli/utility}/database/redis +1 -1
  144. data/templates/cli/utility/database/riak +8 -0
  145. data/{lib/templates → templates/cli/utility}/encryptor/gpg +1 -1
  146. data/templates/cli/utility/encryptor/openssl +9 -0
  147. data/templates/cli/utility/model.erb +23 -0
  148. data/{lib/templates → templates/cli/utility}/notifier/campfire +2 -1
  149. data/templates/cli/utility/notifier/hipchat +15 -0
  150. data/{lib/templates → templates/cli/utility}/notifier/mail +6 -1
  151. data/{lib/templates → templates/cli/utility}/notifier/presently +1 -0
  152. data/templates/cli/utility/notifier/prowl +11 -0
  153. data/{lib/templates → templates/cli/utility}/notifier/twitter +2 -1
  154. data/templates/cli/utility/splitter +7 -0
  155. data/templates/cli/utility/storage/cloudfiles +12 -0
  156. data/{lib/templates → templates/cli/utility}/storage/dropbox +1 -1
  157. data/{lib/templates → templates/cli/utility}/storage/ftp +0 -0
  158. data/templates/cli/utility/storage/local +7 -0
  159. data/{lib/templates → templates/cli/utility}/storage/ninefold +1 -1
  160. data/templates/cli/utility/storage/rsync +11 -0
  161. data/{lib/templates → templates/cli/utility}/storage/s3 +0 -2
  162. data/templates/cli/utility/storage/scp +11 -0
  163. data/templates/cli/utility/storage/sftp +11 -0
  164. data/{lib/templates → templates/cli/utility}/syncer/rsync +1 -1
  165. data/{lib/templates → templates/cli/utility}/syncer/s3 +1 -1
  166. data/templates/general/links +11 -0
  167. data/templates/general/version.erb +2 -0
  168. data/templates/notifier/mail/failure.erb +9 -0
  169. data/templates/notifier/mail/success.erb +7 -0
  170. data/templates/notifier/mail/warning.erb +9 -0
  171. data/templates/storage/dropbox/authorization_url.erb +6 -0
  172. data/templates/storage/dropbox/authorized.erb +4 -0
  173. data/templates/storage/dropbox/cache_file_written.erb +10 -0
  174. metadata +81 -45
  175. data/lib/backup/cli.rb +0 -110
  176. data/lib/backup/exception/command_failed.rb +0 -8
  177. data/lib/backup/exception/command_not_found.rb +0 -8
  178. data/lib/backup/notifier/binder.rb +0 -32
  179. data/lib/backup/notifier/templates/notify_failure.erb +0 -33
  180. data/lib/backup/notifier/templates/notify_success.erb +0 -16
  181. data/lib/templates/archive +0 -7
  182. data/lib/templates/encryptor/openssl +0 -8
  183. data/lib/templates/readme +0 -15
  184. data/lib/templates/storage/cloudfiles +0 -11
  185. data/lib/templates/storage/local +0 -7
  186. data/lib/templates/storage/rsync +0 -11
  187. data/lib/templates/storage/scp +0 -11
  188. data/lib/templates/storage/sftp +0 -11
data/.gitignore CHANGED
@@ -1,3 +1,7 @@
1
1
  .DS_Store
2
2
  *.gem
3
3
  .rvmrc
4
+ .bundle/
5
+ vendor/bundle
6
+ *.swp
7
+ *.swo
data/Gemfile CHANGED
@@ -1,20 +1,21 @@
1
- ##
1
+ # encoding: utf-8
2
+
2
3
  # RubyGems Source
3
4
  source 'http://rubygems.org'
4
5
 
5
- ##
6
+ # Include gem dependencies from the gemspec for development purposes
7
+ gemspec
8
+
6
9
  # Load Backup::Dependency
7
- %w[cli dependency].each do |path|
8
- require File.expand_path("../lib/backup/#{path}", __FILE__)
10
+ ["cli/helpers", "dependency"].each do |library|
11
+ require File.expand_path("../lib/backup/#{library}", __FILE__)
9
12
  end
10
13
 
11
- ##
12
14
  # Dynamically define the dependencies specified in Backup::Dependency.all
13
15
  Backup::Dependency.all.each do |name, gemspec|
14
16
  gem(name, gemspec[:version])
15
17
  end
16
18
 
17
- ##
18
19
  # Define gems to be used in the 'test' environment
19
20
  group :test do
20
21
  gem 'rspec'
@@ -24,8 +25,8 @@ group :test do
24
25
 
25
26
  gem 'guard'
26
27
  gem 'guard-rspec'
27
- gem 'rb-fsevent' # guard notifications for osx
28
+ gem 'rb-fsevent' # guard notifications for osx
28
29
  gem 'growl' # $ brew install growlnotify
29
30
  gem 'rb-inotify' # guard notifications for linux
30
31
  gem 'libnotify' # $ apt-get install ???
31
- end
32
+ end
data/Gemfile.lock CHANGED
@@ -1,6 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ backup (3.0.19)
5
+ POpen4 (~> 0.1.4)
6
+ thor (~> 0.14.6)
7
+
1
8
  GEM
2
9
  remote: http://rubygems.org/
3
10
  specs:
11
+ POpen4 (0.1.4)
12
+ Platform (>= 0.4.0)
13
+ open4
14
+ Platform (0.4.0)
4
15
  addressable (2.2.6)
5
16
  builder (3.0.0)
6
17
  crack (0.1.8)
@@ -38,6 +49,8 @@ GEM
38
49
  guard-rspec (0.3.1)
39
50
  guard (>= 0.2.2)
40
51
  hashie (1.1.0)
52
+ hipchat (0.4.1)
53
+ httparty
41
54
  httparty (0.7.4)
42
55
  crack (= 0.1.8)
43
56
  i18n (0.6.0)
@@ -59,7 +72,9 @@ GEM
59
72
  net-ssh (2.1.4)
60
73
  nokogiri (1.5.0)
61
74
  oauth (0.4.5)
75
+ open4 (1.2.0)
62
76
  polyglot (0.3.2)
77
+ prowler (1.3.1)
63
78
  rack (1.3.2)
64
79
  rb-fsevent (0.4.0)
65
80
  rb-inotify (0.8.5)
@@ -93,20 +108,23 @@ PLATFORMS
93
108
  ruby
94
109
 
95
110
  DEPENDENCIES
111
+ backup!
96
112
  dropbox (~> 1.3.0)
97
113
  fog (>= 0.11.0)
98
114
  fuubar
99
115
  growl
100
116
  guard
101
117
  guard-rspec
118
+ hipchat (~> 0.4.1)
102
119
  httparty (~> 0.7.4)
103
120
  json (~> 1.5.1)
104
121
  libnotify
105
- mail (~> 2.3.0)
122
+ mail (>= 2.2.15)
106
123
  mocha
107
124
  net-scp (~> 1.0.4)
108
125
  net-sftp (~> 2.0.5)
109
126
  net-ssh (~> 2.1.4)
127
+ prowler (>= 1.3.1)
110
128
  rb-fsevent
111
129
  rb-inotify
112
130
  rspec
data/Guardfile CHANGED
@@ -1,17 +1,21 @@
1
- ##
2
- # To run the test suite against all 3 rubies: 1.9.2, 1.8.7 and REE, simply run the following command:
1
+ # encoding: utf-8
2
+
3
+ # To run the test suite against all 3 rubies: 1.9.3, 1.9.2, and 1.8.7, simply run the following command:
4
+ #
3
5
  # $ guard start
4
6
  #
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
+ # Be use you are using RVM and have Ruby 1.9.3, 1.9.2, 1.8.7 installed as well as all of Backup's gem
8
+ # dependencies for each of these Ruby versions.
9
+ #
10
+ # Be sure to run `bundle install` against every Ruby version, as well as `gem install thor POpen4`
7
11
 
8
- guard 'rspec',
12
+ guard "rspec",
9
13
  :version => 2,
10
- :rvm => ['1.9.3', '1.9.2', '1.8.7', 'ree'],
14
+ :rvm => ["1.9.3", "1.9.2", "1.8.7"],
11
15
  :bundler => true,
12
- :cli => '--color --format Fuubar' do
16
+ :cli => "--color --format Fuubar" do
13
17
 
14
18
  watch(%r{^spec/.+_spec\.rb})
15
- watch(%r{^lib/(.+)\.rb}) { 'spec' }
16
- watch('spec/spec_helper.rb') { 'spec' }
19
+ watch(%r{^lib/(.+)\.rb}) { "spec" }
20
+ watch("spec/spec_helper.rb") { "spec" }
17
21
  end
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Backup 3
2
2
  ========
3
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.
4
+ Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily perform backup operations on both your remote and local environments. It provides you with 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.
5
5
 
6
6
  [![Build Status](https://secure.travis-ci.org/meskyanichi/backup.png)](http://travis-ci.org/meskyanichi/backup)
7
7
  [![Still Maintained](http://stillmaintained.com/meskyanichi/backup.png)](http://stillmaintained.com/meskyanichi/backup)
@@ -15,18 +15,16 @@ Author
15
15
  Drop me a message for any questions, suggestions, requests, bugs or submit them to the [issue log](https://github.com/meskyanichi/backup/issues).
16
16
 
17
17
 
18
- Please Donate!
19
- --------------
20
-
21
- Please [DONATE](http://pledgie.com/campaigns/16065) to the Backup project. Backup was a huge amount of work and every donation received is encouraging and supports Backup's continued development! Thanks!
18
+ Core Contributor
19
+ ----------------
22
20
 
23
- [![Donate to Backup](http://pledgie.com/campaigns/16065.png)](http://pledgie.com/campaigns/16065)
21
+ **[Brian Burns](https://github.com/burns)**
24
22
 
25
23
 
26
24
  Installation
27
25
  ------------
28
26
 
29
- To get the latest stable version
27
+ To get the latest stable version (3.0.20)
30
28
 
31
29
  gem install backup
32
30
 
@@ -36,12 +34,12 @@ You can view the list of released versions over at [RubyGems.org (Backup)](https
36
34
  Getting Started
37
35
  ---------------
38
36
 
39
- 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).
37
+ 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).
40
38
 
41
39
  What Backup 3 currently supports
42
40
  ================================
43
41
 
44
- Below you find a list of components that Backup currently supports. If you'd like support for components other than the ones listed here, feel free to request them or to fork Backup and add them yourself. Backup is modular and easy to extend with new components.
42
+ Below you find a list of components that Backup currently supports. If you'd like support for components other than the ones listed here, feel free to request them or to fork Backup and add them yourself. Backup is modular and easy to extend.
45
43
 
46
44
  Database Support
47
45
  ----------------
@@ -50,6 +48,7 @@ Database Support
50
48
  - PostgreSQL
51
49
  - MongoDB
52
50
  - Redis
51
+ - Riak
53
52
 
54
53
  [Database Wiki Page](https://github.com/meskyanichi/backup/wiki/Databases)
55
54
 
@@ -69,23 +68,34 @@ Storage Locations and Services
69
68
  - Ninefold Cloud Storage
70
69
  - Dropbox Web Service
71
70
  - Remote Servers *(Available Protocols: FTP, SFTP, SCP and RSync)*
71
+ - Local Storage
72
72
 
73
73
  [Storage Wiki Page](https://github.com/meskyanichi/backup/wiki/Storages)
74
74
 
75
75
  Storage Features
76
76
  ----------------
77
77
 
78
- - Backup Cycling, applies to:
78
+ - **Backup Cycling, applies to:**
79
79
  - Amazon Simple Storage Service (S3)
80
80
  - Rackspace Cloud Files (Mosso)
81
81
  - Ninefold Cloud Storage
82
82
  - Dropbox Web Service
83
83
  - Remote Servers *(Only Protocols: FTP, SFTP, SCP)*
84
- - Incremental Backups, applies to:
84
+ - Local Storage
85
+ - **Backup Splitting, applies to:**
86
+ - Amazon Simple Storage Service (S3)
87
+ - Rackspace Cloud Files (Mosso)
88
+ - Ninefold Cloud Storage
89
+ - Dropbox Web Service
90
+ - Remote Servers *(Only Protocols: FTP, SFTP, SCP)*
91
+ - Local Storage
92
+ - **Incremental Backups, applies to:**
85
93
  - Remote Servers *(Only Protocols: RSync)*
86
94
 
87
95
  [Storage Wiki Page](https://github.com/meskyanichi/backup/wiki/Storages)
88
96
 
97
+ [Splitter Wiki Page](https://github.com/meskyanichi/backup/wiki/Splitter)
98
+
89
99
  Syncers
90
100
  -------
91
101
 
@@ -99,6 +109,7 @@ Compressors
99
109
 
100
110
  - Gzip
101
111
  - Bzip2
112
+ - Pbzip2
102
113
  - Lzma
103
114
 
104
115
  [Compressors Wiki Page](https://github.com/meskyanichi/backup/wiki/Compressors)
@@ -118,16 +129,17 @@ Notifiers
118
129
  - Twitter
119
130
  - Campfire
120
131
  - Presently
132
+ - Prowl
133
+ - Hipchat
121
134
 
122
135
  [Notifiers Wiki Page](https://github.com/meskyanichi/backup/wiki/Notifiers)
123
136
 
124
137
  Supported Ruby versions (Tested with RSpec)
125
138
  -------------------------------------------
126
139
 
127
- - Ruby 1.9.3-preview1
140
+ - Ruby 1.9.3
128
141
  - Ruby 1.9.2
129
142
  - Ruby 1.8.7
130
- - Ruby Enterprise Edition 1.8.7
131
143
 
132
144
 
133
145
  A sample Backup configuration file
@@ -138,6 +150,8 @@ This is a Backup configuration file. Check it out and read the explanation below
138
150
  ``` rb
139
151
  Backup::Model.new(:sample_backup, 'A sample backup configuration') do
140
152
 
153
+ split_into_chunks_of 4000
154
+
141
155
  database MySQL do |database|
142
156
  database.name = 'my_sample_mysql_db'
143
157
  database.username = 'my_username'
@@ -170,6 +184,24 @@ Backup::Model.new(:sample_backup, 'A sample backup configuration') do
170
184
  compression.best = true
171
185
  end
172
186
 
187
+ store_with SFTP, "Server A" do |server|
188
+ server.username = 'my_username'
189
+ server.password = 'secret'
190
+ server.ip = 'a.my-backup-server.com'
191
+ server.port = 22
192
+ server.path = '~/backups'
193
+ server.keep = 25
194
+ end
195
+
196
+ store_with SFTP, "Server B" do |server|
197
+ server.username = 'my_username'
198
+ server.password = 'secret'
199
+ server.ip = 'b.my-backup-server.com'
200
+ server.port = 22
201
+ server.path = '~/backups'
202
+ server.keep = 25
203
+ end
204
+
173
205
  store_with S3 do |s3|
174
206
  s3.access_key_id = 'my_access_key_id'
175
207
  s3.secret_access_key = 'my_secret_access_key'
@@ -193,11 +225,13 @@ Backup::Model.new(:sample_backup, 'A sample backup configuration') do
193
225
 
194
226
  notify_by Mail do |mail|
195
227
  mail.on_success = false
228
+ mail.on_warning = true
196
229
  mail.on_failure = true
197
230
  end
198
231
 
199
232
  notify_by Twitter do |tweet|
200
233
  tweet.on_success = true
234
+ tweet.on_warning = true
201
235
  tweet.on_failure = true
202
236
  end
203
237
 
@@ -208,8 +242,12 @@ end
208
242
 
209
243
  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.
210
244
 
245
+ Aside of S3, we have also defined two `SFTP` storage methods, and given them two unique identifiers `Server A` and `Server B` to distinguish between the two. With these in place, a copy of the backup will now also be stored on two separate servers: `a.my-backup-server.com` and `b.my-backup-server.com`.
246
+
211
247
  As you can see, you can freely mix and match **archives**, **databases**, **compressors**, **encryptors**, **storages** and **notifiers** for your backups. You could even specify 4 storage locations if you wanted: Amazon S3, Rackspace Cloud Files, Ninefold and Dropbox, it'd then store your packaged backup to 4 separate locations for high redundancy. This also applies to compressors (like Gzip, Bzip2, Lzma) and encryptors, you could double encrypt your backup with OpenSSL followed by GPG if you wanted.
212
248
 
249
+ Also, notice the `split_into_chunks_of 4000` at the top of the configuration. This tells Backup to split any backups that exceed in 4000 MEGABYTES of size in to multiple smaller chunks. Assuming your backup file is 12000 MEGABYTES (12GB) in size, then Backup will go ahead and split it in to 3 chunks of 4000 MEGABYTES and transfer them individually. This is useful for when you are using Amazon S3, Rackspace Cloud Files, or other 3rd party storage services which limit you to "5GB per file" uploads. So with this, the backup file size is no longer a constraint.
250
+
213
251
  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 added/changed. Additionally, since we flagged it to 'mirror', it'll also remove files from S3 that no longer exist). If you simply wanted to sync to a separate backup server that you own, you could also use the RSync syncer for even more efficient backups that only transfer the **bytes** of each file that changed.
214
252
 
215
253
  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) with more detailed information.
@@ -226,7 +264,7 @@ Now it'll run the backup, it's as simple as that.
226
264
 
227
265
  ### Automatic backups
228
266
 
229
- 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:
267
+ Since Backup is an easy-to-use command line utility, you should write a crontask to invoke it periodically. I recommend using [Whenever](https://github.com/javan/whenever) to manage your crontab. It'll allow you to write to the crontab using pure Ruby, and it provides an elegant DSL to do so. Here's an example:
230
268
 
231
269
  ``` rb
232
270
  every 6.hours do
@@ -234,7 +272,7 @@ every 6.hours do
234
272
  end
235
273
  ```
236
274
 
237
- 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.
275
+ With this in place, run `whenever --update-crontab backup` to write the equivalent of the above Ruby syntax to the crontab in cron-syntax. Cron will now invoke `backup perform --trigger sample_backup` every 6 hours. Check out the Whenever project page for more information.
238
276
 
239
277
  Documentation
240
278
  -------------
@@ -343,6 +381,38 @@ Contributors
343
381
  <td><a href="https://github.com/joaovitor" target="_blank">João Vitor ( joaovitor )</a></td>
344
382
  <td>Changed default PostgreSQL example options to appropriate ones</td>
345
383
  </tr>
384
+ <tr>
385
+ <td><a href="https://github.com/swissmanu" target="_blank">Manuel Alabor ( swissmanu )</a></td>
386
+ <td>Prowl Notifier</td>
387
+ </tr>
388
+ <tr>
389
+ <td><a href="https://github.com/josephcrim" target="_blank">Joseph Crim ( josephcrim )</a></td>
390
+ <td>Riak Database, exit() suggestions</td>
391
+ </tr>
392
+ <tr>
393
+ <td><a href="https://github.com/fearoffish" target="_blank">Jamie van Dyke ( fearoffish )</a></td>
394
+ <td>POpen4 implementation</td>
395
+ </tr>
396
+ <tr>
397
+ <td><a href="https://github.com/hmarr" target="_blank">Harry Marr ( hmarr )</a></td>
398
+ <td>Auth URL for Rackspace Cloud Files Storage</td>
399
+ </tr>
400
+ <tr>
401
+ <td><a href="https://github.com/manuelmeurer" target="_blank">Manuel Meurer ( manuelmeurer )</a></td>
402
+ <td>Ensure the storage file (YAML dump) has content before reading it</td>
403
+ </tr>
404
+ <tr>
405
+ <td><a href="https://github.com/jessedearing" target="_blank">Jesse Dearing ( jessedearing )</a></td>
406
+ <td>Hipchat Notifier</td>
407
+ </tr>
408
+ <tr>
409
+ <td><a href="https://github.com/szymonpk" target="_blank">Szymon ( szymonpk )</a></td>
410
+ <td>Pbzip2 compressor</td>
411
+ </tr>
412
+ <tr>
413
+ <td><a href="https://github.com/burns" target="_blank">burns ( burns )</a></td>
414
+ <td>Improved Backup cycling implementation by refreshing all user configuration during the cycle procedure</td>
415
+ </tr>
346
416
  </table>
347
417
 
348
418
 
@@ -351,21 +421,20 @@ Want to contribute?
351
421
 
352
422
  - Fork/Clone the **develop** branch
353
423
  - Write RSpec tests, and test against:
354
- - Ruby 1.9.3-preview1
424
+ - Ruby 1.9.3
355
425
  - Ruby 1.9.2
356
426
  - Ruby 1.8.7
357
- - Ruby Enterprise Edition 1.8.7
358
427
  - Try to keep the overall *structure / design* of the gem the same
359
428
 
360
429
  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.
361
430
 
362
- Easily run tests against all four Ruby versions
363
- -----------------------------------------------
431
+ Easily run tests against all three Ruby versions
432
+ ------------------------------------------------
364
433
 
365
- Install [RVM](https://rvm.beginrescueend.com/) and use it to install Ruby 1.9.3, 1.9.2, 1.8.7 and REE.
434
+ Install [RVM](https://rvm.beginrescueend.com/) and use it to install Ruby 1.9.3, 1.9.2 and 1.8.7.
366
435
 
367
436
  rvm get latest && rvm reload
368
- rvm install 1.9.3 && rvm install 1.9.2 && rvm install 1.8.7 && rvm install ree
437
+ rvm install 1.9.3 && rvm install 1.9.2 && rvm install 1.8.7
369
438
 
370
439
  Once these are installed, go ahead and install all the necessary dependencies.
371
440
 
@@ -373,26 +442,19 @@ Once these are installed, go ahead and install all the necessary dependencies.
373
442
  rvm use 1.9.3 && gem install bundler && bundle install
374
443
  rvm use 1.9.2 && gem install bundler && bundle install
375
444
  rvm use 1.8.7 && gem install bundler && bundle install
376
- rvm use ree && gem install bundler && bundle install
377
445
 
378
446
  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 four Rubies. If you've done the above, all you have to do is run:
379
447
 
380
448
  bundle exec guard
381
449
 
382
- from Backup's root and that's it. It'll now test against all four Rubies each time you adjust a file in the `lib` or `spec` directories.
450
+ from Backup's root and that's it. It'll now test against all Ruby versions each time you adjust a file in the `lib` or `spec` directories.
383
451
 
384
452
 
385
- Or contribute by writing blogs/tutorials
386
- ----------------------------------------
453
+ Or contribute by writing blogs/tutorials/use cases
454
+ --------------------------------------------------
387
455
 
388
456
  - http://erik.debill.org/2011/03/26/csing-backup-with-rails
389
457
  - http://blog.noizeramp.com/2011/03/31/backing-up-backup-ruby-gem/
390
458
  - http://www.sebaugereau.com/using-ruby-to-backup-with-beauty
391
459
  - http://outofti.me/post/4159686269/backup-with-pgbackups
392
460
  - http://h2ik.co/2011/03/backing-up-with-ruby/
393
-
394
-
395
- Backup 2 - Issues, Wiki, Source, Gems
396
- =====================================
397
-
398
- 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).
data/backup.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/lib/backup')
3
+ require File.expand_path('lib/backup/version')
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.authors = 'Michael van Rooijen'
13
13
  gem.email = 'meskyanichi@gmail.com'
14
14
  gem.homepage = 'http://rubygems.org/gems/backup'
15
- gem.summary = '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.'
15
+ gem.summary = 'Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily perform backup operations on both your remote and local environments. It provides you with 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.'
16
16
 
17
17
  ##
18
18
  # Files and folder that need to be compiled in to the Ruby Gem
@@ -27,6 +27,6 @@ Gem::Specification.new do |gem|
27
27
  ##
28
28
  # Gem dependencies
29
29
  gem.add_dependency 'thor', ['~> 0.14.6']
30
- gem.add_dependency 'popen4', ['~> 0.1.2']
30
+ gem.add_dependency 'POpen4', ['~> 0.1.4']
31
31
 
32
32
  end