backup 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/backup.rb +14 -4
  4. data/lib/backup/archive.rb +3 -2
  5. data/lib/backup/cleaner.rb +4 -2
  6. data/lib/backup/cli.rb +7 -5
  7. data/lib/backup/cloud_io/base.rb +41 -0
  8. data/lib/backup/cloud_io/cloud_files.rb +296 -0
  9. data/lib/backup/cloud_io/s3.rb +252 -0
  10. data/lib/backup/compressor/gzip.rb +2 -1
  11. data/lib/backup/config.rb +13 -5
  12. data/lib/backup/configuration.rb +1 -1
  13. data/lib/backup/configuration/helpers.rb +3 -1
  14. data/lib/backup/database/base.rb +3 -1
  15. data/lib/backup/database/mongodb.rb +2 -2
  16. data/lib/backup/database/mysql.rb +2 -2
  17. data/lib/backup/database/postgresql.rb +12 -2
  18. data/lib/backup/database/redis.rb +3 -2
  19. data/lib/backup/encryptor/gpg.rb +8 -10
  20. data/lib/backup/errors.rb +39 -70
  21. data/lib/backup/logger.rb +7 -2
  22. data/lib/backup/logger/fog_adapter.rb +30 -0
  23. data/lib/backup/model.rb +32 -14
  24. data/lib/backup/notifier/base.rb +4 -3
  25. data/lib/backup/notifier/campfire.rb +0 -1
  26. data/lib/backup/notifier/http_post.rb +122 -0
  27. data/lib/backup/notifier/mail.rb +38 -0
  28. data/lib/backup/notifier/nagios.rb +69 -0
  29. data/lib/backup/notifier/prowl.rb +0 -1
  30. data/lib/backup/notifier/pushover.rb +0 -1
  31. data/lib/backup/package.rb +5 -0
  32. data/lib/backup/packager.rb +3 -2
  33. data/lib/backup/pipeline.rb +4 -2
  34. data/lib/backup/storage/base.rb +2 -1
  35. data/lib/backup/storage/cloud_files.rb +151 -0
  36. data/lib/backup/storage/cycler.rb +4 -2
  37. data/lib/backup/storage/dropbox.rb +20 -16
  38. data/lib/backup/storage/ftp.rb +1 -2
  39. data/lib/backup/storage/local.rb +3 -3
  40. data/lib/backup/storage/ninefold.rb +3 -4
  41. data/lib/backup/storage/rsync.rb +1 -2
  42. data/lib/backup/storage/s3.rb +49 -158
  43. data/lib/backup/storage/scp.rb +3 -4
  44. data/lib/backup/storage/sftp.rb +1 -2
  45. data/lib/backup/syncer/base.rb +0 -1
  46. data/lib/backup/syncer/cloud/base.rb +129 -208
  47. data/lib/backup/syncer/cloud/cloud_files.rb +56 -41
  48. data/lib/backup/syncer/cloud/local_file.rb +93 -0
  49. data/lib/backup/syncer/cloud/s3.rb +78 -31
  50. data/lib/backup/syncer/rsync/base.rb +7 -0
  51. data/lib/backup/syncer/rsync/local.rb +0 -5
  52. data/lib/backup/syncer/rsync/push.rb +1 -2
  53. data/lib/backup/utilities.rb +18 -15
  54. data/lib/backup/version.rb +1 -1
  55. data/templates/cli/notifier/http_post +35 -0
  56. data/templates/cli/notifier/nagios +13 -0
  57. data/templates/cli/storage/cloud_files +8 -17
  58. data/templates/cli/storage/s3 +3 -10
  59. data/templates/cli/syncer/cloud_files +3 -31
  60. data/templates/cli/syncer/s3 +3 -27
  61. data/templates/notifier/mail/failure.erb +6 -1
  62. data/templates/notifier/mail/success.erb +6 -1
  63. data/templates/notifier/mail/warning.erb +6 -1
  64. metadata +37 -42
  65. data/lib/backup/storage/cloudfiles.rb +0 -68
@@ -1,19 +1,12 @@
1
1
  ##
2
2
  # Amazon Simple Storage Service [Storage]
3
3
  #
4
- # Available Regions:
5
- #
6
- # - ap-northeast-1
7
- # - ap-southeast-1
8
- # - eu-west-1
9
- # - us-east-1
10
- # - us-west-1
11
- #
4
+ # See the documentation on the Wiki for details.
5
+ # https://github.com/meskyanichi/backup/wiki/Storages
12
6
  store_with S3 do |s3|
13
7
  s3.access_key_id = "my_access_key_id"
14
8
  s3.secret_access_key = "my_secret_access_key"
15
9
  s3.region = "us-east-1"
16
10
  s3.bucket = "bucket-name"
