interu-backup 3.0.16
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.
- data/.gitignore +2 -0
- data/Gemfile +31 -0
- data/Gemfile.lock +117 -0
- data/Guardfile +17 -0
- data/LICENSE.md +24 -0
- data/README.md +332 -0
- data/backup.gemspec +31 -0
- data/bin/backup +267 -0
- data/lib/backup.rb +181 -0
- data/lib/backup/archive.rb +73 -0
- data/lib/backup/cli.rb +82 -0
- data/lib/backup/compressor/base.rb +17 -0
- data/lib/backup/compressor/bzip2.rb +64 -0
- data/lib/backup/compressor/gzip.rb +61 -0
- data/lib/backup/configuration/base.rb +15 -0
- data/lib/backup/configuration/compressor/base.rb +10 -0
- data/lib/backup/configuration/compressor/bzip2.rb +23 -0
- data/lib/backup/configuration/compressor/gzip.rb +23 -0
- data/lib/backup/configuration/database/base.rb +18 -0
- data/lib/backup/configuration/database/mongodb.rb +41 -0
- data/lib/backup/configuration/database/mysql.rb +37 -0
- data/lib/backup/configuration/database/postgresql.rb +37 -0
- data/lib/backup/configuration/database/redis.rb +35 -0
- data/lib/backup/configuration/encryptor/base.rb +10 -0
- data/lib/backup/configuration/encryptor/gpg.rb +17 -0
- data/lib/backup/configuration/encryptor/open_ssl.rb +26 -0
- data/lib/backup/configuration/helpers.rb +54 -0
- data/lib/backup/configuration/notifier/base.rb +39 -0
- data/lib/backup/configuration/notifier/campfire.rb +25 -0
- data/lib/backup/configuration/notifier/mail.rb +52 -0
- data/lib/backup/configuration/notifier/presently.rb +25 -0
- data/lib/backup/configuration/notifier/twitter.rb +21 -0
- data/lib/backup/configuration/storage/base.rb +18 -0
- data/lib/backup/configuration/storage/cloudfiles.rb +21 -0
- data/lib/backup/configuration/storage/dropbox.rb +29 -0
- data/lib/backup/configuration/storage/ftp.rb +25 -0
- data/lib/backup/configuration/storage/rsync.rb +25 -0
- data/lib/backup/configuration/storage/s3.rb +25 -0
- data/lib/backup/configuration/storage/scp.rb +25 -0
- data/lib/backup/configuration/storage/sftp.rb +25 -0
- data/lib/backup/configuration/syncer/rsync.rb +45 -0
- data/lib/backup/configuration/syncer/s3.rb +33 -0
- data/lib/backup/database/base.rb +33 -0
- data/lib/backup/database/mongodb.rb +179 -0
- data/lib/backup/database/mysql.rb +104 -0
- data/lib/backup/database/postgresql.rb +111 -0
- data/lib/backup/database/redis.rb +105 -0
- data/lib/backup/dependency.rb +96 -0
- data/lib/backup/encryptor/base.rb +17 -0
- data/lib/backup/encryptor/gpg.rb +78 -0
- data/lib/backup/encryptor/open_ssl.rb +67 -0
- data/lib/backup/exception/command_not_found.rb +8 -0
- data/lib/backup/finder.rb +39 -0
- data/lib/backup/logger.rb +102 -0
- data/lib/backup/model.rb +272 -0
- data/lib/backup/notifier/base.rb +29 -0
- data/lib/backup/notifier/binder.rb +32 -0
- data/lib/backup/notifier/campfire.rb +194 -0
- data/lib/backup/notifier/mail.rb +141 -0
- data/lib/backup/notifier/presently.rb +105 -0
- data/lib/backup/notifier/templates/notify_failure.erb +33 -0
- data/lib/backup/notifier/templates/notify_success.erb +16 -0
- data/lib/backup/notifier/twitter.rb +87 -0
- data/lib/backup/storage/base.rb +67 -0
- data/lib/backup/storage/cloudfiles.rb +95 -0
- data/lib/backup/storage/dropbox.rb +91 -0
- data/lib/backup/storage/ftp.rb +114 -0
- data/lib/backup/storage/object.rb +45 -0
- data/lib/backup/storage/rsync.rb +129 -0
- data/lib/backup/storage/s3.rb +180 -0
- data/lib/backup/storage/scp.rb +106 -0
- data/lib/backup/storage/sftp.rb +106 -0
- data/lib/backup/syncer/base.rb +10 -0
- data/lib/backup/syncer/rsync.rb +152 -0
- data/lib/backup/syncer/s3.rb +118 -0
- data/lib/backup/version.rb +43 -0
- data/lib/templates/archive +7 -0
- data/lib/templates/compressor/bzip2 +7 -0
- data/lib/templates/compressor/gzip +7 -0
- data/lib/templates/database/mongodb +14 -0
- data/lib/templates/database/mysql +14 -0
- data/lib/templates/database/postgresql +14 -0
- data/lib/templates/database/redis +13 -0
- data/lib/templates/encryptor/gpg +12 -0
- data/lib/templates/encryptor/openssl +8 -0
- data/lib/templates/notifier/campfire +11 -0
- data/lib/templates/notifier/mail +17 -0
- data/lib/templates/notifier/presently +12 -0
- data/lib/templates/notifier/twitter +12 -0
- data/lib/templates/readme +15 -0
- data/lib/templates/storage/cloudfiles +10 -0
- data/lib/templates/storage/dropbox +12 -0
- data/lib/templates/storage/ftp +11 -0
- data/lib/templates/storage/rsync +10 -0
- data/lib/templates/storage/s3 +21 -0
- data/lib/templates/storage/scp +11 -0
- data/lib/templates/storage/sftp +11 -0
- data/lib/templates/syncer/rsync +17 -0
- data/lib/templates/syncer/s3 +15 -0
- data/spec/archive_spec.rb +90 -0
- data/spec/backup_spec.rb +11 -0
- data/spec/compressor/bzip2_spec.rb +59 -0
- data/spec/compressor/gzip_spec.rb +59 -0
- data/spec/configuration/base_spec.rb +35 -0
- data/spec/configuration/compressor/gzip_spec.rb +28 -0
- data/spec/configuration/database/base_spec.rb +16 -0
- data/spec/configuration/database/mongodb_spec.rb +30 -0
- data/spec/configuration/database/mysql_spec.rb +32 -0
- data/spec/configuration/database/postgresql_spec.rb +32 -0
- data/spec/configuration/database/redis_spec.rb +30 -0
- data/spec/configuration/encryptor/gpg_spec.rb +25 -0
- data/spec/configuration/encryptor/open_ssl_spec.rb +31 -0
- data/spec/configuration/notifier/campfire_spec.rb +20 -0
- data/spec/configuration/notifier/mail_spec.rb +32 -0
- data/spec/configuration/notifier/twitter_spec.rb +22 -0
- data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
- data/spec/configuration/storage/dropbox_spec.rb +43 -0
- data/spec/configuration/storage/ftp_spec.rb +40 -0
- data/spec/configuration/storage/rsync_spec.rb +37 -0
- data/spec/configuration/storage/s3_spec.rb +37 -0
- data/spec/configuration/storage/scp_spec.rb +40 -0
- data/spec/configuration/storage/sftp_spec.rb +40 -0
- data/spec/configuration/syncer/rsync_spec.rb +46 -0
- data/spec/configuration/syncer/s3_spec.rb +43 -0
- data/spec/database/base_spec.rb +30 -0
- data/spec/database/mongodb_spec.rb +181 -0
- data/spec/database/mysql_spec.rb +150 -0
- data/spec/database/postgresql_spec.rb +164 -0
- data/spec/database/redis_spec.rb +122 -0
- data/spec/encryptor/gpg_spec.rb +57 -0
- data/spec/encryptor/open_ssl_spec.rb +102 -0
- data/spec/logger_spec.rb +58 -0
- data/spec/model_spec.rb +236 -0
- data/spec/notifier/campfire_spec.rb +96 -0
- data/spec/notifier/mail_spec.rb +97 -0
- data/spec/notifier/presently_spec.rb +99 -0
- data/spec/notifier/twitter_spec.rb +86 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/storage/base_spec.rb +33 -0
- data/spec/storage/cloudfiles_spec.rb +102 -0
- data/spec/storage/dropbox_spec.rb +105 -0
- data/spec/storage/ftp_spec.rb +133 -0
- data/spec/storage/object_spec.rb +74 -0
- data/spec/storage/rsync_spec.rb +131 -0
- data/spec/storage/s3_spec.rb +110 -0
- data/spec/storage/scp_spec.rb +129 -0
- data/spec/storage/sftp_spec.rb +125 -0
- data/spec/syncer/rsync_spec.rb +195 -0
- data/spec/syncer/s3_spec.rb +139 -0
- data/spec/version_spec.rb +21 -0
- metadata +231 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
class Archive
|
|
5
|
+
include Backup::CLI
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Stores the name of the archive
|
|
9
|
+
attr_accessor :name
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# Stores an array of different paths/files to store
|
|
13
|
+
attr_accessor :paths
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Stores an array of different paths/files to exclude
|
|
17
|
+
attr_accessor :excludes
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# Stores the path to the archive directory
|
|
21
|
+
attr_accessor :archive_path
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
# Takes the name of the archive and the configuration block
|
|
25
|
+
def initialize(name, &block)
|
|
26
|
+
@name = name.to_sym
|
|
27
|
+
@paths = Array.new
|
|
28
|
+
@excludes = Array.new
|
|
29
|
+
@archive_path = File.join(TMP_PATH, TRIGGER, 'archive')
|
|
30
|
+
|
|
31
|
+
instance_eval(&block)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# Adds new paths to the @paths instance variable array
|
|
36
|
+
def add(path)
|
|
37
|
+
@paths << path
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# Adds new paths to the @excludes instance variable array
|
|
42
|
+
def exclude(path)
|
|
43
|
+
@excludes << path
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Archives all the provided paths in to a single .tar file
|
|
48
|
+
# and places that .tar file in the folder which later will be packaged
|
|
49
|
+
def perform!
|
|
50
|
+
mkdir(archive_path)
|
|
51
|
+
Logger.message("#{ self.class } started packaging and archiving #{ paths.map { |path| "\"#{path}\""}.join(", ") }.")
|
|
52
|
+
run("#{ utility(:tar) } -c -f '#{ File.join(archive_path, "#{name}.tar") }' #{ paths_to_exclude } #{ paths_to_package } 2> /dev/null")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
##
|
|
58
|
+
# Returns a "tar-ready" string of all the specified paths combined
|
|
59
|
+
def paths_to_package
|
|
60
|
+
paths.map do |path|
|
|
61
|
+
"'#{path}'"
|
|
62
|
+
end.join("\s")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Returns a "tar-ready" string of all the specified excludes combined
|
|
67
|
+
def paths_to_exclude
|
|
68
|
+
if excludes.any?
|
|
69
|
+
excludes.map{ |e| "--exclude='#{e}'" }.join(" ")
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
data/lib/backup/cli.rb
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module CLI
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# Wrapper method for %x[] to run CL commands
|
|
8
|
+
# through a ruby method. This helps with test coverage and
|
|
9
|
+
# improves readability.
|
|
10
|
+
#
|
|
11
|
+
# It'll first remove all prefixing slashes ( / ) by using .gsub(/^\s+/, '')
|
|
12
|
+
# This allows for the EOS blocks to be indented without actually using any
|
|
13
|
+
# prefixing spaces. This cleans up the implementation code.
|
|
14
|
+
#
|
|
15
|
+
# Every time the Backup::CLI#run method is invoked, it'll invoke
|
|
16
|
+
# the Backup::CLI#raise_if_command_not_found method after running the
|
|
17
|
+
# requested command on the OS.
|
|
18
|
+
#
|
|
19
|
+
# Backup::CLI#raise_if_command_not_found takes a single argument, the utility name.
|
|
20
|
+
# the command.slice(0, command.index(/\s/)).split('/')[-1] line will extract only the utility
|
|
21
|
+
# name (e.g. mongodump, pgdump, etc) from a command like "/usr/local/bin/mongodump <options>"
|
|
22
|
+
# and pass that in to the Backup::CLI#raise_if_command_not_found
|
|
23
|
+
def run(command)
|
|
24
|
+
command.gsub!(/^\s+/, '')
|
|
25
|
+
raise_if_command_not_found!(
|
|
26
|
+
command.slice(0, command.index(/\s/)).split('/')[-1]
|
|
27
|
+
)
|
|
28
|
+
%x[#{command}]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Wrapper method for FileUtils.mkdir_p to create directories
|
|
33
|
+
# through a ruby method. This helps with test coverage and
|
|
34
|
+
# improves readability
|
|
35
|
+
def mkdir(path)
|
|
36
|
+
FileUtils.mkdir_p(path)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# Wrapper for the FileUtils.rm_rf to remove files and folders
|
|
41
|
+
# through a ruby method. This helps with test coverage and
|
|
42
|
+
# improves readability
|
|
43
|
+
def rm(path)
|
|
44
|
+
FileUtils.rm_rf(path)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
# Tries to find the full path of the specified utility. If the full
|
|
49
|
+
# path is found, it'll return that. Otherwise it'll just return the
|
|
50
|
+
# name of the utility. If the 'utility_path' is defined, it'll check
|
|
51
|
+
# to see if it isn't an empty string, and if it isn't, it'll go ahead and
|
|
52
|
+
# always use that path rather than auto-detecting it
|
|
53
|
+
def utility(name)
|
|
54
|
+
if respond_to?(:utility_path)
|
|
55
|
+
if utility_path.is_a?(String) and not utility_path.empty?
|
|
56
|
+
return utility_path
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if path = %x[which #{name}].chomp and not path.empty?
|
|
61
|
+
return path
|
|
62
|
+
end
|
|
63
|
+
name
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
# If the command that was previously run via this Ruby process returned
|
|
68
|
+
# error code "32512", the invoked utility (e.g. mysqldump, pgdump, etc) could not be found.
|
|
69
|
+
# If this is the case then this method will throw an exception, informing the user of this problem.
|
|
70
|
+
#
|
|
71
|
+
# Since this raises an exception, it'll stop the entire backup process, clean up the temp files
|
|
72
|
+
# and notify the user via the built-in notifiers if these are set.
|
|
73
|
+
def raise_if_command_not_found!(utility)
|
|
74
|
+
if $?.to_i.eql?(32512)
|
|
75
|
+
raise Exception::CommandNotFound , "Could not find the utility \"#{utility}\" on \"#{RUBY_PLATFORM}\".\n" +
|
|
76
|
+
"If this is a database utility, try defining the 'utility_path' option in the configuration file.\n" +
|
|
77
|
+
"See the Database Wiki for more information about the Utility Path option."
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Compressor
|
|
5
|
+
class Base
|
|
6
|
+
include Backup::CLI
|
|
7
|
+
include Backup::Configuration::Helpers
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Logs a message to the console and log file to inform
|
|
11
|
+
# the client that Backup is compressing the archive
|
|
12
|
+
def log!
|
|
13
|
+
Backup::Logger.message "#{ self.class } started compressing the archive."
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Compressor
|
|
5
|
+
class Bzip2 < Base
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Tells Backup::Compressor::Bzip2 to compress
|
|
9
|
+
# better (-9) rather than faster when set to true
|
|
10
|
+
attr_writer :best
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# Tells Backup::Compressor::Bzip2 to compress
|
|
14
|
+
# faster (-1) rather than better when set to true
|
|
15
|
+
attr_writer :fast
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# Creates a new instance of Backup::Compressor::Bzip2 and
|
|
19
|
+
# configures it to either compress faster or better
|
|
20
|
+
# bzip2 compresses by default with -9 (best compression)
|
|
21
|
+
# and lower block sizes don't make things significantly faster
|
|
22
|
+
# (according to official bzip2 docs)
|
|
23
|
+
def initialize(&block)
|
|
24
|
+
load_defaults!
|
|
25
|
+
|
|
26
|
+
@best ||= false
|
|
27
|
+
@fast ||= false
|
|
28
|
+
|
|
29
|
+
instance_eval(&block) if block_given?
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
# Performs the compression of the packages backup file
|
|
34
|
+
def perform!
|
|
35
|
+
log!
|
|
36
|
+
run("#{ utility(:bzip2) } #{ options } '#{ Backup::Model.file }'")
|
|
37
|
+
Backup::Model.extension += '.bz2'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Combines the provided options and returns a bzip2 options string
|
|
44
|
+
def options
|
|
45
|
+
(best + fast).join("\s")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Returns the bzip2 option syntax for compressing
|
|
50
|
+
# setting @best to true is redundant, as bzip2 compresses best by default
|
|
51
|
+
def best
|
|
52
|
+
return ['--best'] if @best; []
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
##
|
|
56
|
+
# Returns the bzip2 option syntax for compressing
|
|
57
|
+
# (not significantly) faster when @fast is set to true
|
|
58
|
+
def fast
|
|
59
|
+
return ['--fast'] if @fast; []
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Compressor
|
|
5
|
+
class Gzip < Base
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Tells Backup::Compressor::Gzip to compress
|
|
9
|
+
# better rather than faster when set to true
|
|
10
|
+
attr_writer :best
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# Tells Backup::Compressor::Gzip to compress
|
|
14
|
+
# faster rather than better when set to true
|
|
15
|
+
attr_writer :fast
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# Creates a new instance of Backup::Compressor::Gzip and
|
|
19
|
+
# configures it to either compress faster or better
|
|
20
|
+
def initialize(&block)
|
|
21
|
+
load_defaults!
|
|
22
|
+
|
|
23
|
+
@best ||= false
|
|
24
|
+
@fast ||= false
|
|
25
|
+
|
|
26
|
+
instance_eval(&block) if block_given?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Performs the compression of the packages backup file
|
|
31
|
+
def perform!
|
|
32
|
+
log!
|
|
33
|
+
run("#{ utility(:gzip) } #{ options } '#{ Backup::Model.file }'")
|
|
34
|
+
Backup::Model.extension += '.gz'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# Combines the provided options and returns a gzip options string
|
|
41
|
+
def options
|
|
42
|
+
(best + fast).join("\s")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# Returns the gzip option syntax for compressing
|
|
47
|
+
# better when @best is set to true
|
|
48
|
+
def best
|
|
49
|
+
return ['--best'] if @best; []
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Returns the gzip option syntax for compressing
|
|
54
|
+
# faster when @fast is set to true
|
|
55
|
+
def fast
|
|
56
|
+
return ['--fast'] if @fast; []
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Configuration
|
|
5
|
+
module Compressor
|
|
6
|
+
class Bzip2 < Base
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Tells Backup::Compressor::Bzip2 to compress
|
|
11
|
+
# better (-9) which is bzip2 default anyway
|
|
12
|
+
attr_accessor :best
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Tells Backup::Compressor::Bzip2 to compress
|
|
16
|
+
# faster (-1) (but not significantly faster)
|
|
17
|
+
attr_accessor :fast
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Configuration
|
|
5
|
+
module Compressor
|
|
6
|
+
class Gzip < Base
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Tells Backup::Compressor::Gzip to compress
|
|
11
|
+
# better rather than faster when set to true
|
|
12
|
+
attr_accessor :best
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Tells Backup::Compressor::Gzip to compress
|
|
16
|
+
# faster rather than better when set to true
|
|
17
|
+
attr_accessor :fast
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Configuration
|
|
5
|
+
module Database
|
|
6
|
+
class Base < Backup::Configuration::Base
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Allows the user to specify the path to a "dump" utility
|
|
11
|
+
# in case it cannot be auto-detected by Backup
|
|
12
|
+
attr_accessor :utility_path
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Configuration
|
|
5
|
+
module Database
|
|
6
|
+
class MongoDB < Base
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Name of the database that needs to get dumped
|
|
11
|
+
attr_accessor :name
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# Credentials for the specified database
|
|
15
|
+
attr_accessor :username, :password
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# Connectivity options
|
|
19
|
+
attr_accessor :host, :port
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# IPv6 support (disabled by default)
|
|
23
|
+
attr_accessor :ipv6
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Collections to dump, collections that aren't specified won't get dumped
|
|
27
|
+
attr_accessor :only_collections
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Additional "mongodump" options
|
|
31
|
+
attr_accessor :additional_options
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# 'lock' dump meaning wrapping mongodump with fsync & lock
|
|
35
|
+
attr_accessor :lock
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Backup
|
|
4
|
+
module Configuration
|
|
5
|
+
module Database
|
|
6
|
+
class MySQL < Base
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Name of the database that needs to get dumped
|
|
11
|
+
attr_accessor :name
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# Credentials for the specified database
|
|
15
|
+
attr_accessor :username, :password
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# Connectivity options
|
|
19
|
+
attr_accessor :host, :port, :socket
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# Tables to skip while dumping the database
|
|
23
|
+
attr_accessor :skip_tables
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Tables to dump, tables that aren't specified won't get dumped
|
|
27
|
+
attr_accessor :only_tables
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Additional "mysqldump" options
|
|
31
|
+
attr_accessor :additional_options
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|