backup 2.4.5.1 → 3.0.0.build.0
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/.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
data/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2009 Michael van Rooijen - Final Creation (http://michaelvanrooijen.com/)
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
class BackupGenerator < Rails::Generator::Base
|
|
2
|
-
|
|
3
|
-
# This method gets initialized when the generator gets run.
|
|
4
|
-
# It will receive an array of arguments inside @args
|
|
5
|
-
def initialize(runtime_args, runtime_options = {})
|
|
6
|
-
super
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# Processes the file generation/templating
|
|
10
|
-
# This will automatically be run after the initialize method
|
|
11
|
-
def manifest
|
|
12
|
-
record do |m|
|
|
13
|
-
|
|
14
|
-
# Generates the Rake Tasks and Backup Database
|
|
15
|
-
m.directory "lib/tasks"
|
|
16
|
-
m.file "backup.rake", "lib/tasks/backup.rake"
|
|
17
|
-
|
|
18
|
-
# Generates the configuration file
|
|
19
|
-
m.directory "config"
|
|
20
|
-
m.file "backup.rb", "config/backup.rb"
|
|
21
|
-
|
|
22
|
-
# Generates the database migration file
|
|
23
|
-
m.migration_template "create_backup_tables.rb",
|
|
24
|
-
"db/migrate",
|
|
25
|
-
:migration_file_name => "create_backup_tables"
|
|
26
|
-
|
|
27
|
-
# Outputs the generators message to the terminal
|
|
28
|
-
puts message
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def message
|
|
33
|
-
<<-MESSAGE
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
==============================================================
|
|
37
|
-
Backup's files have been generated!
|
|
38
|
-
==============================================================
|
|
39
|
-
|
|
40
|
-
1: Add the "Backup" gem to the config/environment.rb file!
|
|
41
|
-
|
|
42
|
-
config.gem "backup"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
2: Migrate the database!
|
|
46
|
-
|
|
47
|
-
rake db:migrate
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
3: Set up some "Backup Settings" inside the backup configuration file!
|
|
51
|
-
|
|
52
|
-
config/backup.rb
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
4: Run the backups! Enjoy.
|
|
56
|
-
|
|
57
|
-
rake backup:run trigger="your-specified-trigger"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
For More Information:
|
|
61
|
-
http://github.com/meskyanichi/backup
|
|
62
|
-
|
|
63
|
-
==============================================================
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
MESSAGE
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
namespace :backup do
|
|
2
|
-
|
|
3
|
-
task :boot => :environment do
|
|
4
|
-
Backup::System.boot!
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
desc "Run Backup Procedure."
|
|
8
|
-
task :run => :boot do
|
|
9
|
-
puts "Running: #{ENV['trigger']}."
|
|
10
|
-
Backup::Setup.new(ENV['trigger'], @backup_procedures).initialize_adapter
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
desc "Finds backup records by trigger"
|
|
14
|
-
task :find => :boot do
|
|
15
|
-
puts "Finding backup records with trigger: #{ENV['trigger']}."
|
|
16
|
-
backup = Backup::Setup.new(ENV['trigger'], @backup_procedures)
|
|
17
|
-
records = backup.procedure.record_class.all( :conditions => {:trigger => ENV['trigger']} )
|
|
18
|
-
|
|
19
|
-
if ENV['table'].eql?("true")
|
|
20
|
-
puts Hirb::Helpers::AutoTable.render(records)
|
|
21
|
-
else
|
|
22
|
-
records.each do |record|
|
|
23
|
-
puts record.to_yaml
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc "Truncates all records for the specified \"trigger\", excluding the physical files on s3 or the remote server."
|
|
29
|
-
task :truncate => :boot do
|
|
30
|
-
puts "Truncating backup records with trigger: #{ENV['trigger']}."
|
|
31
|
-
Backup::Record::Base.destroy_all :trigger => ENV['trigger']
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
desc "Truncates everything."
|
|
35
|
-
task :truncate_all => :boot do
|
|
36
|
-
puts "Truncating all backup records."
|
|
37
|
-
Backup::Record::Base.destroy_all
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
desc "Destroys all records for the specified \"trigger\", including the physical files on s3 or the remote server."
|
|
41
|
-
task :destroy => :boot do
|
|
42
|
-
puts "Destroying backup records with trigger: #{ENV['trigger']}."
|
|
43
|
-
backup = Backup::Setup.new(ENV['trigger'], @backup_procedures)
|
|
44
|
-
backup.procedure.record_class.destroy_all_backups( backup.procedure, ENV['trigger'] )
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
desc "Destroys all records for the specified \"trigger\", including the physical files on s3 or the remote server."
|
|
48
|
-
task :destroy_all => :boot do
|
|
49
|
-
puts "Destroying all backup records."
|
|
50
|
-
backup = Backup::Setup.new(false, @backup_procedures)
|
|
51
|
-
backup.procedures.each do |backup_procedure|
|
|
52
|
-
backup_procedure.record_class.destroy_all_backups( backup_procedure, backup_procedure.trigger )
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# Backup Configuration File
|
|
2
|
-
#
|
|
3
|
-
# Use the "backup" block to add backup settings to the configuration file.
|
|
4
|
-
# The argument before the "do" in (backup "argument" do) is called a "trigger".
|
|
5
|
-
# This acts as the identifier for the configuration.
|
|
6
|
-
#
|
|
7
|
-
# In the example below we have a "mysql-backup-s3" trigger for the backup setting.
|
|
8
|
-
# All the configuration is done inside this block. To initialize the backup process for this block,
|
|
9
|
-
# you invoke it using the following rake task:
|
|
10
|
-
#
|
|
11
|
-
# rake backup:run trigger="mysql-backup-s3"
|
|
12
|
-
#
|
|
13
|
-
# You can add as many backup block settings as you want, just be sure every trigger is unique and you can run
|
|
14
|
-
# each of them separately.
|
|
15
|
-
#
|
|
16
|
-
# ADAPTERS
|
|
17
|
-
# - MySQL
|
|
18
|
-
# - PostgreSQL
|
|
19
|
-
# - SQLite
|
|
20
|
-
# - Archive
|
|
21
|
-
# - Custom
|
|
22
|
-
#
|
|
23
|
-
# STORAGE METHODS
|
|
24
|
-
# - S3 (Amazon)
|
|
25
|
-
# - CF (Rackspace Cloud Files)
|
|
26
|
-
# - Dropbox (Dropbox Web Service)
|
|
27
|
-
# - SCP (Remote Server)
|
|
28
|
-
# - FTP (Remote Server)
|
|
29
|
-
# - SFTP (Remote Server)
|
|
30
|
-
# - LOCAL (Local Server)
|
|
31
|
-
#
|
|
32
|
-
# GLOBAL OPTIONS
|
|
33
|
-
# - Keep Backups (keep_backups)
|
|
34
|
-
# - Encrypt With Pasword (encrypt_with_password)
|
|
35
|
-
# - Encrypt With GPG Public Key (encrypt_with_gpg_public_key)
|
|
36
|
-
# - Notify (notify)
|
|
37
|
-
#
|
|
38
|
-
# This is the "decrypt" command for all encrypted backups:
|
|
39
|
-
# sudo backup --decrypt /path/to/encrypted/file
|
|
40
|
-
#
|
|
41
|
-
# Each Backup Setting can contain:
|
|
42
|
-
# - 1 Adapter
|
|
43
|
-
# - 1 Storage Method
|
|
44
|
-
# - Multiple Global Options
|
|
45
|
-
#
|
|
46
|
-
# The combination of these, however, do not matter! So experiment with it.
|
|
47
|
-
#
|
|
48
|
-
# You can also let Backup notify you by email on successfully created backups.
|
|
49
|
-
# - Just uncomment the block of code below (notifier_settings) and fill in your credentials.
|
|
50
|
-
# - Then for set "notify" to "true" in each (backup) block you wish to be notified of.
|
|
51
|
-
#
|
|
52
|
-
# For more information on "Backup", please refer to the wiki on github
|
|
53
|
-
# http://wiki.github.com/meskyanichi/backup/configuration-file
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# Notifier
|
|
57
|
-
# Uncomment this if you want to enable notification by email on successful backup runs
|
|
58
|
-
# You will also have to set "notify true" inside each backup block below to enable it for that particular backup
|
|
59
|
-
# notifier_settings do
|
|
60
|
-
#
|
|
61
|
-
# to "example1@gmail.com"
|
|
62
|
-
# from "example2@gmail.com"
|
|
63
|
-
#
|
|
64
|
-
# smtp do
|
|
65
|
-
# host "smtp.gmail.com"
|
|
66
|
-
# port "587"
|
|
67
|
-
# username "example1@gmail.com"
|
|
68
|
-
# password "example1password"
|
|
69
|
-
# authentication "plain"
|
|
70
|
-
# domain "localhost.localdomain"
|
|
71
|
-
# tls true
|
|
72
|
-
# end
|
|
73
|
-
#
|
|
74
|
-
# end
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
# Initialize with:
|
|
78
|
-
# rake backup:run trigger='mysql-backup-s3'
|
|
79
|
-
backup 'mysql-backup-s3' do
|
|
80
|
-
|
|
81
|
-
adapter :mysql do
|
|
82
|
-
user 'user'
|
|
83
|
-
password 'password'
|
|
84
|
-
database 'database'
|
|
85
|
-
|
|
86
|
-
# skip_tables ['table1', 'table2', 'table3']
|
|
87
|
-
#
|
|
88
|
-
# options do
|
|
89
|
-
# host '123.45.678.90'
|
|
90
|
-
# port '80'
|
|
91
|
-
# socket '/tmp/socket.sock'
|
|
92
|
-
# end
|
|
93
|
-
# additional_options '--single-transaction --quick'
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
storage :s3 do
|
|
97
|
-
access_key_id 'access_key_id'
|
|
98
|
-
secret_access_key 'secret_access_key'
|
|
99
|
-
bucket '/bucket/backups/mysql/'
|
|
100
|
-
use_ssl true
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
keep_backups 25
|
|
104
|
-
encrypt_with_password 'password'
|
|
105
|
-
notify false
|
|
106
|
-
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Initialize with:
|
|
110
|
-
# rake backup:run trigger='mysql-backup-cloudfiles'
|
|
111
|
-
backup 'mysql-backup-cloudfiles' do
|
|
112
|
-
|
|
113
|
-
adapter :mysql do
|
|
114
|
-
user 'user'
|
|
115
|
-
password 'password'
|
|
116
|
-
database 'database'
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
storage :cloudfiles do
|
|
120
|
-
username 'username'
|
|
121
|
-
api_key 'api_key'
|
|
122
|
-
container 'mysql_backup'
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
encrypt_with_gpg_public_key <<-KEY
|
|
126
|
-
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
127
|
-
Version: GnuPG v1.4.7 (Darwin)
|
|
128
|
-
|
|
129
|
-
Your very long public key goes here
|
|
130
|
-
-----END PGP PUBLIC KEY BLOCK-----
|
|
131
|
-
KEY
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# Initialize with:
|
|
136
|
-
# rake backup:run trigger='postgresql-backup-s3'
|
|
137
|
-
backup 'postgresql-backup-scp' do
|
|
138
|
-
|
|
139
|
-
adapter :postgresql do
|
|
140
|
-
user 'user'
|
|
141
|
-
database 'database'
|
|
142
|
-
|
|
143
|
-
# skip_tables ['table1', 'table2', 'table3']
|
|
144
|
-
|
|
145
|
-
# options do
|
|
146
|
-
# host '123.45.678.90'
|
|
147
|
-
# port '80'
|
|
148
|
-
# socket '/tmp/socket.sock'
|
|
149
|
-
# end
|
|
150
|
-
# additional_options '--clean --blobs'
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
storage :scp do
|
|
154
|
-
ip 'example.com'
|
|
155
|
-
user 'user'
|
|
156
|
-
password 'password'
|
|
157
|
-
path '/var/backups/postgresql/'
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
keep_backups :all
|
|
161
|
-
encrypt_with_password false
|
|
162
|
-
notify false
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
# Initialize with:
|
|
168
|
-
# rake backup:run trigger='archive-backup-ftp'
|
|
169
|
-
backup 'archive-backup-ftp' do
|
|
170
|
-
|
|
171
|
-
adapter :archive do
|
|
172
|
-
files ["#{RAILS_ROOT}/log", "#{RAILS_ROOT}/db"]
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
storage :ftp do
|
|
176
|
-
ip 'example.com'
|
|
177
|
-
user 'user'
|
|
178
|
-
password 'password'
|
|
179
|
-
path '/var/backups/archive/'
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
keep_backups 10
|
|
183
|
-
encrypt_with_password false
|
|
184
|
-
notify false
|
|
185
|
-
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
# Initialize with:
|
|
190
|
-
# rake backup:run trigger='custom-backup-sftp'
|
|
191
|
-
backup 'custom-backup-sftp' do
|
|
192
|
-
|
|
193
|
-
adapter :custom do
|
|
194
|
-
commands \
|
|
195
|
-
[ "mysqldump [options] [database] > :tmp_path/my_mysql_dump.sql",
|
|
196
|
-
"pg_dump [options] [database] > :tmp_path/my_postgresql_dump.sql",
|
|
197
|
-
"any_other_db_format [options] [database] > :tmp_path/my_any_other_db_format.sql" ]
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
storage :sftp do
|
|
201
|
-
ip 'example.com'
|
|
202
|
-
user 'user'
|
|
203
|
-
password 'password'
|
|
204
|
-
path '/var/backups/custom/'
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
keep_backups :all
|
|
208
|
-
encrypt_with_password 'password'
|
|
209
|
-
notify false
|
|
210
|
-
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
# Initializ with:
|
|
215
|
-
# rake backup:run trigger='sqlite-backup-local'
|
|
216
|
-
backup 'sqlite-backup-local' do
|
|
217
|
-
|
|
218
|
-
adapter :sqlite do
|
|
219
|
-
database "#{RAILS_ROOT}/db/production.sqlite3"
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
storage :local do
|
|
223
|
-
path "/path/to/storage/location/"
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
keep_backups :all
|
|
227
|
-
encrypt_with_password false
|
|
228
|
-
notify false
|
|
229
|
-
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
# Initialize with
|
|
234
|
-
# rake backup:run trigger='postgresql-backup-dropbox'
|
|
235
|
-
backup 'postgresql-backup-dropbox' do
|
|
236
|
-
|
|
237
|
-
adapter :postgresql do
|
|
238
|
-
user 'devmen'
|
|
239
|
-
database 'domowoi_test'
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
storage :dropbox do
|
|
243
|
-
api_key 'your_api_key'
|
|
244
|
-
secret_access_key 'your_api_secret'
|
|
245
|
-
username 'user@example.org'
|
|
246
|
-
password 'super_s3cret'
|
|
247
|
-
path 'backups'
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
keep_backups :all
|
|
251
|
-
encrypt_with_password false
|
|
252
|
-
notify false
|
|
253
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
class CreateBackupTables < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
create_table :backup do |t|
|
|
4
|
-
t.string :trigger
|
|
5
|
-
t.string :adapter
|
|
6
|
-
t.string :filename
|
|
7
|
-
t.string :md5sum
|
|
8
|
-
t.string :path
|
|
9
|
-
t.string :bucket
|
|
10
|
-
t.string :type
|
|
11
|
-
t.timestamps
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.down
|
|
16
|
-
drop_table :backup
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
class BackupUpdateGenerator < Rails::Generator::Base
|
|
2
|
-
|
|
3
|
-
# This method gets initialized when the generator gets run.
|
|
4
|
-
# It will receive an array of arguments inside @args
|
|
5
|
-
def initialize(runtime_args, runtime_options = {})
|
|
6
|
-
super
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# Processes the file generation/templating
|
|
10
|
-
# This will automatically be run after the initialize method
|
|
11
|
-
def manifest
|
|
12
|
-
record do |m|
|
|
13
|
-
|
|
14
|
-
# Generates the database update migration file
|
|
15
|
-
m.migration_template "migrations/update_backup_tables.rb",
|
|
16
|
-
"db/migrate",
|
|
17
|
-
:migration_file_name => "update_backup_tables"
|
|
18
|
-
|
|
19
|
-
# Outputs the generators message to the terminal
|
|
20
|
-
puts message
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def message
|
|
25
|
-
<<-MESSAGE
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
==============================================================
|
|
30
|
-
Backup's update files have been generated!
|
|
31
|
-
==============================================================
|
|
32
|
-
|
|
33
|
-
Please follow these instructions Backup:
|
|
34
|
-
|
|
35
|
-
1: Please migrate the database to finish the update!
|
|
36
|
-
|
|
37
|
-
rake db:migrate
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
For More Information:
|
|
41
|
-
http://github.com/meskyanichi/backup
|
|
42
|
-
|
|
43
|
-
==============================================================
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
MESSAGE
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end
|