17
- s3.path = "/path/to/my/backups"
18
- s3.keep = 10
11
+ s3.path = "path/to/backups"
19
12
  end
@@ -1,43 +1,15 @@
1
1
  ##
2
2
  # Rackspace Cloud Files [Syncer]
3
3
  #
4
- # Available Auth URLs:
5
- #
6
- # - https://auth.api.rackspacecloud.com (US - Default)
7
- # - https://lon.auth.api.rackspacecloud.com (UK)
8
- #
9
- # Servicenet:
10
- #
11
- # Set this to 'true' if Backup runs on a Rackspace server.
12
- # It will avoid transfer charges and it's more performant.
13
- #
14
- # Mirroring:
15
- #
16
- # When enabled it will keep an exact mirror of your filesystem on Cloud Files.
17
- # This means that when you remove a file from the filesystem,
18
- # it will also remote it from Cloud Files.
19
- #
20
- # Concurrency:
21
- #
22
- # `concurrency_type` may be set to:
23
- #
24
- # - false (default)
25
- # - :threads
26
- # - :processes
27
- #
28
- # Set `concurrency_level` to the number of threads/processes to use.
29
- # Defaults to 2.
30
- #
4
+ # See the documentation on the Wiki for details.
5
+ # https://github.com/meskyanichi/backup/wiki/Syncers
31
6
  sync_with Cloud::CloudFiles do |cf|
32
7
  cf.username = "my_username"
33
8
  cf.api_key = "my_api_key"
34
9
  cf.container = "my_container"
35
- cf.auth_url = "https://auth.api.rackspacecloud.com"
36
- cf.servicenet = false
37
10
  cf.path = "/backups"
38
11
  cf.mirror = true
39
- cf.concurrency_type = false
40
- cf.concurrency_level = 2
12
+ cf.thread_count = 10
41
13
 
42
14
  cf.directories do |directory|
43
15
  directory.add "/path/to/directory/to/sync"
@@ -1,31 +1,8 @@
1
1
  ##
2
2
  # Amazon S3 [Syncer]
3
3
  #
4
- # Available Regions:
5
- #
6
- # - ap-northeast-1
7
- # - ap-southeast-1
8
- # - eu-west-1
9
- # - us-east-1
10
- # - us-west-1
11
- #
12
- # Mirroring:
13
- #
14
- # When enabled it will keep an exact mirror of your filesystem on S3.
15
- # This means that when you remove a file from the filesystem,
16
- # it will also remote it from S3.
17
- #
18
- # Concurrency:
19
- #
20
- # `concurrency_type` may be set to:
21
- #
22
- # - false (default)
23
- # - :threads
24
- # - :processes
25
- #
26
- # Set `concurrency_level` to the number of threads/processes to use.
27
- # Defaults to 2.
28
- #
4
+ # See the documentation on the Wiki for details.
5
+ # https://github.com/meskyanichi/backup/wiki/Syncers
29
6
  sync_with Cloud::S3 do |s3|
30
7
  s3.access_key_id = "my_access_key_id"
31
8
  s3.secret_access_key = "my_secret_access_key"
@@ -33,8 +10,7 @@
33
10
  s3.region = "us-east-1"
34
11
  s3.path = "/backups"
35
12
  s3.mirror = true
36
- s3.concurrency_type = false
37
- s3.concurrency_level = 2
13
+ s3.thread_count = 10
38
14
 
39
15
  s3.directories do |directory|
40
16
  directory.add "/path/to/directory/to/sync"
@@ -1,5 +1,10 @@
1
1
 
2
- Backup <%= @model.label %> (<%= @model.trigger %>) Failed!
2
+ Backup Failed!
3
+
4
+ Job: <%= @model.label %> (<%= @model.trigger %>)
5
+ Started: <%= @model.started_at %>
6
+ Finished: <%= @model.finished_at %>
7
+ Duration: <%= @model.duration %>
3
8
  <% if @send_log %>
4
9
 
5
10
  See the attached backup log for details.
@@ -1,5 +1,10 @@
1
1
 
2
- Backup <%= @model.label %> (<%= @model.trigger %>) finished without any errors!
2
+ Backup Completed Successfully!
3
+
4
+ Job: <%= @model.label %> (<%= @model.trigger %>)
5
+ Started: <%= @model.started_at %>
6
+ Finished: <%= @model.finished_at %>
7
+ Duration: <%= @model.duration %>
3
8
  <% if @send_log %>
4
9
 
5
10
  See the attached backup log for details.
@@ -1,5 +1,10 @@
1
1
 
2
- Backup <%= @model.label %> (<%= @model.trigger %>) finished with warnings.
2
+ Backup Completed Successfully (with Warnings)!
3
+
4
+ Job: <%= @model.label %> (<%= @model.trigger %>)
5
+ Started: <%= @model.started_at %>
6
+ Finished: <%= @model.finished_at %>
7
+ Duration: <%= @model.duration %>
3
8
  <% if @send_log %>
