backup-wakiki 2.4.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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/CHANGELOG +77 -0
- data/LICENSE +9 -0
- data/README.textile +175 -0
- data/Rakefile +65 -0
- data/VERSION +1 -0
- data/backup-2.3.1.gem +0 -0
- data/backup-wakiki.gemspec +113 -0
- data/backup.gemspec +111 -0
- data/bin/backup +124 -0
- data/generators/backup/backup_generator.rb +72 -0
- data/generators/backup/templates/config/backup.rb +202 -0
- data/generators/backup/templates/migrations/create_backup_tables.rb +18 -0
- data/generators/backup/templates/tasks/backup.rake +71 -0
- data/generators/backup_update/backup_update_generator.rb +50 -0
- data/generators/backup_update/templates/migrations/update_backup_tables.rb +27 -0
- data/lib/backup.rb +112 -0
- data/lib/backup/adapters/archive.rb +34 -0
- data/lib/backup/adapters/base.rb +113 -0
- data/lib/backup/adapters/custom.rb +41 -0
- data/lib/backup/adapters/mysql.rb +60 -0
- data/lib/backup/adapters/postgresql.rb +56 -0
- data/lib/backup/adapters/sqlite.rb +25 -0
- data/lib/backup/command_helper.rb +11 -0
- data/lib/backup/configuration/adapter.rb +21 -0
- data/lib/backup/configuration/adapter_options.rb +8 -0
- data/lib/backup/configuration/attributes.rb +19 -0
- data/lib/backup/configuration/base.rb +55 -0
- data/lib/backup/configuration/helpers.rb +24 -0
- data/lib/backup/configuration/mail.rb +20 -0
- data/lib/backup/configuration/smtp.rb +8 -0
- data/lib/backup/configuration/storage.rb +8 -0
- data/lib/backup/connection/s3.rb +87 -0
- data/lib/backup/environment/base.rb +12 -0
- data/lib/backup/environment/rails.rb +17 -0
- data/lib/backup/environment/unix.rb +94 -0
- data/lib/backup/mail/base.rb +96 -0
- data/lib/backup/mail/mail.txt +7 -0
- data/lib/backup/record/base.rb +65 -0
- data/lib/backup/record/ftp.rb +39 -0
- data/lib/backup/record/local.rb +26 -0
- data/lib/backup/record/s3.rb +26 -0
- data/lib/backup/record/scp.rb +33 -0
- data/lib/backup/record/sftp.rb +38 -0
- data/lib/backup/storage/ftp.rb +38 -0
- data/lib/backup/storage/local.rb +24 -0
- data/lib/backup/storage/s3.rb +16 -0
- data/lib/backup/storage/scp.rb +30 -0
- data/lib/backup/storage/sftp.rb +31 -0
- data/setup/backup.rb +202 -0
- data/setup/backup.sqlite3 +0 -0
- data/spec/configuration/attributes_spec.rb +35 -0
- metadata +183 -0
data/backup.gemspec
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{backup}
|
|
8
|
+
s.version = "2.4.0"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Michael van Rooijen", "Fernando Migliorini Luiz\303\243o"]
|
|
12
|
+
s.date = %q{2010-06-25}
|
|
13
|
+
s.default_executable = %q{backup}
|
|
14
|
+
s.description = %q{
|
|
15
|
+
Backup is a Ruby Gem written for Unix and Rails environments. It can be used both with and without the
|
|
16
|
+
Ruby on Rails framework! This gem offers a quick and simple solution to backing up databases such as
|
|
17
|
+
MySQL/PostgreSQL and Files/Folders. All backups can be transferred to Amazon S3 or any remote server you
|
|
18
|
+
have access to, using either SCP, SFTP or regular FTP. Backup handles Compression, Archiving, Encryption,
|
|
19
|
+
Backup Cleaning (Cycling) and supports Email Notifications.
|
|
20
|
+
}
|
|
21
|
+
s.email = %q{meskyanichi@gmail.com}
|
|
22
|
+
s.executables = ["backup"]
|
|
23
|
+
s.extra_rdoc_files = [
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.textile"
|
|
26
|
+
]
|
|
27
|
+
s.files = [
|
|
28
|
+
".document",
|
|
29
|
+
".gitignore",
|
|
30
|
+
"CHANGELOG",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"README.textile",
|
|
33
|
+
"Rakefile",
|
|
34
|
+
"VERSION",
|
|
35
|
+
"backup.gemspec",
|
|
36
|
+
"bin/backup",
|
|
37
|
+
"generators/backup/backup_generator.rb",
|
|
38
|
+
"generators/backup/templates/config/backup.rb",
|
|
39
|
+
"generators/backup/templates/migrations/create_backup_tables.rb",
|
|
40
|
+
"generators/backup/templates/tasks/backup.rake",
|
|
41
|
+
"generators/backup_update/backup_update_generator.rb",
|
|
42
|
+
"generators/backup_update/templates/migrations/update_backup_tables.rb",
|
|
43
|
+
"lib/backup.rb",
|
|
44
|
+
"lib/backup/adapters/archive.rb",
|
|
45
|
+
"lib/backup/adapters/base.rb",
|
|
46
|
+
"lib/backup/adapters/custom.rb",
|
|
47
|
+
"lib/backup/adapters/mysql.rb",
|
|
48
|
+
"lib/backup/adapters/postgresql.rb",
|
|
49
|
+
"lib/backup/adapters/sqlite.rb",
|
|
50
|
+
"lib/backup/command_helper.rb",
|
|
51
|
+
"lib/backup/configuration/adapter.rb",
|
|
52
|
+
"lib/backup/configuration/adapter_options.rb",
|
|
53
|
+
"lib/backup/configuration/attributes.rb",
|
|
54
|
+
"lib/backup/configuration/base.rb",
|
|
55
|
+
"lib/backup/configuration/helpers.rb",
|
|
56
|
+
"lib/backup/configuration/mail.rb",
|
|
57
|
+
"lib/backup/configuration/smtp.rb",
|
|
58
|
+
"lib/backup/configuration/storage.rb",
|
|
59
|
+
"lib/backup/connection/s3.rb",
|
|
60
|
+
"lib/backup/environment/base.rb",
|
|
61
|
+
"lib/backup/environment/rails.rb",
|
|
62
|
+
"lib/backup/environment/unix.rb",
|
|
63
|
+
"lib/backup/mail/base.rb",
|
|
64
|
+
"lib/backup/mail/mail.txt",
|
|
65
|
+
"lib/backup/record/base.rb",
|
|
66
|
+
"lib/backup/record/ftp.rb",
|
|
67
|
+
"lib/backup/record/local.rb",
|
|
68
|
+
"lib/backup/record/s3.rb",
|
|
69
|
+
"lib/backup/record/scp.rb",
|
|
70
|
+
"lib/backup/record/sftp.rb",
|
|
71
|
+
"lib/backup/storage/ftp.rb",
|
|
72
|
+
"lib/backup/storage/local.rb",
|
|
73
|
+
"lib/backup/storage/s3.rb",
|
|
74
|
+
"lib/backup/storage/scp.rb",
|
|
75
|
+
"lib/backup/storage/sftp.rb",
|
|
76
|
+
"setup/backup.rb",
|
|
77
|
+
"setup/backup.sqlite3",
|
|
78
|
+
"spec/configuration/attributes_spec.rb"
|
|
79
|
+
]
|
|
80
|
+
s.homepage = %q{http://final-creation.com/open-source}
|
|
81
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
82
|
+
s.require_paths = ["lib"]
|
|
83
|
+
s.rubygems_version = %q{1.3.7}
|
|
84
|
+
s.summary = %q{Backup is a Ruby Gem that simplifies making backups for databases, files and folders.}
|
|
85
|
+
s.test_files = [
|
|
86
|
+
"spec/configuration/attributes_spec.rb"
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
if s.respond_to? :specification_version then
|
|
90
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
91
|
+
s.specification_version = 3
|
|
92
|
+
|
|
93
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
94
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 2.3.5"])
|
|
95
|
+
s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
|
96
|
+
s.add_runtime_dependency(%q<hirb>, [">= 0.2.9"])
|
|
97
|
+
s.add_runtime_dependency(%q<pony>, [">= 0.5"])
|
|
98
|
+
else
|
|
99
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
|
100
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
|
101
|
+
s.add_dependency(%q<hirb>, [">= 0.2.9"])
|
|
102
|
+
s.add_dependency(%q<pony>, [">= 0.5"])
|
|
103
|
+
end
|
|
104
|
+
else
|
|
105
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.5"])
|
|
106
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
|
107
|
+
s.add_dependency(%q<hirb>, [">= 0.2.9"])
|
|
108
|
+
s.add_dependency(%q<pony>, [">= 0.5"])
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
data/bin/backup
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'backup'
|
|
4
|
+
|
|
5
|
+
include Backup::Environment::Unix::Commands
|
|
6
|
+
include Backup::Environment::Unix::Helpers
|
|
7
|
+
|
|
8
|
+
options = {}
|
|
9
|
+
|
|
10
|
+
optparse = OptionParser.new do |opts|
|
|
11
|
+
|
|
12
|
+
opts.banner = "\nUsage: backup [options]\n "
|
|
13
|
+
|
|
14
|
+
opts.on('-r', '--run [trigger]', "Runs backup process by trigger") do |trigger|
|
|
15
|
+
confirm_configuration_file_existence
|
|
16
|
+
puts "Running: #{trigger}."
|
|
17
|
+
Backup::Setup.new(trigger, @backup_procedures).initialize_adapter
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
opts.on('-f', '--find [trigger]', "Finds backup records by trigger") do |trigger|
|
|
21
|
+
confirm_configuration_file_existence
|
|
22
|
+
puts "Finding backup records with trigger: #{trigger}."
|
|
23
|
+
backup = Backup::Setup.new(trigger, @backup_procedures)
|
|
24
|
+
records = Array.new
|
|
25
|
+
case backup.procedure.storage_name.to_sym
|
|
26
|
+
when :s3 then records = Backup::Record::S3.all :conditions => {:trigger => trigger}
|
|
27
|
+
when :scp then records = Backup::Record::SCP.all :conditions => {:trigger => trigger}
|
|
28
|
+
when :ftp then records = Backup::Record::FTP.all :conditions => {:trigger => trigger}
|
|
29
|
+
when :sftp then records = Backup::Record::SFTP.all :conditions => {:trigger => trigger}
|
|
30
|
+
when :local then records = Backup::Record::Local.all :conditions => {:trigger => trigger}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if options[:table]
|
|
34
|
+
puts Hirb::Helpers::AutoTable.render(records)
|
|
35
|
+
else
|
|
36
|
+
records.each do |record|
|
|
37
|
+
puts record.to_yaml
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
opts.on('-t', '--truncate [trigger]', "Truncates backup records for specified trigger") do |trigger|
|
|
43
|
+
puts "Truncating backup records with trigger: #{trigger}."
|
|
44
|
+
Backup::Record::Base.destroy_all :trigger => trigger
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
opts.on('-d', '--destroy [trigger]', "Destroys backup records and files for specified trigger") do |trigger|
|
|
48
|
+
confirm_configuration_file_existence
|
|
49
|
+
puts "Destroying backup records with trigger: #{trigger}."
|
|
50
|
+
backup = Backup::Setup.new(trigger, @backup_procedures)
|
|
51
|
+
case backup.procedure.storage_name.to_sym
|
|
52
|
+
when :s3 then Backup::Record::S3.destroy_all_backups backup.procedure, trigger
|
|
53
|
+
when :scp then Backup::Record::SCP.destroy_all_backups backup.procedure, trigger
|
|
54
|
+
when :ftp then Backup::Record::FTP.destroy_all_backups backup.procedure, trigger
|
|
55
|
+
when :sftp then Backup::Record::SFTP.destroy_all_backups backup.procedure, trigger
|
|
56
|
+
when :local then Backup::Record::Local.destroy_all_backups backup.procedure, trigger
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
opts.on('--truncate-all', "Truncates all backup records") do
|
|
61
|
+
puts "Truncating all backup records."
|
|
62
|
+
Backup::Record::Base.destroy_all
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
opts.on('--destroy-all', "Destroys all backup records and files") do
|
|
66
|
+
confirm_configuration_file_existence
|
|
67
|
+
puts "Destroying all backup records."
|
|
68
|
+
backup = Backup::Setup.new(false, @backup_procedures)
|
|
69
|
+
backup.procedures.each do |backup_procedure|
|
|
70
|
+
case backup_procedure.storage_name.to_sym
|
|
71
|
+
when :s3 then Backup::Record::S3.destroy_all_backups backup_procedure, backup_procedure.trigger
|
|
72
|
+
when :scp then Backup::Record::SCP.destroy_all_backups backup_procedure, backup_procedure.trigger
|
|
73
|
+
when :ftp then Backup::Record::FTP.destroy_all_backups backup_procedure, backup_procedure.trigger
|
|
74
|
+
when :sftp then Backup::Record::SFTP.destroy_all_backups backup_procedure, backup_procedure.trigger
|
|
75
|
+
when :local then Backup::Record::Local.destroy_all_backups backup.procedure, backup_procedure.trigger
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
opts.on('--decrypt [file]', "Decrypts a \"Backup\" encrypted file") do |file|
|
|
81
|
+
puts "Attempting to decrypt: #{file}."
|
|
82
|
+
%x{ openssl enc -des-cbc -d -in #{file} -out #{file.gsub('.enc', '')} }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
options[:table] = false
|
|
86
|
+
opts.on('--table', "Shows records in table format") do |format|
|
|
87
|
+
options[:table] = true
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
opts.on('--setup', "Sets up Backup") do
|
|
91
|
+
setup
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
opts.on('--reset', "Reinstalls Backup (This will remove ALL current settings!)") do
|
|
95
|
+
reset
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
opts.on('--remove', "Removes Backup (This will remove ALL current settings!)") do
|
|
99
|
+
remove
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
opts.on('-v', '--version', 'Displays installed Backup version') do
|
|
103
|
+
File.open(File.join(File.dirname(__FILE__), '..', 'VERSION')) do |file|
|
|
104
|
+
puts "Backup version #{file.read}"
|
|
105
|
+
end
|
|
106
|
+
exit
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
opts.on('-h', '--help', 'Display help screen') do
|
|
110
|
+
puts opts
|
|
111
|
+
puts "\n "
|
|
112
|
+
exit
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
begin
|
|
118
|
+
optparse.parse!
|
|
119
|
+
rescue OptionParser::InvalidOption
|
|
120
|
+
puts "\nInvalid Option. See the list of available options below.\n"
|
|
121
|
+
puts optparse
|
|
122
|
+
puts "\n "
|
|
123
|
+
exit
|
|
124
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
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.directory "lib/tasks/backup"
|
|
17
|
+
m.file "tasks/backup.rake", "lib/tasks/backup/backup.rake"
|
|
18
|
+
|
|
19
|
+
# Generates the configuration file
|
|
20
|
+
m.directory "config"
|
|
21
|
+
m.file "config/backup.rb", "config/backup.rb"
|
|
22
|
+
|
|
23
|
+
# Generates the database migration file
|
|
24
|
+
m.migration_template "migrations/create_backup_tables.rb",
|
|
25
|
+
"db/migrate",
|
|
26
|
+
:migration_file_name => "create_backup_tables"
|
|
27
|
+
|
|
28
|
+
# Outputs the generators message to the terminal
|
|
29
|
+
puts message
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def message
|
|
34
|
+
<<-MESSAGE
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
==============================================================
|
|
39
|
+
Backup's files have been generated!
|
|
40
|
+
==============================================================
|
|
41
|
+
|
|
42
|
+
1: Add the "Backup" gem to the config/environment.rb file!
|
|
43
|
+
|
|
44
|
+
config.gem "backup"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
2: Migrate the database!
|
|
48
|
+
|
|
49
|
+
rake db:migrate
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
3: Set up some "Backup Settings" inside the backup configuration file!
|
|
53
|
+
|
|
54
|
+
config/backup.rb
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
4: Run the backups! Enjoy.
|
|
58
|
+
|
|
59
|
+
rake backup:run trigger="your-specified-trigger"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
For More Information:
|
|
63
|
+
http://github.com/meskyanichi/backup
|
|
64
|
+
|
|
65
|
+
==============================================================
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
MESSAGE
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
# - SCP (Remote Server)
|
|
26
|
+
# - FTP (Remote Server)
|
|
27
|
+
# - SFTP (Remote Server)
|
|
28
|
+
# - LOCAL (Local Server)
|
|
29
|
+
#
|
|
30
|
+
# GLOBAL OPTIONS
|
|
31
|
+
# - Keep Backups (keep_backups)
|
|
32
|
+
# - Encrypt With Pasword (encrypt_with_password)
|
|
33
|
+
# - Notify (notify)
|
|
34
|
+
#
|
|
35
|
+
# This is the "decrypt" command for all encrypted backups:
|
|
36
|
+
# sudo backup --decrypt /path/to/encrypted/file
|
|
37
|
+
#
|
|
38
|
+
# Each Backup Setting can contain:
|
|
39
|
+
# - 1 Adapter
|
|
40
|
+
# - 1 Storage Method
|
|
41
|
+
# - Multiple Global Options
|
|
42
|
+
#
|
|
43
|
+
# The combination of these, however, do not matter! So experiment with it.
|
|
44
|
+
#
|
|
45
|
+
# You can also let Backup notify you by email on successfully created backups.
|
|
46
|
+
# - Just uncomment the block of code below (notifier_settings) and fill in your credentials.
|
|
47
|
+
# - Then for set "notify" to "true" in each (backup) block you wish to be notified of.
|
|
48
|
+
#
|
|
49
|
+
# For more information on "Backup", please refer to the wiki on github
|
|
50
|
+
# http://wiki.github.com/meskyanichi/backup/configuration-file
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Notifier
|
|
54
|
+
# Uncomment this if you want to enable notification by email on successful backup runs
|
|
55
|
+
# You will also have to set "notify true" inside each backup block below to enable it for that particular backup
|
|
56
|
+
# notifier_settings do
|
|
57
|
+
#
|
|
58
|
+
# to "example1@gmail.com"
|
|
59
|
+
# from "example2@gmail.com"
|
|
60
|
+
#
|
|
61
|
+
# smtp do
|
|
62
|
+
# host "smtp.gmail.com"
|
|
63
|
+
# port "587"
|
|
64
|
+
# username "example1@gmail.com"
|
|
65
|
+
# password "example1password"
|
|
66
|
+
# authentication "plain"
|
|
67
|
+
# domain "localhost.localdomain"
|
|
68
|
+
# tls true
|
|
69
|
+
# end
|
|
70
|
+
#
|
|
71
|
+
# end
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Initialize with:
|
|
75
|
+
# rake backup:run trigger='mysql-backup-s3'
|
|
76
|
+
backup 'mysql-backup-s3' do
|
|
77
|
+
|
|
78
|
+
adapter :mysql do
|
|
79
|
+
user 'user'
|
|
80
|
+
password 'password'
|
|
81
|
+
database 'database'
|
|
82
|
+
|
|
83
|
+
# skip_tables ['table1', 'table2', 'table3']
|
|
84
|
+
#
|
|
85
|
+
# options do
|
|
86
|
+
# host '123.45.678.90'
|
|
87
|
+
# port '80'
|
|
88
|
+
# socket '/tmp/socket.sock'
|
|
89
|
+
# end
|
|
90
|
+
# additional_options '--single-transaction --quick'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
storage :s3 do
|
|
94
|
+
access_key_id 'access_key_id'
|
|
95
|
+
secret_access_key 'secret_access_key'
|
|
96
|
+
bucket '/bucket/backups/mysql/'
|
|
97
|
+
use_ssl true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
keep_backups 25
|
|
101
|
+
encrypt_with_password 'password'
|
|
102
|
+
notify false
|
|
103
|
+
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# Initialize with:
|
|
108
|
+
# rake backup:run trigger='postgresql-backup-s3'
|
|
109
|
+
backup 'postgresql-backup-scp' do
|
|
110
|
+
|
|
111
|
+
adapter :postgresql do
|
|
112
|
+
user 'user'
|
|
113
|
+
database 'database'
|
|
114
|
+
|
|
115
|
+
# skip_tables ['table1', 'table2', 'table3']
|
|
116
|
+
|
|
117
|
+
# options do
|
|
118
|
+
# host '123.45.678.90'
|
|
119
|
+
# port '80'
|
|
120
|
+
# socket '/tmp/socket.sock'
|
|
121
|
+
# end
|
|
122
|
+
# additional_options '--clean --blobs'
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
storage :scp do
|
|
126
|
+
ip 'example.com'
|
|
127
|
+
user 'user'
|
|
128
|
+
password 'password'
|
|
129
|
+
path '/var/backups/postgresql/'
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
keep_backups :all
|
|
133
|
+
encrypt_with_password false
|
|
134
|
+
notify false
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# Initialize with:
|
|
140
|
+
# rake backup:run trigger='archive-backup-ftp'
|
|
141
|
+
backup 'archive-backup-ftp' do
|
|
142
|
+
|
|
143
|
+
adapter :archive do
|
|
144
|
+
files ["#{RAILS_ROOT}/log", "#{RAILS_ROOT}/db"]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
storage :ftp do
|
|
148
|
+
ip 'example.com'
|
|
149
|
+
user 'user'
|
|
150
|
+
password 'password'
|
|
151
|
+
path '/var/backups/archive/'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
keep_backups 10
|
|
155
|
+
encrypt_with_password false
|
|
156
|
+
notify false
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
# Initialize with:
|
|
162
|
+
# rake backup:run trigger='custom-backup-sftp'
|
|
163
|
+
backup 'custom-backup-sftp' do
|
|
164
|
+
|
|
165
|
+
adapter :custom do
|
|
166
|
+
commands \
|
|
167
|
+
[ "mysqldump [options] [database] > :tmp_path/my_mysql_dump.sql",
|
|
168
|
+
"pg_dump [options] [database] > :tmp_path/my_postgresql_dump.sql",
|
|
169
|
+
"any_other_db_format [options] [database] > :tmp_path/my_any_other_db_format.sql" ]
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
storage :sftp do
|
|
173
|
+
ip 'example.com'
|
|
174
|
+
user 'user'
|
|
175
|
+
password 'password'
|
|
176
|
+
path '/var/backups/custom/'
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
keep_backups :all
|
|
180
|
+
encrypt_with_password 'password'
|
|
181
|
+
notify false
|
|
182
|
+
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# Initializ with:
|
|
187
|
+
# rake backup:run trigger='sqlite-backup-local'
|
|
188
|
+
backup 'sqlite-backup-local' do
|
|
189
|
+
|
|
190
|
+
adapter :sqlite do
|
|
191
|
+
database "#{RAILS_ROOT}/db/production.sqlite3"
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
storage :local do
|
|
195
|
+
path "/path/to/storage/location/"
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
keep_backups :all
|
|
199
|
+
encrypt_with_password false
|
|
200
|
+
notify false
|
|
201
|
+
|
|
202
|
+
end
|