backupii 0.1.0.pre.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +37 -0
  4. data/bin/backupii +5 -0
  5. data/bin/docker_test +24 -0
  6. data/lib/backup/archive.rb +171 -0
  7. data/lib/backup/binder.rb +23 -0
  8. data/lib/backup/cleaner.rb +114 -0
  9. data/lib/backup/cli.rb +376 -0
  10. data/lib/backup/cloud_io/base.rb +40 -0
  11. data/lib/backup/cloud_io/cloud_files.rb +301 -0
  12. data/lib/backup/cloud_io/s3.rb +256 -0
  13. data/lib/backup/compressor/base.rb +34 -0
  14. data/lib/backup/compressor/bzip2.rb +37 -0
  15. data/lib/backup/compressor/custom.rb +51 -0
  16. data/lib/backup/compressor/gzip.rb +76 -0
  17. data/lib/backup/config/dsl.rb +103 -0
  18. data/lib/backup/config/helpers.rb +139 -0
  19. data/lib/backup/config.rb +122 -0
  20. data/lib/backup/database/base.rb +89 -0
  21. data/lib/backup/database/mongodb.rb +189 -0
  22. data/lib/backup/database/mysql.rb +194 -0
  23. data/lib/backup/database/openldap.rb +97 -0
  24. data/lib/backup/database/postgresql.rb +134 -0
  25. data/lib/backup/database/redis.rb +179 -0
  26. data/lib/backup/database/riak.rb +82 -0
  27. data/lib/backup/database/sqlite.rb +57 -0
  28. data/lib/backup/encryptor/base.rb +29 -0
  29. data/lib/backup/encryptor/gpg.rb +745 -0
  30. data/lib/backup/encryptor/open_ssl.rb +76 -0
  31. data/lib/backup/errors.rb +55 -0
  32. data/lib/backup/logger/console.rb +50 -0
  33. data/lib/backup/logger/fog_adapter.rb +27 -0
  34. data/lib/backup/logger/logfile.rb +134 -0
  35. data/lib/backup/logger/syslog.rb +116 -0
  36. data/lib/backup/logger.rb +199 -0
  37. data/lib/backup/model.rb +478 -0
  38. data/lib/backup/notifier/base.rb +128 -0
  39. data/lib/backup/notifier/campfire.rb +63 -0
  40. data/lib/backup/notifier/command.rb +101 -0
  41. data/lib/backup/notifier/datadog.rb +107 -0
  42. data/lib/backup/notifier/flowdock.rb +101 -0
  43. data/lib/backup/notifier/hipchat.rb +118 -0
  44. data/lib/backup/notifier/http_post.rb +116 -0
  45. data/lib/backup/notifier/mail.rb +235 -0
  46. data/lib/backup/notifier/nagios.rb +67 -0
  47. data/lib/backup/notifier/pagerduty.rb +82 -0
  48. data/lib/backup/notifier/prowl.rb +70 -0
  49. data/lib/backup/notifier/pushover.rb +73 -0
  50. data/lib/backup/notifier/ses.rb +126 -0
  51. data/lib/backup/notifier/slack.rb +149 -0
  52. data/lib/backup/notifier/twitter.rb +57 -0
  53. data/lib/backup/notifier/zabbix.rb +62 -0
  54. data/lib/backup/package.rb +53 -0
  55. data/lib/backup/packager.rb +108 -0
  56. data/lib/backup/pipeline.rb +122 -0
  57. data/lib/backup/splitter.rb +75 -0
  58. data/lib/backup/storage/base.rb +72 -0
  59. data/lib/backup/storage/cloud_files.rb +158 -0
  60. data/lib/backup/storage/cycler.rb +73 -0
  61. data/lib/backup/storage/dropbox.rb +208 -0
  62. data/lib/backup/storage/ftp.rb +118 -0
  63. data/lib/backup/storage/local.rb +63 -0
  64. data/lib/backup/storage/qiniu.rb +68 -0
  65. data/lib/backup/storage/rsync.rb +251 -0
  66. data/lib/backup/storage/s3.rb +157 -0
  67. data/lib/backup/storage/scp.rb +67 -0
  68. data/lib/backup/storage/sftp.rb +82 -0
  69. data/lib/backup/syncer/base.rb +70 -0
  70. data/lib/backup/syncer/cloud/base.rb +180 -0
  71. data/lib/backup/syncer/cloud/cloud_files.rb +83 -0
  72. data/lib/backup/syncer/cloud/local_file.rb +99 -0
  73. data/lib/backup/syncer/cloud/s3.rb +118 -0
  74. data/lib/backup/syncer/rsync/base.rb +55 -0
  75. data/lib/backup/syncer/rsync/local.rb +29 -0
  76. data/lib/backup/syncer/rsync/pull.rb +49 -0
  77. data/lib/backup/syncer/rsync/push.rb +206 -0
  78. data/lib/backup/template.rb +45 -0
  79. data/lib/backup/utilities.rb +235 -0
  80. data/lib/backup/version.rb +5 -0
  81. data/lib/backup.rb +141 -0
  82. data/templates/cli/archive +28 -0
  83. data/templates/cli/compressor/bzip2 +4 -0
  84. data/templates/cli/compressor/custom +7 -0
  85. data/templates/cli/compressor/gzip +4 -0
  86. data/templates/cli/config +123 -0
  87. data/templates/cli/databases/mongodb +15 -0
  88. data/templates/cli/databases/mysql +18 -0
  89. data/templates/cli/databases/openldap +24 -0
  90. data/templates/cli/databases/postgresql +16 -0
  91. data/templates/cli/databases/redis +16 -0
  92. data/templates/cli/databases/riak +17 -0
  93. data/templates/cli/databases/sqlite +11 -0
  94. data/templates/cli/encryptor/gpg +27 -0
  95. data/templates/cli/encryptor/openssl +9 -0
  96. data/templates/cli/model +26 -0
  97. data/templates/cli/notifier/zabbix +15 -0
  98. data/templates/cli/notifiers/campfire +12 -0
  99. data/templates/cli/notifiers/command +32 -0
  100. data/templates/cli/notifiers/datadog +57 -0
  101. data/templates/cli/notifiers/flowdock +16 -0
  102. data/templates/cli/notifiers/hipchat +16 -0
  103. data/templates/cli/notifiers/http_post +32 -0
  104. data/templates/cli/notifiers/mail +24 -0
  105. data/templates/cli/notifiers/nagios +13 -0
  106. data/templates/cli/notifiers/pagerduty +12 -0
  107. data/templates/cli/notifiers/prowl +11 -0
  108. data/templates/cli/notifiers/pushover +11 -0
  109. data/templates/cli/notifiers/ses +15 -0
  110. data/templates/cli/notifiers/slack +22 -0
  111. data/templates/cli/notifiers/twitter +13 -0
  112. data/templates/cli/splitter +7 -0
  113. data/templates/cli/storages/cloud_files +11 -0
  114. data/templates/cli/storages/dropbox +20 -0
  115. data/templates/cli/storages/ftp +13 -0
  116. data/templates/cli/storages/local +8 -0
  117. data/templates/cli/storages/qiniu +12 -0
  118. data/templates/cli/storages/rsync +17 -0
  119. data/templates/cli/storages/s3 +16 -0
  120. data/templates/cli/storages/scp +15 -0
  121. data/templates/cli/storages/sftp +15 -0
  122. data/templates/cli/syncers/cloud_files +22 -0
  123. data/templates/cli/syncers/rsync_local +20 -0
  124. data/templates/cli/syncers/rsync_pull +28 -0
  125. data/templates/cli/syncers/rsync_push +28 -0
  126. data/templates/cli/syncers/s3 +27 -0
  127. data/templates/general/links +3 -0
  128. data/templates/general/version.erb +2 -0
  129. data/templates/notifier/mail/failure.erb +16 -0
  130. data/templates/notifier/mail/success.erb +16 -0
  131. data/templates/notifier/mail/warning.erb +16 -0
  132. data/templates/storage/dropbox/authorization_url.erb +6 -0
  133. data/templates/storage/dropbox/authorized.erb +4 -0
  134. data/templates/storage/dropbox/cache_file_written.erb +10 -0
  135. metadata +507 -0
