backup 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,41 @@
1
+ PRETTY BIG UPDATE
2
+ === 2.2.0 ====================================
3
+
4
+ - Added Storage Methods: FTP and SFTP
5
+ - Added Adapters: PostgreSQL and Custom
6
+ - Added more options to the MySQL Adapter
7
+ - A couple of bug fixes
8
+
9
+
10
+ MINOR UPDATE
11
+ === 2.1.2 ====================================
12
+
13
+ - The backup generator will now provide you with a step-by-step guide to getting up and running
14
+ - Updated the generator itself
15
+ - Removed SQLite3 dependencies
16
+
17
+
18
+ 2 TABLES 2 1
19
+ === 2.1.1 ====================================
20
+
21
+ - Backup will from now on only utilize one table, instead of one for each storage method
22
+ - Still backwards compatible to 2.1.0
23
+
24
+
25
+ FIXED A CRUCIAL BUG
26
+ === 2.1.0 ====================================
27
+
28
+ - Problem with Backup::Record. It tried to connect to the SQLite3 database.
29
+
30
+
31
+ MAJOR RELEASE
32
+ === 2.0.0 ====================================
33
+
34
+ - Should be a lot more backwards compatible with every update I do.
35
+ - Does not depend on the separate local SQLite3 file any longer.
36
+ - Will provide a db migration file for your Rails Application to store backup record data in.
37
+ - Does not use YAML files to do configuration any longer.
38
+ - Uses a SINGLE ruby file for "all" configuration (config/backup.rb) using elegant block notations!
39
+ - Uses a SINGLE rake task to handle the initialization of any backup setting.
40
+ - Can now configure an unlimited amount of customizable backup settings and run them each "individually"!
41
+ - HIGHLY IMPROVED USABILITY!
data/README.textile ADDED
@@ -0,0 +1,226 @@
1
+ h1. Backup
2
+
3
+ h2. A Backup Ruby Gem for Rails
4
+
5
+ Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This gem offers a quick and easy way to configure and run backups of your
6
+ MySQL/PostgreSQL databases *(and practically even any other database you can dump through the command line)*. It can also make backups of your *archives* (any files or folders).
7
+ All backups can be transferred to either *"Amazon S3"* or "any remotely accessible server using the *SCP, SFTP or FTP* transfer methods".
8
+
9
+ *Backup handles: Compression, Archiving, Encryption and Backup Cleaning.*
10
+
11
+
12
+ h2. What's new in 2.2.0?
13
+
14
+ *(S)FTP*
15
+ FTP and SFTP Storage Methods have been added. This will allow you to transfer your backups
16
+ through a (S)FTP if you cannot make use of SCP.
17
+
18
+ *MySQL*
19
+ The following options have been added to the MySQL Adapter
20
+
21
+ * host
22
+ * socket
23
+ * port
24
+ * skip_tables
25
+
26
+ *PostgreSQL*
27
+ The PostgreSQL Adapter has been added! It has about the same options as the MySQL Adapter
28
+
29
+ * host/socket
30
+ * port
31
+ * skip_tables
32
+
33
+ If you are using PostgreSQL and the Adapter isn't working correctly, please notify me of this.
34
+ I personally never used PostgreSQL, so I don't really have any experience with it, but since there are people that do use it, I wanted to implement it.
35
+
36
+ *Custom*
37
+ This adapter will enable you, regardless of your database, to make SQL dumps. It's very simple.
38
+ *Simply put: If you don't use MySQL or PostgreSQL then you can use Custom to backup your database format, regardless.*
39
+ What the Custom Adapter does is it allows you to input one or more *commands* to execute (think of *mysqldump* or *pg_dump*, but for other databases).
40
+
41
+ *The benefit of doing this through Backup* is that you will still gain all the other features that it provides, such as Archiving, Compression, Encryption and Backup Cleaning, even though Backup doesn't officially support your specific database format! You can basically see the Custom adapter as any other adapter, except that you have to *write the sql dump command yourself*. And then Backup handles the rest!
42
+
43
+ *More info on the adapters:*
44
+
45
+ "http://wiki.github.com/meskyanichi/backup/configuration-file":http://wiki.github.com/meskyanichi/backup/configuration-file
46
+
47
+ *A few bug fixes*
48
+
49
+ * Issue where two backup settings would conflict if they were using the same Adapter at the same second! (which can happens when running cronjobs!)
50
+ * The temporary files will now be nicely name spaced by "trigger" so no conflict "can" occur
51
+ * When an exception is raised during the backup process, the temporary files will not be removed. This will be fixed as of 2.2.0 as well.
52
+ * And some other minor patches will be applied.
53
+
54
+ *Updated the Wiki based on this release.*
55
+
56
+ h3. Get Backup 2.2.x+ now!
57
+
58
+ bc. sudo gem install backup
59
+
60
+
61
+ h2. (Current) Backup's Capabilities
62
+
63
+ h3. Storage Methods
64
+
65
+ * Amazon (S3)
66
+ * Remote Server (SCP)
67
+ * Remote Server (SFTP)
68
+ * Remote Server (FTP)
69
+
70
+
71
+ h3. Adapters
72
+
73
+ * MySQL
74
+ * PostgreSQL
75
+ * Archive (any files or folders)
76
+ * Custom (any database format other than MySQL or PostgreSQL!)
77
+
78
+
79
+ h3. Archiving
80
+
81
+ *Backup supports Archiving.*
82
+ When you use the Archive adapter to backup a bunch of files and folders, backup will archive and compress these all together.
83
+ Archiving also happens when using the *Custom* adapter. If you issue a few commands using it, to dump maybe 1-3 databases, Backup will
84
+ handle the archiving, compression and encryption for you!
85
+
86
+ h3. Encryption
87
+
88
+ *Backup supports a simple form of encryption.*
89
+ All adapters support encryption. This is very simple to enable. Just add the following method inside of the backup settings
90
+ of which you wish to encrypt, and it will encrypt it with the specified password:
91
+
92
+ bc. encrypt_with_password "mypassword"
93
+
94
+
95
+ h3. Backup Cleaning
96
+
97
+ *Backup supports backup cleaning.*
98
+ Backup Cleaning enables you to specify the amount of backups that may be stored on either Amazon S3 or a Remote Server. If you for example tell backup to limit the amount of backups at 20, then when the 21st backup gets pushed to the storage location, the oldest version will automatically be destroyed.
99
+
100
+ The idea behind this is to not flood either your backup server, which might resort in possible lack of hard disk space. Another good reason to utilize this would be for Amazon. Although Amazon S3 is extremely cheap, when backing up 1-2GB of MySQL dumps twice a day, it can become quite expensive if you never remove old ones.
101
+
102
+ To enable this you simply call the following method inside the desired "backup setting":
103
+
104
+ bc. keep_backups 20
105
+
106
+
107
+ h3. Quick Example of a Single Backup Setting inside the Backup Configuration File
108
+
109
+ bc. backup 'mysql-backup-s3' do
110
+ adapter :mysql do
111
+ user 'user'
112
+ password 'password'
113
+ database 'database'
114
+ end
115
+ storage :s3 do
116
+ access_key_id 'access_key_id'
117
+ secret_access_key 'secret_access_key'
118
+ bucket '/bucket/backups/mysql/'
119
+ end
120
+ keep_backups 25
121
+ encrypt_with_password 'password'
122
+ end
123
+
124
+
125
+ The (backup 'mysql-backup-s3' do) is what I call a "backup setting". The first argument of the block is the so called "trigger".
126
+
127
+ bc. backup 'mysql-backup-s3' do
128
+ # Configuration Here
129
+ end
130
+
131
+ This acts as an "identifier" for the "backup setting". The (above) "backup setting" is all pretty straightforward.
132
+ So now that we've set up a "backup setting", we can run it using a rake task, like so:
133
+
134
+ bc. rake backup:run trigger="mysql-backup-s3"
135
+
136
+ *That's it, the MySQL database has been "backed up" to Amazon S3. It has been dumped, compressed and encrypted with password.*
137
+ Note: You can add as many "backup setting" blocks as you want inside the "config/backup.rb" configuration file and invoke each of them by their own "trigger". This means you can have as many backup setups as you want, which "don't" all run simultaneously when you initialize a backup.
138
+
139
+ *Runs the backup setting with the trigger "backup-logs"*
140
+
141
+ bc. rake backup:run trigger="backup-logs"
142
+
143
+ *Runs the backup setting with the trigger "backup-mysql"*
144
+
145
+ bc. rake backup:run trigger="backup-mysql"
146
+
147
+ *Runs the backup setting with the trigger "backup-assets"*
148
+
149
+ bc. rake backup:run trigger="backup-assets"
150
+
151
+ etc. etc. etc. etc. etc. etc...
152
+
153
+
154
+
155
+ h2. Interested in trying out Backup?
156
+
157
+ h3. Check out the following Wiki pages to get up and running:
158
+
159
+ h3. Getting started
160
+
161
+ "http://wiki.github.com/meskyanichi/backup/getting-started":http://wiki.github.com/meskyanichi/backup/getting-started
162
+
163
+
164
+ h3. Backup Configuration File (All Adapters, Storage Methods and Options)
165
+
166
+ "http://wiki.github.com/meskyanichi/backup/configuration-file":http://wiki.github.com/meskyanichi/backup/configuration-file
167
+
168
+
169
+ h3. Rake Tasks
170
+
171
+ "http://wiki.github.com/meskyanichi/backup/rake-tasks":http://wiki.github.com/meskyanichi/backup/rake-tasks
172
+
173
+
174
+ h3. Automatic Backups
175
+
176
+ "http://wiki.github.com/meskyanichi/backup/automatic-backups":http://wiki.github.com/meskyanichi/backup/automatic-backups
177
+
178
+
179
+ h3. Capistrano Recipes
180
+
181
+ "http://wiki.github.com/meskyanichi/backup/capistrano-recipes":http://wiki.github.com/meskyanichi/backup/capistrano-recipes
182
+
183
+
184
+ h3. Capistrano, Whenever!
185
+
186
+ "http://wiki.github.com/meskyanichi/backup/capistrano-whenever":http://wiki.github.com/meskyanichi/backup/capistrano-whenever
187
+
188
+
189
+ h3. Understanding "The Backup Database"
190
+
191
+ "http://wiki.github.com/meskyanichi/backup/the-backup-database":http://wiki.github.com/meskyanichi/backup/the-backup-database
192
+
193
+
194
+ h3. Trouble Shooting
195
+
196
+ "http://wiki.github.com/meskyanichi/backup/troubleshooting":http://wiki.github.com/meskyanichi/backup/troubleshooting
197
+
198
+
199
+ h3. Requirements
200
+
201
+ "http://wiki.github.com/meskyanichi/backup/requirements":http://wiki.github.com/meskyanichi/backup/requirements
202
+
203
+
204
+ h3. Resources
205
+
206
+ "http://wiki.github.com/meskyanichi/backup/resources":http://wiki.github.com/meskyanichi/backup/resources
207
+
208
+
209
+ h3. Requests
210
+
211
+ If anyone has any requests, please send me a message!
212
+
213
+
214
+ h3. Suggestions?
215
+
216
+ Send me a message! Fork the project!
217
+
218
+
219
+ h3. Found a Bug?
220
+
221
+ "http://github.com/meskyanichi/backup/issues":http://github.com/meskyanichi/backup/issues
222
+
223
+
224
+ h3. Copyright
225
+
226
+ Copyright (c) 2009 Michael van Rooijen | Final Creation. ("http://final-creation.com":http://final-creation.com) See LICENSE for details.
data/Rakefile CHANGED
@@ -7,19 +7,19 @@ begin
7
7
  gem.name = "backup"
8
8
  gem.summary = %Q{Backup is a gem/plugin that enables you to very easily create backups and transfer these to Amazon S3 or another server with SSH.}
9
9
  gem.description = %Q{
10
- Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This gem offers a quick and easy way
11
- to configure and run backups of your MySQL database (soon PostgreSQL and possibly more) and Archives (any files or folders)
12
- to "Amazon S3" or "any remotely accessible server using SCP". Backup handles: Compression, Archiving, Encryption and Backup Cleaning.
10
+ Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This gem offers a quick and easy way to configure and run backups of your
11
+ MySQL/PostgreSQL databases (and practically even any other database you can dump through the command line). It can also make backups of your archives (any files or folders).
12
+ All backups can be transferred to either "Amazon S3" or "any remotely accessible server using the SCP, SFTP or FTP transfer methods".
13
+ Backup handles: Compression, Archiving, Encryption and Backup Cleaning.
13
14
  }
14
15
 
15
16
  gem.email = "meskyan@gmail.com"
16
- gem.homepage = ""
17
+ gem.homepage = "http://final-creation.com/open-source"
17
18
  gem.authors = ["Michael van Rooijen"]
18
- gem.add_dependency "aws-s3", ">= 0.6.2"
19
- gem.add_dependency "net-ssh", ">= 2.0.15"
20
- gem.add_dependency "net-scp", ">= 1.0.2"
21
- # gem.files.include 'generators/**/*'
22
- # gem.files.include 'lib/**/*'
19
+ gem.add_dependency "aws-s3", ">= 0.6.2"
20
+ gem.add_dependency "net-ssh", ">= 2.0.15"
21
+ gem.add_dependency "net-scp", ">= 1.0.2"
22
+ gem.add_dependency "net-sftp", ">= 2.0.4"
23
23
  end
24
24
  rescue LoadError
25
25
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.0
data/backup.gemspec CHANGED
@@ -5,26 +5,28 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{backup}
8
- s.version = "2.1.2"
8
+ s.version = "2.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael van Rooijen"]
12
- s.date = %q{2009-12-01}
12
+ s.date = %q{2009-12-03}
13
13
  s.description = %q{
14
- Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This gem offers a quick and easy way
15
- to configure and run backups of your MySQL database (soon PostgreSQL and possibly more) and Archives (any files or folders)
16
- to "Amazon S3" or "any remotely accessible server using SCP". Backup handles: Compression, Archiving, Encryption and Backup Cleaning.
14
+ Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This gem offers a quick and easy way to configure and run backups of your
15
+ MySQL/PostgreSQL databases (and practically even any other database you can dump through the command line). It can also make backups of your archives (any files or folders).
16
+ All backups can be transferred to either "Amazon S3" or "any remotely accessible server using the SCP, SFTP or FTP transfer methods".
17
+ Backup handles: Compression, Archiving, Encryption and Backup Cleaning.
17
18
  }