4
9
 
5
10
  See the attached backup log for details.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-24 00:00:00.000000000 Z
11
+ date: 2013-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: 3.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.0
26
+ version: 3.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dropbox-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.22.1
47
+ version: 0.25.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.22.1
54
+ version: 0.25.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faraday
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.10.1
75
+ version: 1.13.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.10.1
82
+ version: 1.13.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: formatador
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.9.0
103
+ version: 0.11.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.9.0
110
+ version: 0.11.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: httparty
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 1.7.3
173
+ version: 1.7.7
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 1.7.3
180
+ version: 1.7.7
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: multi_xml
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - '='
186
186
  - !ruby/object:Gem::Version
187
- version: 0.5.3
187
+ version: 0.5.4
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '='
193
193
  - !ruby/object:Gem::Version
194
- version: 0.5.3
194
+ version: 0.5.4
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: multipart-post
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 1.1.1
215
+ version: 1.1.2
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 1.1.1
222
+ version: 1.1.2
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: net-sftp
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -240,28 +240,28 @@ dependencies:
240
240
  requirements:
241
241
  - - '='
242
242
  - !ruby/object:Gem::Version
243
- version: 2.6.7
243
+ version: 2.6.8
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - '='
249
249
  - !ruby/object:Gem::Version
250
- version: 2.6.7
250
+ version: 2.6.8
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: nokogiri
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - '='
256
256
  - !ruby/object:Gem::Version
257
- version: 1.5.9
257
+ version: 1.5.10
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - '='
263
263
  - !ruby/object:Gem::Version
264
- version: 1.5.9
264
+ version: 1.5.10
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: open4
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -276,20 +276,6 @@ dependencies:
276
276
  - - '='
277
277
  - !ruby/object:Gem::Version
278
278
  version: 1.3.0
279
- - !ruby/object:Gem::Dependency
280
- name: parallel
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - '='
284
- - !ruby/object:Gem::Version
285
- version: 0.6.5
286
- type: :runtime
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - '='
291
- - !ruby/object:Gem::Version
292
- version: 0.6.5
293
279
  - !ruby/object:Gem::Dependency
294
280
  name: polyglot
295
281
  requirement: !ruby/object:Gem::Requirement
@@ -352,28 +338,28 @@ dependencies:
352
338
  requirements:
353
339
  - - '='
354
340
  - !ruby/object:Gem::Version
355
- version: 1.4.12
341
+ version: 1.4.14
356
342
  type: :runtime
357
343
  prerelease: false
358
344
  version_requirements: !ruby/object:Gem::Requirement
359
345
  requirements:
360
346
  - - '='
361
347
  - !ruby/object:Gem::Version
362
- version: 1.4.12
348
+ version: 1.4.14
363
349
  - !ruby/object:Gem::Dependency
364
350
  name: twitter
365
351
  requirement: !ruby/object:Gem::Requirement
366
352
  requirements:
367
353
  - - '='
368
354
  - !ruby/object:Gem::Version
369
- version: 4.6.2
355
+ version: 4.8.1
370
356
  type: :runtime
371
357
  prerelease: false
372
358
  version_requirements: !ruby/object:Gem::Requirement
373
359
  requirements:
374
360
  - - '='
375
361
  - !ruby/object:Gem::Version
376
- version: 4.6.2
362
+ version: 4.8.1
377
363
  description: Backup is a RubyGem, written for UNIX-like operating systems, that allows
378
364
  you to easily perform backup operations on both your remote and local environments.
379
365
  It provides you with an elegant DSL in Ruby for modeling your backups. Backup has
@@ -386,12 +372,17 @@ executables:
386
372
  extensions: []
387
373
  extra_rdoc_files: []
388
374
  files:
375
+ - LICENSE.md
376
+ - README.md
389
377
  - bin/backup
390
378
  - lib/backup.rb
391
379
  - lib/backup/archive.rb
392
380
  - lib/backup/binder.rb
393
381
  - lib/backup/cleaner.rb
394
382
  - lib/backup/cli.rb
383
+ - lib/backup/cloud_io/base.rb
384
+ - lib/backup/cloud_io/cloud_files.rb
385
+ - lib/backup/cloud_io/s3.rb
395
386
  - lib/backup/compressor/base.rb
396
387
  - lib/backup/compressor/bzip2.rb
397
388
  - lib/backup/compressor/custom.rb
@@ -414,13 +405,16 @@ files:
414
405
  - lib/backup/errors.rb
415
406
  - lib/backup/logger.rb
416
407
  - lib/backup/logger/console.rb
408
+ - lib/backup/logger/fog_adapter.rb
417
409
  - lib/backup/logger/logfile.rb
418
410
  - lib/backup/logger/syslog.rb
