backup 2.4.5.1 → 3.0.0.build.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.infinity_test +7 -0
- data/.rspec +3 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +88 -0
- data/LICENSE.md +24 -0
- data/README.md +189 -75
- data/backup.gemspec +41 -0
- data/bin/backup +161 -90
- data/lib/backup.rb +133 -117
- data/lib/backup/archive.rb +54 -0
- data/lib/backup/cli.rb +50 -0
- data/lib/backup/compressor/base.rb +17 -0
- data/lib/backup/compressor/gzip.rb +61 -0
- data/lib/backup/configuration/base.rb +7 -67
- data/lib/backup/configuration/compressor/base.rb +10 -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 +37 -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 +47 -17
- data/lib/backup/configuration/notifier/base.rb +39 -0
- data/lib/backup/configuration/notifier/mail.rb +52 -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 +25 -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/database/base.rb +33 -0
- data/lib/backup/database/mongodb.rb +137 -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/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/finder.rb +39 -0
- data/lib/backup/logger.rb +80 -0
- data/lib/backup/model.rb +249 -0
- data/lib/backup/notifier/base.rb +29 -0
- data/lib/backup/notifier/binder.rb +32 -0
- data/lib/backup/notifier/mail.rb +141 -0
- data/lib/backup/notifier/templates/notify_failure.erb +31 -0
- data/lib/backup/notifier/templates/notify_success.erb +16 -0
- data/lib/backup/storage/base.rb +60 -3
- data/lib/backup/storage/cloudfiles.rb +85 -6
- data/lib/backup/storage/dropbox.rb +74 -4
- data/lib/backup/storage/ftp.rb +103 -27
- data/lib/backup/storage/object.rb +45 -0
- data/lib/backup/storage/rsync.rb +100 -0
- data/lib/backup/storage/s3.rb +100 -7
- data/lib/backup/storage/scp.rb +94 -19
- data/lib/backup/storage/sftp.rb +94 -19
- data/lib/backup/version.rb +70 -1
- data/lib/templates/archive +4 -0
- data/lib/templates/compressor/gzip +4 -0
- data/lib/templates/database/mongodb +10 -0
- data/lib/templates/database/mysql +11 -0
- data/lib/templates/database/postgresql +11 -0
- data/lib/templates/database/redis +10 -0
- data/lib/templates/encryptor/gpg +9 -0
- data/lib/templates/encryptor/openssl +5 -0
- data/lib/templates/notifier/mail +14 -0
- data/lib/templates/readme +15 -0
- data/lib/templates/storage/cloudfiles +7 -0
- data/lib/templates/storage/dropbox +8 -0
- data/lib/templates/storage/ftp +8 -0
- data/lib/templates/storage/rsync +7 -0
- data/lib/templates/storage/s3 +8 -0
- data/lib/templates/storage/scp +8 -0
- data/lib/templates/storage/sftp +8 -0
- data/spec/archive_spec.rb +53 -0
- data/spec/backup_spec.rb +11 -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/mail_spec.rb +32 -0
- data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
- data/spec/configuration/storage/dropbox_spec.rb +40 -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/database/base_spec.rb +30 -0
- data/spec/database/mongodb_spec.rb +144 -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 +37 -0
- data/spec/model_spec.rb +236 -0
- data/spec/notifier/mail_spec.rb +97 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/storage/base_spec.rb +33 -0
- data/spec/storage/cloudfiles_spec.rb +102 -0
- data/spec/storage/dropbox_spec.rb +89 -0
- data/spec/storage/ftp_spec.rb +133 -0
- data/spec/storage/object_spec.rb +74 -0
- data/spec/storage/rsync_spec.rb +115 -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/version_spec.rb +32 -0
- metadata +139 -123
- data/CHANGELOG +0 -131
- data/LICENSE +0 -20
- data/generators/backup/backup_generator.rb +0 -69
- data/generators/backup/templates/backup.rake +0 -56
- data/generators/backup/templates/backup.rb +0 -253
- data/generators/backup/templates/create_backup_tables.rb +0 -18
- data/generators/backup_update/backup_update_generator.rb +0 -50
- data/generators/backup_update/templates/migrations/update_backup_tables.rb +0 -27
- data/lib/backup/adapters/archive.rb +0 -34
- data/lib/backup/adapters/base.rb +0 -167
- data/lib/backup/adapters/custom.rb +0 -41
- data/lib/backup/adapters/mongo_db.rb +0 -139
- data/lib/backup/adapters/mysql.rb +0 -60
- data/lib/backup/adapters/postgresql.rb +0 -60
- data/lib/backup/adapters/sqlite.rb +0 -25
- data/lib/backup/command_helper.rb +0 -14
- data/lib/backup/configuration/adapter.rb +0 -21
- data/lib/backup/configuration/adapter_options.rb +0 -8
- data/lib/backup/configuration/attributes.rb +0 -19
- data/lib/backup/configuration/mail.rb +0 -20
- data/lib/backup/configuration/smtp.rb +0 -8
- data/lib/backup/configuration/storage.rb +0 -8
- data/lib/backup/connection/cloudfiles.rb +0 -75
- data/lib/backup/connection/dropbox.rb +0 -63
- data/lib/backup/connection/s3.rb +0 -88
- data/lib/backup/core_ext/object.rb +0 -5
- data/lib/backup/environment/base.rb +0 -12
- data/lib/backup/environment/rails_configuration.rb +0 -15
- data/lib/backup/environment/unix_configuration.rb +0 -109
- data/lib/backup/mail/base.rb +0 -97
- data/lib/backup/mail/mail.txt +0 -7
- data/lib/backup/record/base.rb +0 -65
- data/lib/backup/record/cloudfiles.rb +0 -28
- data/lib/backup/record/dropbox.rb +0 -27
- data/lib/backup/record/ftp.rb +0 -39
- data/lib/backup/record/local.rb +0 -26
- data/lib/backup/record/s3.rb +0 -25
- data/lib/backup/record/scp.rb +0 -33
- data/lib/backup/record/sftp.rb +0 -38
- data/lib/backup/storage/local.rb +0 -22
- data/lib/generators/backup/USAGE +0 -10
- data/lib/generators/backup/backup_generator.rb +0 -47
- data/lib/generators/backup/templates/backup.rake +0 -56
- data/lib/generators/backup/templates/backup.rb +0 -236
- data/lib/generators/backup/templates/create_backup_tables.rb +0 -18
- data/setup/backup.rb +0 -257
- data/setup/backup.sqlite3 +0 -0
@@ -0,0 +1,54 @@
|
|
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 the path to the archive directory
|
17
|
+
attr_accessor :archive_path
|
18
|
+
|
19
|
+
##
|
20
|
+
# Takes the name of the archive and the configuration block
|
21
|
+
def initialize(name, &block)
|
22
|
+
@name = name.to_sym
|
23
|
+
@paths = Array.new
|
24
|
+
@archive_path = File.join(TMP_PATH, TRIGGER, 'archive')
|
25
|
+
|
26
|
+
instance_eval(&block)
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Adds new paths to the @paths instance variable array
|
31
|
+
def add(path)
|
32
|
+
@paths << path
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Archives all the provided paths in to a single .tar file
|
37
|
+
# and places that .tar file in the folder which later will be packaged
|
38
|
+
def perform!
|
39
|
+
mkdir(archive_path)
|
40
|
+
Logger.message("#{ self.class } started packaging and archiving #{ paths.map { |path| "\"#{path}\""}.join(", ") }.")
|
41
|
+
run("#{ utility(:tar) } -c #{ paths_to_package } 1> '#{ File.join(archive_path, "#{name}.tar") }' 2> /dev/null")
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
##
|
47
|
+
# Returns a "tar-ready" string of all the specified paths combined
|
48
|
+
def paths_to_package
|
49
|
+
paths.map do |path|
|
50
|
+
"'#{path}'"
|
51
|
+
end.join("\s")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/backup/cli.rb
ADDED
@@ -0,0 +1,50 @@
|
|
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
|
+
def run(command)
|
11
|
+
%x[#{command}]
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Wrapper method for FileUtils.mkdir_p to create directories
|
16
|
+
# through a ruby method. This helps with test coverage and
|
17
|
+
# improves readability
|
18
|
+
def mkdir(path)
|
19
|
+
FileUtils.mkdir_p(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Wrapper for the FileUtils.rm_rf to remove files and folders
|
24
|
+
# through a ruby method. This helps with test coverage and
|
25
|
+
# improves readability
|
26
|
+
def rm(path)
|
27
|
+
FileUtils.rm_rf(path)
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Tries to find the full path of the specified utility. If the full
|
32
|
+
# path is found, it'll return that. Otherwise it'll just return the
|
33
|
+
# name of the utility. If the 'utility_path' is defined, it'll check
|
34
|
+
# to see if it isn't an empty string, and if it isn't, it'll go ahead and
|
35
|
+
# always use that path rather than auto-detecting it
|
36
|
+
def utility(name)
|
37
|
+
if respond_to?(:utility_path)
|
38
|
+
if utility_path.is_a?(String) and not utility_path.empty?
|
39
|
+
return utility_path
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
if path = %x[which #{name}].chomp and not path.empty?
|
44
|
+
return path
|
45
|
+
end
|
46
|
+
name
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
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,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
|
@@ -1,74 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module Backup
|
2
4
|
module Configuration
|
3
5
|
class Base
|
4
|
-
extend Backup::Configuration::
|
5
|
-
generate_attributes %w(encrypt_with_password encrypt_with_gpg_public_key keep_backups notify)
|
6
|
-
|
7
|
-
attr_accessor :trigger, :storage_name, :adapter_name, :before_backup_block, :after_backup_block
|
8
|
-
|
9
|
-
def initialize(trigger)
|
10
|
-
@trigger = trigger
|
11
|
-
@adapter_configuration = Backup::Configuration::Adapter.new
|
12
|
-
@storage_configuration = Backup::Configuration::Storage.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def adapter(adapter, &block)
|
16
|
-
@adapter_name = adapter
|
17
|
-
@adapter_configuration.instance_eval &block
|
18
|
-
end
|
19
|
-
|
20
|
-
def storage(storage, &block)
|
21
|
-
@storage_name = storage
|
22
|
-
@storage_configuration.instance_eval &block
|
23
|
-
end
|
24
|
-
|
25
|
-
def before_backup(&block)
|
26
|
-
@before_backup_block = block
|
27
|
-
end
|
28
|
-
|
29
|
-
def after_backup(&block)
|
30
|
-
@after_backup_block = block
|
31
|
-
end
|
32
|
-
|
33
|
-
def storage_class
|
34
|
-
case @storage_name.to_sym
|
35
|
-
when :cloudfiles then Backup::Storage::CloudFiles
|
36
|
-
when :s3 then Backup::Storage::S3
|
37
|
-
when :scp then Backup::Storage::SCP
|
38
|
-
when :ftp then Backup::Storage::FTP
|
39
|
-
when :sftp then Backup::Storage::SFTP
|
40
|
-
when :local then Backup::Storage::Local
|
41
|
-
when :dropbox then Backup::Storage::Dropbox
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def record_class
|
46
|
-
case @storage_name.to_sym
|
47
|
-
when :cloudfiles then Backup::Record::CloudFiles
|
48
|
-
when :s3 then Backup::Record::S3
|
49
|
-
when :scp then Backup::Record::SCP
|
50
|
-
when :ftp then Backup::Record::FTP
|
51
|
-
when :sftp then Backup::Record::SFTP
|
52
|
-
when :local then Backup::Record::Local
|
53
|
-
when :dropbox then Backup::Record::Dropbox
|
54
|
-
end
|
55
|
-
end
|
6
|
+
extend Backup::Configuration::Helpers
|
56
7
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
def initialize_record
|
63
|
-
record_class.new
|
64
|
-
end
|
65
|
-
|
66
|
-
def get_adapter_configuration
|
67
|
-
@adapter_configuration
|
68
|
-
end
|
69
|
-
|
70
|
-
def get_storage_configuration
|
71
|
-
@storage_configuration
|
8
|
+
##
|
9
|
+
# Allows for global configuration through block-notation
|
10
|
+
def self.defaults
|
11
|
+
yield self
|
72
12
|
end
|
73
13
|
end
|
74
14
|
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,37 @@
|
|
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
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Backup
|
4
|
+
module Configuration
|
5
|
+
module Database
|
6
|
+
class PostgreSQL < 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 "pg_dump" options
|
31
|
+
attr_accessor :additional_options
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Backup
|
4
|
+
module Configuration
|
5
|
+
module Database
|
6
|
+
class Redis < Base
|
7
|
+
class << self
|
8
|
+
|
9
|
+
##
|
10
|
+
# Name of and path to the database that needs to get dumped
|
11
|
+
attr_accessor :name, :path
|
12
|
+
|
13
|
+
##
|
14
|
+
# Credentials for the specified database
|
15
|
+
attr_accessor :password
|
16
|
+
|
17
|
+
##
|
18
|
+
# Determines whether Backup should invoke the SAVE command through
|
19
|
+
# the 'redis-cli' utility to persist the most recent data before
|
20
|
+
# copying over the dump file
|
21
|
+
attr_accessor :invoke_save
|
22
|
+
|
23
|
+
##
|
24
|
+
# Connectivity options
|
25
|
+
attr_accessor :host, :port, :socket
|
26
|
+
|
27
|
+
##
|
28
|
+
# Additional "redis-cli" options
|
29
|
+
attr_accessor :additional_options
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|