18
19
  s.email = %q{meskyan@gmail.com}
19
20
  s.extra_rdoc_files = [
20
21
  "LICENSE",
21
- "README.rdoc"
22
+ "README.textile"
22
23
  ]
23
24
  s.files = [
24
25
  ".document",
25
26
  ".gitignore",
27
+ "CHANGELOG",
26
28
  "LICENSE",
27
- "README.rdoc",
29
+ "README.textile",
28
30
  "Rakefile",
29
31
  "VERSION",
30
32
  "backup.gemspec",
@@ -35,18 +37,25 @@ Gem::Specification.new do |s|
35
37
  "lib/backup.rb",
36
38
  "lib/backup/adapters/archive.rb",
37
39
  "lib/backup/adapters/base.rb",
40
+ "lib/backup/adapters/custom.rb",
38
41
  "lib/backup/adapters/mysql.rb",
42
+ "lib/backup/adapters/postgresql.rb",
39
43
  "lib/backup/configuration/adapter.rb",
44
+ "lib/backup/configuration/adapter_options.rb",
40
45
  "lib/backup/configuration/base.rb",
41
46
  "lib/backup/configuration/helpers.rb",
42
47
  "lib/backup/configuration/storage.rb",
43
48
  "lib/backup/connection/s3.rb",
49
+ "lib/backup/record/ftp.rb",
44
50
  "lib/backup/record/s3.rb",
45
51
  "lib/backup/record/scp.rb",
52
+ "lib/backup/record/sftp.rb",
53
+ "lib/backup/storage/ftp.rb",
46
54
  "lib/backup/storage/s3.rb",
47
- "lib/backup/storage/scp.rb"
55
+ "lib/backup/storage/scp.rb",
56
+ "lib/backup/storage/sftp.rb"
48
57
  ]