419
411
  - lib/backup/model.rb
420
412
  - lib/backup/notifier/base.rb
421
413
  - lib/backup/notifier/campfire.rb
422
414
  - lib/backup/notifier/hipchat.rb
415
+ - lib/backup/notifier/http_post.rb
423
416
  - lib/backup/notifier/mail.rb
417
+ - lib/backup/notifier/nagios.rb
424
418
  - lib/backup/notifier/prowl.rb
425
419
  - lib/backup/notifier/pushover.rb
426
420
  - lib/backup/notifier/twitter.rb
@@ -429,7 +423,7 @@ files:
429
423
  - lib/backup/pipeline.rb
430
424
  - lib/backup/splitter.rb
431
425
  - lib/backup/storage/base.rb
432
- - lib/backup/storage/cloudfiles.rb
426
+ - lib/backup/storage/cloud_files.rb
433
427
  - lib/backup/storage/cycler.rb
434
428
  - lib/backup/storage/dropbox.rb
435
429
  - lib/backup/storage/ftp.rb
@@ -442,6 +436,7 @@ files:
442
436
  - lib/backup/syncer/base.rb
443
437
  - lib/backup/syncer/cloud/base.rb
444
438
  - lib/backup/syncer/cloud/cloud_files.rb
439
+ - lib/backup/syncer/cloud/local_file.rb
445
440
  - lib/backup/syncer/cloud/s3.rb
446
441
  - lib/backup/syncer/rsync/base.rb
447
442
  - lib/backup/syncer/rsync/local.rb
@@ -467,7 +462,9 @@ files:
467
462
  - templates/cli/model.erb
468
463
  - templates/cli/notifier/campfire
469
464
  - templates/cli/notifier/hipchat
465
+ - templates/cli/notifier/http_post
470
466
  - templates/cli/notifier/mail
467
+ - templates/cli/notifier/nagios
471
468
  - templates/cli/notifier/prowl
472
469
  - templates/cli/notifier/pushover
473
470
  - templates/cli/notifier/twitter
@@ -494,8 +491,6 @@ files:
494
491
  - templates/storage/dropbox/authorization_url.erb
495
492
  - templates/storage/dropbox/authorized.erb
496
493
  - templates/storage/dropbox/cache_file_written.erb
497
- - README.md
498
- - LICENSE.md
499
494
  homepage: https://github.com/meskyanichi/backup
500
495
  licenses:
501
496
  - MIT
@@ -516,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
511
  version: '0'
517
512
  requirements: []
518
513
  rubyforge_project:
519
- rubygems_version: 2.0.3
514
+ rubygems_version: 2.0.2
520
515
  signing_key:
521
516
  specification_version: 4
522
517
  summary: Provides an elegant DSL in Ruby for performing backups on UNIX-like systems.
@@ -1,68 +0,0 @@
1
- # encoding: utf-8
2
- require 'fog'
3
-
4
- module Backup
5
- module Storage
6
- class CloudFiles < Base
7
-
8
- ##
9
- # Rackspace Cloud Files Credentials
10
- attr_accessor :username, :api_key, :auth_url
11
-
12
- ##
13
- # Rackspace Service Net
14
- # (LAN-based transfers to avoid charges and improve performance)
15
- attr_accessor :servicenet
16
-
17
- ##
18
- # Rackspace Cloud Files container name
19
- attr_accessor :container
20
-
21
- def initialize(model, storage_id = nil, &block)
22
- super
23
- instance_eval(&block) if block_given?
24
-
25
- @servicenet ||= false
26
- @path ||= 'backups'
27
- path.sub!(/^\//, '')
28
- end
29
-
30
- private
31
-
32
- def connection
33
- @connection ||= Fog::Storage.new(
34
- :provider => 'Rackspace',
35
- :rackspace_username => username,
36
- :rackspace_api_key => api_key,
37
- :rackspace_auth_url => auth_url,
38
- :rackspace_servicenet => servicenet
39
- )
40
- end
41
-
42
- def transfer!
43
- connection.put_container(container)
44
-
45
- package.filenames.each do |filename|
46
- src = File.join(Config.tmp_path, filename)
47
- dest = File.join(remote_path, filename)
48
- Logger.info "Storing '#{ container }/#{ dest }'..."
49
- File.open(src, 'r') do |file|
50
- connection.put_object(container, dest, file)
51
- end
52
- end
53
- end
54
-
55
- # Called by the Cycler.
56
- # Any error raised will be logged as a warning.
57
- def remove!(package)
58
- Logger.info "Removing backup package dated #{ package.time }..."
59
-
60
- remote_path = remote_path_for(package)
61
- package.filenames.each do |filename|
62
- connection.delete_object(container, File.join(remote_path, filename))
63
- end
64
- end
65
-
66
- end
67
- end
68
- end