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.
- checksums.yaml +7 -0
- data/LICENSE +19 -0
- data/README.md +37 -0
- data/bin/backupii +5 -0
- data/bin/docker_test +24 -0
- data/lib/backup/archive.rb +171 -0
- data/lib/backup/binder.rb +23 -0
- data/lib/backup/cleaner.rb +114 -0
- data/lib/backup/cli.rb +376 -0
- data/lib/backup/cloud_io/base.rb +40 -0
- data/lib/backup/cloud_io/cloud_files.rb +301 -0
- data/lib/backup/cloud_io/s3.rb +256 -0
- data/lib/backup/compressor/base.rb +34 -0
- data/lib/backup/compressor/bzip2.rb +37 -0
- data/lib/backup/compressor/custom.rb +51 -0
- data/lib/backup/compressor/gzip.rb +76 -0
- data/lib/backup/config/dsl.rb +103 -0
- data/lib/backup/config/helpers.rb +139 -0
- data/lib/backup/config.rb +122 -0
- data/lib/backup/database/base.rb +89 -0
- data/lib/backup/database/mongodb.rb +189 -0
- data/lib/backup/database/mysql.rb +194 -0
- data/lib/backup/database/openldap.rb +97 -0
- data/lib/backup/database/postgresql.rb +134 -0
- data/lib/backup/database/redis.rb +179 -0
- data/lib/backup/database/riak.rb +82 -0
- data/lib/backup/database/sqlite.rb +57 -0
- data/lib/backup/encryptor/base.rb +29 -0
- data/lib/backup/encryptor/gpg.rb +745 -0
- data/lib/backup/encryptor/open_ssl.rb +76 -0
- data/lib/backup/errors.rb +55 -0
- data/lib/backup/logger/console.rb +50 -0
- data/lib/backup/logger/fog_adapter.rb +27 -0
- data/lib/backup/logger/logfile.rb +134 -0
- data/lib/backup/logger/syslog.rb +116 -0
- data/lib/backup/logger.rb +199 -0
- data/lib/backup/model.rb +478 -0
- data/lib/backup/notifier/base.rb +128 -0
- data/lib/backup/notifier/campfire.rb +63 -0
- data/lib/backup/notifier/command.rb +101 -0
- data/lib/backup/notifier/datadog.rb +107 -0
- data/lib/backup/notifier/flowdock.rb +101 -0
- data/lib/backup/notifier/hipchat.rb +118 -0
- data/lib/backup/notifier/http_post.rb +116 -0
- data/lib/backup/notifier/mail.rb +235 -0
- data/lib/backup/notifier/nagios.rb +67 -0
- data/lib/backup/notifier/pagerduty.rb +82 -0
- data/lib/backup/notifier/prowl.rb +70 -0
- data/lib/backup/notifier/pushover.rb +73 -0
- data/lib/backup/notifier/ses.rb +126 -0
- data/lib/backup/notifier/slack.rb +149 -0
- data/lib/backup/notifier/twitter.rb +57 -0
- data/lib/backup/notifier/zabbix.rb +62 -0
- data/lib/backup/package.rb +53 -0
- data/lib/backup/packager.rb +108 -0
- data/lib/backup/pipeline.rb +122 -0
- data/lib/backup/splitter.rb +75 -0
- data/lib/backup/storage/base.rb +72 -0
- data/lib/backup/storage/cloud_files.rb +158 -0
- data/lib/backup/storage/cycler.rb +73 -0
- data/lib/backup/storage/dropbox.rb +208 -0
- data/lib/backup/storage/ftp.rb +118 -0
- data/lib/backup/storage/local.rb +63 -0
- data/lib/backup/storage/qiniu.rb +68 -0
- data/lib/backup/storage/rsync.rb +251 -0
- data/lib/backup/storage/s3.rb +157 -0
- data/lib/backup/storage/scp.rb +67 -0
- data/lib/backup/storage/sftp.rb +82 -0
- data/lib/backup/syncer/base.rb +70 -0
- data/lib/backup/syncer/cloud/base.rb +180 -0
- data/lib/backup/syncer/cloud/cloud_files.rb +83 -0
- data/lib/backup/syncer/cloud/local_file.rb +99 -0
- data/lib/backup/syncer/cloud/s3.rb +118 -0
- data/lib/backup/syncer/rsync/base.rb +55 -0
- data/lib/backup/syncer/rsync/local.rb +29 -0
- data/lib/backup/syncer/rsync/pull.rb +49 -0
- data/lib/backup/syncer/rsync/push.rb +206 -0
- data/lib/backup/template.rb +45 -0
- data/lib/backup/utilities.rb +235 -0
- data/lib/backup/version.rb +5 -0
- data/lib/backup.rb +141 -0
- data/templates/cli/archive +28 -0
- data/templates/cli/compressor/bzip2 +4 -0
- data/templates/cli/compressor/custom +7 -0
- data/templates/cli/compressor/gzip +4 -0
- data/templates/cli/config +123 -0
- data/templates/cli/databases/mongodb +15 -0
- data/templates/cli/databases/mysql +18 -0
- data/templates/cli/databases/openldap +24 -0
- data/templates/cli/databases/postgresql +16 -0
- data/templates/cli/databases/redis +16 -0
- data/templates/cli/databases/riak +17 -0
- data/templates/cli/databases/sqlite +11 -0
- data/templates/cli/encryptor/gpg +27 -0
- data/templates/cli/encryptor/openssl +9 -0
- data/templates/cli/model +26 -0
- data/templates/cli/notifier/zabbix +15 -0
- data/templates/cli/notifiers/campfire +12 -0
- data/templates/cli/notifiers/command +32 -0
- data/templates/cli/notifiers/datadog +57 -0
- data/templates/cli/notifiers/flowdock +16 -0
- data/templates/cli/notifiers/hipchat +16 -0
- data/templates/cli/notifiers/http_post +32 -0
- data/templates/cli/notifiers/mail +24 -0
- data/templates/cli/notifiers/nagios +13 -0
- data/templates/cli/notifiers/pagerduty +12 -0
- data/templates/cli/notifiers/prowl +11 -0
- data/templates/cli/notifiers/pushover +11 -0
- data/templates/cli/notifiers/ses +15 -0
- data/templates/cli/notifiers/slack +22 -0
- data/templates/cli/notifiers/twitter +13 -0
- data/templates/cli/splitter +7 -0
- data/templates/cli/storages/cloud_files +11 -0
- data/templates/cli/storages/dropbox +20 -0
- data/templates/cli/storages/ftp +13 -0
- data/templates/cli/storages/local +8 -0
- data/templates/cli/storages/qiniu +12 -0
- data/templates/cli/storages/rsync +17 -0
- data/templates/cli/storages/s3 +16 -0
- data/templates/cli/storages/scp +15 -0
- data/templates/cli/storages/sftp +15 -0
- data/templates/cli/syncers/cloud_files +22 -0
- data/templates/cli/syncers/rsync_local +20 -0
- data/templates/cli/syncers/rsync_pull +28 -0
- data/templates/cli/syncers/rsync_push +28 -0
- data/templates/cli/syncers/s3 +27 -0
- data/templates/general/links +3 -0
- data/templates/general/version.erb +2 -0
- data/templates/notifier/mail/failure.erb +16 -0
- data/templates/notifier/mail/success.erb +16 -0
- data/templates/notifier/mail/warning.erb +16 -0
- data/templates/storage/dropbox/authorization_url.erb +6 -0
- data/templates/storage/dropbox/authorized.erb +4 -0
- data/templates/storage/dropbox/cache_file_written.erb +10 -0
- 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,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,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,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.
|