49
- s.homepage = %q{}
58
+ s.homepage = %q{http://final-creation.com/open-source}
50
59
  s.rdoc_options = ["--charset=UTF-8"]
51
60
  s.require_paths = ["lib"]
52
61
  s.rubygems_version = %q{1.3.5}
@@ -60,15 +69,18 @@ Gem::Specification.new do |s|
60
69
  s.add_runtime_dependency(%q<aws-s3>, [">= 0.6.2"])
61
70
  s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.15"])
62
71
  s.add_runtime_dependency(%q<net-scp>, [">= 1.0.2"])
72
+ s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.4"])
63
73
  else
64
74
  s.add_dependency(%q<aws-s3>, [">= 0.6.2"])
65
75
  s.add_dependency(%q<net-ssh>, [">= 2.0.15"])
66
76
  s.add_dependency(%q<net-scp>, [">= 1.0.2"])
77
+ s.add_dependency(%q<net-sftp>, [">= 2.0.4"])
67
78
  end
68
79
  else
69
80
  s.add_dependency(%q<aws-s3>, [">= 0.6.2"])
70
81
  s.add_dependency(%q<net-ssh>, [">= 2.0.15"])
71
82
  s.add_dependency(%q<net-scp>, [">= 1.0.2"])
83
+ s.add_dependency(%q<net-sftp>, [">= 2.0.4"])
72
84
  end
73
85
  end
74
86
 
@@ -1,18 +1,45 @@
1
1
 
2
2
  # Backup Configuration File
3
3
  #
4
- # Use the "backup" method to add another backup setting to the configuration file.
5
- # The argument before the "do" in (backup "argument" do) is called the "trigger".
4
+ # Use the "backup" block to add backup settings to the configuration file.
5
+ # The argument before the "do" in (backup "argument" do) is called a "trigger".
6
6
  # This acts as the identifier for the configuration.
7
7
  #
8
- # In the example below we have a "mysql-backup-s3" trigger for the configuration
9
- # inside that block. To initialize the backup process, you invoke it with the following rake task:
8
+ # In the example below we have a "mysql-backup-s3" trigger for the backup setting.
9
+ # All the configuration is done inside this block. To initialize the backup process for this block,
10
+ # you invoke it using the following rake task:
10
11
  #
11
12
  # rake backup:run trigger="mysql-backup-s3"
12
13
  #
13
14
  # You can add as many backup block settings as you want, just be sure every trigger is unique and you can run
14
15
  # each of them separately.
15
16
  #
17
+ # ADAPTERS
18
+ # - MySQL
19
+ # - PostgreSQL
20
+ # - Archive
21
+ # - Custom
22
+ #
23
+ # STORAGE METHODS
24
+ # - S3 (Amazon)
25
+ # - SCP (Remote Server)
26
+ # - FTP (Remote Server)
27
+ # - SFTP (Remote Server)
28
+ #
29
+ # GLOBAL OPTIONS
30
+ # - Keep Backups (keep_backups)
31
+ # - Encrypt With Pasword (encrypt_with_password)
32
+ #
33
+ # This is the "decrypt" command for all encrypted backups:
34
+ # openssl enc -des-cbc -d -in encrypted_file -out decrypted_file
35
+ #
36
+ # Each Backup Setting can contain:
37
+ # - 1 Adapter
38
+ # - 1 Storage Method
39
+ # - Multiple Global Options
40
+ #
41
+ # The combination of these, however, do not matter! So experiment with it.
42
+ #
16
43
  # For more information on "Backup", please refer to the wiki on github
17
44
  # http://wiki.github.com/meskyanichi/backup/configuration-file
18
45
 
@@ -22,9 +49,17 @@
22
49
  backup 'mysql-backup-s3' do
23
50
 
24
51
  adapter :mysql do
25
- user 'user'
26
- password 'password'
27
- database 'database'
52
+ user 'user'
53
+ password 'password'
54
+ database 'database'
55
+
56
+ # skip_tables ['table1', 'table2', 'table3']
57
+ #
58
+ # options do
59
+ # host '123.45.678.90'
60
+ # port '80'
61
+ # socket '/tmp/socket.sock'
62
+ # end
28
63
  end
29
64
 
30
65
  storage :s3 do
@@ -40,21 +75,76 @@ end
40
75
 
41
76
 
42
77
  # Initialize with:
43
- # rake backup:run trigger='mysql-backup-s3'
44
- backup 'archive-backup-scp' do
78
+ # rake backup:run trigger='postgresql-backup-s3'
79
+ backup 'postgresql-backup-scp' do
45
80
 
46
- adapter :archive do
47
- files ["#{RAILS_ROOT}/log", "#{RAILS_ROOT}/public/assets"]
81
+ adapter :postgresql do
82
+ user 'user'
83
+ database 'database'
84
+
85
+ # skip_tables ['table1', 'table2', 'table3']
86
+
87
+ # options do
88
+ # host '123.45.678.90'
89
+ # port '80'
90
+ # socket '/tmp/socket.sock'
91
+ # end
48
92
  end
49
93
 
50
94
  storage :scp do
51
95
  ip 'example.com'
52
96
  user 'user'
53
97
  password 'password'
54
- path '/var/backups/archive/'
98
+ path '/var/backups/postgresql/'
55
99
  end
56
100
 
57
101
  keep_backups :all
58
102
  encrypt_with_password false
59
103
 
60
104
  end
105
+
106
+
107
+ # Initialize with:
108
+ # rake backup:run trigger='archive-backup-ftp'
109
+ backup 'archive-backup-ftp' do
110
+
111
+ adapter :archive do
112
+ files ["#{RAILS_ROOT}/log", "#{RAILS_ROOT}/db"]
113
+ # files "#{RAILS_ROOT}/log"
114
+ end
115
+
116
+ storage :ftp do
117
+ ip 'example.com'
118
+ user 'user'
119
+ password 'password'
120
+ path '/var/backups/archive/'
121
+ end
122
+
123
+ keep_backups 10
124
+ encrypt_with_password false
125
+
126
+ end
127
+
128
+
129
+ # Initialize with:
130
+ # rake backup:run trigger='custom-backup-sftp'
131
+ backup 'custom-backup-sftp' do
132
+
133
+ adapter :custom do
134
+ commands \
135
+ [ "mysqldump [options] [database] > :tmp_path/my_mysql_dump.sql",
136
+ "pg_dump [options] [database] > :tmp_path/my_postgresql_dump.sql",
137
+ "any_other_db_format [options] [database] > :tmp_path/my_any_other_db_format.sql" ]
138
+ end
139
+
140
+ storage :sftp do
141
+ ip 'example.com'
142
+ user 'user'
143
+ password 'password'
144
+ path '/var/backups/custom/'
145
+ end
146
+
147
+ keep_backups :all
148
+ encrypt_with_password 'password'
149
+
150
+ end