@@ -0,0 +1,20 @@
1
+ ##
2
+ # Dropbox [Storage]
3
+ #
4
+ # Your initial backup must be performed manually to authorize
5
+ # this machine with your Dropbox account. This authorized session
6
+ # will be stored in `cache_path` and used for subsequent backups.
7
+ #
8
+ store_with Dropbox do |db|
9
+ db.api_key = "my_api_key"
10
+ db.api_secret = "my_api_secret"
11
+ # Sets the path where the cached authorized session will be stored.
12
+ # Relative paths will be relative to ~/Backup, unless the --root-path
13
+ # is set on the command line or within your configuration file.
14
+ db.cache_path = ".cache"
15
+ # :app_folder (default) or :dropbox
16
+ db.access_type = :app_folder
17
+ db.path = "/path/to/my/backups"
18
+ db.keep = 25
19
+ # db.keep = Time.now - 2592000 # Remove all backups older than 1 month.
20
+ end
@@ -0,0 +1,13 @@
1
+ ##
2
+ # FTP (File Transfer Protocol) [Storage]
3
+ #
4
+ store_with FTP do |server|
5
+ server.username = "my_username"
6
+ server.password = "my_password"
7
+ server.ip = "123.45.678.90"
8
+ server.port = 21
9
+ server.path = "~/backups/"
10
+ server.keep = 5
11
+ # server.keep = Time.now - 2592000 # Remove all backups older than 1 month.
12
+ server.passive_mode = false
13
+ end
@@ -0,0 +1,8 @@
1
+ ##
2
+ # Local (Copy) [Storage]
3
+ #
4
+ store_with Local do |local|
5
+ local.path = "~/backups/"
6
+ local.keep = 5
7
+ # local.keep = Time.now - 2592000 # Remove all backups older than 1 month.
8
+ end
@@ -0,0 +1,12 @@
1
+ ##
2
+ # Qiniu [Storage]
3
+ #
4
+ store_with Qiniu do |qiniu|
5
+ # Qiniu Credentials
6
+ qiniu.access_key = "my_access_key"
7
+ qiniu.secret_key = "my_secret_key"
8
+
9
+ qiniu.bucket = "bucket-name"
10
+ qiniu.keep = 5
11
+ qiniu.path = "path/to/backups"
12
+ end
@@ -0,0 +1,17 @@
1
+ ##
2
+ # RSync [Storage]
3
+ #
4
+ # The default `mode` is :ssh, which does not require the use
5
+ # of an rsync daemon on the remote. If you wish to connect
6
+ # directly to an rsync daemon, or via SSH using daemon features,
7
+ # :rsync_daemon and :ssh_daemon modes are also available.
8
+ #
9
+ # If no `host` is specified, the transfer will be a local
10
+ # operation. `mode` and `compress` will have no meaning.
11
+ #
12
+ store_with RSync do |rsync|
13
+ rsync.mode = :ssh
14
+ rsync.host = "123.45.678.90"
15
+ rsync.path = "~/backups/"
16
+ rsync.compress = true
17
+ end
@@ -0,0 +1,16 @@
1
+ ##
2
+ # Amazon Simple Storage Service [Storage]
3
+ #
4
+ store_with S3 do |s3|
5
+ # AWS Credentials
6
+ s3.access_key_id = "my_access_key_id"
7
+ s3.secret_access_key = "my_secret_access_key"
8
+ # Or, to use a IAM Profile:
9
+ # s3.use_iam_profile = true
10
+
11
+ s3.region = "us-east-1"
12
+ s3.bucket = "bucket-name"
13
+ s3.path = "path/to/backups"
14
+ s3.keep = 5
15
+ # s3.keep = Time.now - 2592000 # Remove all backups older than 1 month.
16
+ end
@@ -0,0 +1,15 @@
1
+ ##
2
+ # SCP (Secure Copy) [Storage]
3
+ #
4
+ store_with SCP do |server|
5
+ server.username = "my_username"
6
+ server.password = "my_password"
7
+ server.ip = "123.45.678.90"
8
+ server.port = 22
9
+ server.path = "~/backups/"
10
+ server.keep = 5
11
+ # server.keep = Time.now - 2592000 # Remove all backups older than 1 month.
12
+
13
+ # Additional options for the SSH connection.
14
+ # server.ssh_options = {}
15
+ end
@@ -0,0 +1,15 @@
1
+ ##
2
+ # SFTP (Secure File Transfer Protocol) [Storage]
3
+ #
4
+ store_with SFTP do |server|
5
+ server.username = "my_username"
6
+ server.password = "my_password"
7
+ server.ip = "123.45.678.90"
8
+ server.port = 22
9
+ server.path = "~/backups/"
10
+ server.keep = 5
11
+ # server.keep = Time.now - 2592000 # Remove all backups older than 1 month.
12
+
13
+ # Additional options for the SSH connection.
14
+ # server.ssh_options = {}
15
+ end
@@ -0,0 +1,22 @@
1
+ ##
2
+ # Rackspace Cloud Files [Syncer]
3
+ #
4
+ sync_with Cloud::CloudFiles do |cf|
5
+ cf.username = "my_username"
6
+ cf.api_key = "my_api_key"
7
+ cf.container = "my_container"
8
+ cf.path = "/backups"
9
+ cf.mirror = true
10
+ cf.thread_count = 10
11
+
12
+ cf.directories do |directory|
13
+ directory.add "/path/to/directory/to/sync"
14
+ directory.add "/path/to/other/directory/to/sync"
15
+
16
+ # Exclude files/folders from the sync.
17
+ # The pattern may be a shell glob pattern (see `File.fnmatch`) or a Regexp.
18
+ # All patterns will be applied when traversing each added directory.
19
+ directory.exclude '**/*~'
20
+ directory.exclude /\/tmp$/
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ ##
2
+ # RSync::Local [Syncer]
3
+ #
4
+ sync_with RSync::Local do |rsync|
5
+ rsync.path = "~/backups"
6
+ rsync.mirror = true
7
+
8
+ rsync.directories do |directory|
9
+ directory.add "/var/apps/my_app/public/uploads"
10
+ directory.add "/var/apps/my_app/logs"
11
+
12
+ # Exclude files/folders.
13
+ # Each pattern will be passed to rsync's `--exclude` option.
14
+ #
15
+ # Note: rsync is run using the `--archive` option,
16
+ # so be sure to read the `FILTER RULES` in `man rsync`.
17
+ directory.exclude '*~'
18
+ directory.exclude 'tmp/'
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ ##
2
+ # RSync::Pull [Syncer]
3
+ #
4
+ # The default `mode` is :ssh, which does not require the use
5
+ # of an rsync daemon on the remote. If you wish to connect
6
+ # directly to an rsync daemon, or via SSH using daemon features,
7
+ # :rsync_daemon and :ssh_daemon modes are also available.
8
+ #
9
+ sync_with RSync::Pull do |rsync|
10
+ rsync.mode = :ssh
11
+ rsync.host = "123.45.678.90"
12
+ rsync.path = "~/backups"
13
+ rsync.mirror = true
14
+ rsync.compress = true
15
+
16
+ rsync.directories do |directory|
17
+ directory.add "/var/apps/my_app/public/uploads"
18
+ directory.add "/var/apps/my_app/logs"
19
+
20
+ # Exclude files/folders.
21
+ # Each pattern will be passed to rsync's `--exclude` option.
22
+ #
23
+ # Note: rsync is run using the `--archive` option,
24
+ # so be sure to read the `FILTER RULES` in `man rsync`.
25
+ directory.exclude '*~'
26
+ directory.exclude 'tmp/'
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ ##
2
+ # RSync::Push [Syncer]
3
+ #
4
+ # The default `mode` is :ssh, which does not require the use
5
+ # of an rsync daemon on the remote. If you wish to connect
6
+ # directly to an rsync daemon, or via SSH using daemon features,
7
+ # :rsync_daemon and :ssh_daemon modes are also available.
8
+ #
9
+ sync_with RSync::Push do |rsync|
10
+ rsync.mode = :ssh
11
+ rsync.host = "123.45.678.90"
12
+ rsync.path = "~/backups"
13
+ rsync.mirror = true
14
+ rsync.compress = true
15
+
16
+ rsync.directories do |directory|
17
+ directory.add "/var/apps/my_app/public/uploads"
18
+ directory.add "/var/apps/my_app/logs"
19
+
20
+ # Exclude files/folders.
21
+ # Each pattern will be passed to rsync's `--exclude` option.
22
+ #
23
+ # Note: rsync is run using the `--archive` option,
24
+ # so be sure to read the `FILTER RULES` in `man rsync`.
25
+ directory.exclude '*~'
26
+ directory.exclude 'tmp/'
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ ##
2
+ # Amazon S3 [Syncer]
3
+ #
4
+ sync_with Cloud::S3 do |s3|
5
+ # AWS Credentials
6
+ s3.access_key_id = "my_access_key_id"
7
+ s3.secret_access_key = "my_secret_access_key"
8
+ # Or, to use a IAM Profile:
9
+ # s3.use_iam_profile = true
10
+
11
+ s3.bucket = "my-bucket"
12
+ s3.region = "us-east-1"
13
+ s3.path = "/backups"
14
+ s3.mirror = true
15
+ s3.thread_count = 10
16
+
17
+ s3.directories do |directory|
18
+ directory.add "/path/to/directory/to/sync"
19
+ directory.add "/path/to/other/directory/to/sync"
20
+
21
+ # Exclude files/folders from the sync.
22
+ # The pattern may be a shell glob pattern (see `File.fnmatch`) or a Regexp.
23
+ # All patterns will be applied when traversing each added directory.
24
+ directory.exclude '**/*~'
25
+ directory.exclude /\/tmp$/
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ Project Home: https://github.com/backup/backup
2
+ Documentation: http://backup.github.io/backup
3
+ Issue Tracker: https://github.com/backup/backup/issues
@@ -0,0 +1,2 @@
1
+ Backup v<%= Backup::VERSION %>
2
+ Ruby: <%= RUBY_DESCRIPTION %>
@@ -0,0 +1,16 @@
1
+
2
+ Backup Failed!
3
+
4
+ Job: <%= @model.label %> (<%= @model.trigger %>)
5
+ Started: <%= @model.started_at %>
6
+ Finished: <%= @model.finished_at %>
7
+ Duration: <%= @model.duration %>
8
+ <% if @send_log %>
9
+
10
+ See the attached backup log for details.
11
+ <% end %>
12
+
13
+ ===========================================================================
14
+ <%= Backup::Template.new.result("general/version.erb") %>
15
+
16
+ <%= Backup::Template.new.result("general/links") %>
@@ -0,0 +1,16 @@
1
+
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 %>
8
+ <% if @send_log %>
9
+
10
+ See the attached backup log for details.
11
+ <% end %>
12
+
13
+ ===========================================================================
14
+ <%= Backup::Template.new.result("general/version.erb") %>
15
+
16
+ <%= Backup::Template.new.result("general/links") %>
@@ -0,0 +1,16 @@
1
+
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 %>
8
+ <% if @send_log %>
9
+
10
+ See the attached backup log for details.
11
+ <% end %>
12
+
13
+ ===========================================================================
14
+ <%= Backup::Template.new.result("general/version.erb") %>
15
+
16
+ <%= Backup::Template.new.result("general/links") %>
@@ -0,0 +1,6 @@
1
+
2
+ Visit the following URL to authorize your Dropbox App with Backup:
3
+
4
+ <%= @session.get_authorize_url %>
5
+
6
+ Hit "Enter/Return" once you're authorized.
@@ -0,0 +1,4 @@
1
+
2
+ Backup has successfully been authorized!
3
+ Writing session cache file to:
4
+ <%= @cached_file %>
@@ -0,0 +1,10 @@
1
+
2
+ Cache data written! You will no longer need to manually authorize this
3
+ Dropbox account via an authorization URL on this machine.
4
+
5
+ Note: If you run Backup with this Dropbox account in another location,
6
+ or on other machines, you will need to either authorize them the same
7
+ way, or simply copy over the cache file from:
8
+ <%= @cached_file %>
9
+ to the cache directory on your other machines to use this Dropbox
10
+ account there as well.