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.
Files changed (168) hide show
  1. data/.gitignore +2 -0
  2. data/.infinity_test +7 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +88 -0
  6. data/LICENSE.md +24 -0
  7. data/README.md +189 -75
  8. data/backup.gemspec +41 -0
  9. data/bin/backup +161 -90
  10. data/lib/backup.rb +133 -117
  11. data/lib/backup/archive.rb +54 -0
  12. data/lib/backup/cli.rb +50 -0
  13. data/lib/backup/compressor/base.rb +17 -0
  14. data/lib/backup/compressor/gzip.rb +61 -0
  15. data/lib/backup/configuration/base.rb +7 -67
  16. data/lib/backup/configuration/compressor/base.rb +10 -0
  17. data/lib/backup/configuration/compressor/gzip.rb +23 -0
  18. data/lib/backup/configuration/database/base.rb +18 -0
  19. data/lib/backup/configuration/database/mongodb.rb +37 -0
  20. data/lib/backup/configuration/database/mysql.rb +37 -0
  21. data/lib/backup/configuration/database/postgresql.rb +37 -0
  22. data/lib/backup/configuration/database/redis.rb +35 -0
  23. data/lib/backup/configuration/encryptor/base.rb +10 -0
  24. data/lib/backup/configuration/encryptor/gpg.rb +17 -0
  25. data/lib/backup/configuration/encryptor/open_ssl.rb +26 -0
  26. data/lib/backup/configuration/helpers.rb +47 -17
  27. data/lib/backup/configuration/notifier/base.rb +39 -0
  28. data/lib/backup/configuration/notifier/mail.rb +52 -0
  29. data/lib/backup/configuration/storage/base.rb +18 -0
  30. data/lib/backup/configuration/storage/cloudfiles.rb +21 -0
  31. data/lib/backup/configuration/storage/dropbox.rb +25 -0
  32. data/lib/backup/configuration/storage/ftp.rb +25 -0
  33. data/lib/backup/configuration/storage/rsync.rb +25 -0
  34. data/lib/backup/configuration/storage/s3.rb +25 -0
  35. data/lib/backup/configuration/storage/scp.rb +25 -0
  36. data/lib/backup/configuration/storage/sftp.rb +25 -0
  37. data/lib/backup/database/base.rb +33 -0
  38. data/lib/backup/database/mongodb.rb +137 -0
  39. data/lib/backup/database/mysql.rb +104 -0
  40. data/lib/backup/database/postgresql.rb +111 -0
  41. data/lib/backup/database/redis.rb +105 -0
  42. data/lib/backup/encryptor/base.rb +17 -0
  43. data/lib/backup/encryptor/gpg.rb +78 -0
  44. data/lib/backup/encryptor/open_ssl.rb +67 -0
  45. data/lib/backup/finder.rb +39 -0
  46. data/lib/backup/logger.rb +80 -0
  47. data/lib/backup/model.rb +249 -0
  48. data/lib/backup/notifier/base.rb +29 -0
  49. data/lib/backup/notifier/binder.rb +32 -0
  50. data/lib/backup/notifier/mail.rb +141 -0
  51. data/lib/backup/notifier/templates/notify_failure.erb +31 -0
  52. data/lib/backup/notifier/templates/notify_success.erb +16 -0
  53. data/lib/backup/storage/base.rb +60 -3
  54. data/lib/backup/storage/cloudfiles.rb +85 -6
  55. data/lib/backup/storage/dropbox.rb +74 -4
  56. data/lib/backup/storage/ftp.rb +103 -27
  57. data/lib/backup/storage/object.rb +45 -0
  58. data/lib/backup/storage/rsync.rb +100 -0
  59. data/lib/backup/storage/s3.rb +100 -7
  60. data/lib/backup/storage/scp.rb +94 -19
  61. data/lib/backup/storage/sftp.rb +94 -19
  62. data/lib/backup/version.rb +70 -1
  63. data/lib/templates/archive +4 -0
  64. data/lib/templates/compressor/gzip +4 -0
  65. data/lib/templates/database/mongodb +10 -0
  66. data/lib/templates/database/mysql +11 -0
  67. data/lib/templates/database/postgresql +11 -0
  68. data/lib/templates/database/redis +10 -0
  69. data/lib/templates/encryptor/gpg +9 -0
  70. data/lib/templates/encryptor/openssl +5 -0
  71. data/lib/templates/notifier/mail +14 -0
  72. data/lib/templates/readme +15 -0
  73. data/lib/templates/storage/cloudfiles +7 -0
  74. data/lib/templates/storage/dropbox +8 -0
  75. data/lib/templates/storage/ftp +8 -0
  76. data/lib/templates/storage/rsync +7 -0
  77. data/lib/templates/storage/s3 +8 -0
  78. data/lib/templates/storage/scp +8 -0
  79. data/lib/templates/storage/sftp +8 -0
  80. data/spec/archive_spec.rb +53 -0
  81. data/spec/backup_spec.rb +11 -0
  82. data/spec/compressor/gzip_spec.rb +59 -0
  83. data/spec/configuration/base_spec.rb +35 -0
  84. data/spec/configuration/compressor/gzip_spec.rb +28 -0
  85. data/spec/configuration/database/base_spec.rb +16 -0
  86. data/spec/configuration/database/mongodb_spec.rb +30 -0
  87. data/spec/configuration/database/mysql_spec.rb +32 -0
  88. data/spec/configuration/database/postgresql_spec.rb +32 -0
  89. data/spec/configuration/database/redis_spec.rb +30 -0
  90. data/spec/configuration/encryptor/gpg_spec.rb +25 -0
  91. data/spec/configuration/encryptor/open_ssl_spec.rb +31 -0
  92. data/spec/configuration/notifier/mail_spec.rb +32 -0
  93. data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
  94. data/spec/configuration/storage/dropbox_spec.rb +40 -0
  95. data/spec/configuration/storage/ftp_spec.rb +40 -0
  96. data/spec/configuration/storage/rsync_spec.rb +37 -0
  97. data/spec/configuration/storage/s3_spec.rb +37 -0
  98. data/spec/configuration/storage/scp_spec.rb +40 -0
  99. data/spec/configuration/storage/sftp_spec.rb +40 -0
  100. data/spec/database/base_spec.rb +30 -0
  101. data/spec/database/mongodb_spec.rb +144 -0
  102. data/spec/database/mysql_spec.rb +150 -0
  103. data/spec/database/postgresql_spec.rb +164 -0
  104. data/spec/database/redis_spec.rb +122 -0
  105. data/spec/encryptor/gpg_spec.rb +57 -0
  106. data/spec/encryptor/open_ssl_spec.rb +102 -0
  107. data/spec/logger_spec.rb +37 -0
  108. data/spec/model_spec.rb +236 -0
  109. data/spec/notifier/mail_spec.rb +97 -0
  110. data/spec/spec_helper.rb +21 -0
  111. data/spec/storage/base_spec.rb +33 -0
  112. data/spec/storage/cloudfiles_spec.rb +102 -0
  113. data/spec/storage/dropbox_spec.rb +89 -0
  114. data/spec/storage/ftp_spec.rb +133 -0
  115. data/spec/storage/object_spec.rb +74 -0
  116. data/spec/storage/rsync_spec.rb +115 -0
  117. data/spec/storage/s3_spec.rb +110 -0
  118. data/spec/storage/scp_spec.rb +129 -0
  119. data/spec/storage/sftp_spec.rb +125 -0
  120. data/spec/version_spec.rb +32 -0
  121. metadata +139 -123
  122. data/CHANGELOG +0 -131
  123. data/LICENSE +0 -20
  124. data/generators/backup/backup_generator.rb +0 -69
  125. data/generators/backup/templates/backup.rake +0 -56
  126. data/generators/backup/templates/backup.rb +0 -253
  127. data/generators/backup/templates/create_backup_tables.rb +0 -18
  128. data/generators/backup_update/backup_update_generator.rb +0 -50
  129. data/generators/backup_update/templates/migrations/update_backup_tables.rb +0 -27
  130. data/lib/backup/adapters/archive.rb +0 -34
  131. data/lib/backup/adapters/base.rb +0 -167
  132. data/lib/backup/adapters/custom.rb +0 -41
  133. data/lib/backup/adapters/mongo_db.rb +0 -139
  134. data/lib/backup/adapters/mysql.rb +0 -60
  135. data/lib/backup/adapters/postgresql.rb +0 -60
  136. data/lib/backup/adapters/sqlite.rb +0 -25
  137. data/lib/backup/command_helper.rb +0 -14
  138. data/lib/backup/configuration/adapter.rb +0 -21
  139. data/lib/backup/configuration/adapter_options.rb +0 -8
  140. data/lib/backup/configuration/attributes.rb +0 -19
  141. data/lib/backup/configuration/mail.rb +0 -20
  142. data/lib/backup/configuration/smtp.rb +0 -8
  143. data/lib/backup/configuration/storage.rb +0 -8
  144. data/lib/backup/connection/cloudfiles.rb +0 -75
  145. data/lib/backup/connection/dropbox.rb +0 -63
  146. data/lib/backup/connection/s3.rb +0 -88
  147. data/lib/backup/core_ext/object.rb +0 -5
  148. data/lib/backup/environment/base.rb +0 -12
  149. data/lib/backup/environment/rails_configuration.rb +0 -15
  150. data/lib/backup/environment/unix_configuration.rb +0 -109
  151. data/lib/backup/mail/base.rb +0 -97
  152. data/lib/backup/mail/mail.txt +0 -7
  153. data/lib/backup/record/base.rb +0 -65
  154. data/lib/backup/record/cloudfiles.rb +0 -28
  155. data/lib/backup/record/dropbox.rb +0 -27
  156. data/lib/backup/record/ftp.rb +0 -39
  157. data/lib/backup/record/local.rb +0 -26
  158. data/lib/backup/record/s3.rb +0 -25
  159. data/lib/backup/record/scp.rb +0 -33
  160. data/lib/backup/record/sftp.rb +0 -38
  161. data/lib/backup/storage/local.rb +0 -22
  162. data/lib/generators/backup/USAGE +0 -10
  163. data/lib/generators/backup/backup_generator.rb +0 -47
  164. data/lib/generators/backup/templates/backup.rake +0 -56
  165. data/lib/generators/backup/templates/backup.rb +0 -236
  166. data/lib/generators/backup/templates/create_backup_tables.rb +0 -18
  167. data/setup/backup.rb +0 -257
  168. data/setup/backup.sqlite3 +0 -0
@@ -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,257 +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 command:
10
- #
11
- # backup --run 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
- # sudo backup --run 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
-
110
- # Initialize with:
111
- # sudo backup --run mysql-backup-cloudfiles
112
- backup 'mysql-backup-cloudfiles' do
113
-
114
- adapter :mysql do
115
- user 'user'
116
- password 'password'
117
- database 'database'
118
- end
119
-
120
- storage :cloudfiles do
121
- username 'username'
122
- api_key 'api_key'
123
- container 'mysql_backup'
124
- end
125
-
126
- encrypt_with_gpg_public_key <<-KEY
127
- -----BEGIN PGP PUBLIC KEY BLOCK-----
128
- Version: GnuPG v1.4.7 (Darwin)
129
-
130
- Your very long public key goes here
131
- -----END PGP PUBLIC KEY BLOCK-----
132
- KEY
133
-
134
- end
135
-
136
-
137
- # Initialize with:
138
- # sudo backup --run postgresql-backup-s3
139
- backup 'postgresql-backup-scp' do
140
-
141
- adapter :postgresql do
142
- user 'user'
143
- database 'database'
144
-
145
- # su_as_user 'user'
146
-
147
- # skip_tables ['table1', 'table2', 'table3']
148
-
149
- # options do
150
- # host '123.45.678.90'
151
- # port '80'
152
- # socket '/tmp/socket.sock'
153
- # end
154
- # additional_options '--clean --blobs'
155
- end
156
-
157
- storage :scp do
158
- ip 'example.com'
159
- user 'user'
160
- password 'password'
161
- path '/var/backups/postgresql/'
162
- end
163
-
164
- keep_backups :all
165
- encrypt_with_password false
166
- notify false
167
-
168
- end
169
-
170
-
171
- # Initialize with:
172
- # sudo backup --run archive-backup-ftp
173
- backup 'archive-backup-ftp' do
174
-
175
- adapter :archive do
176
- files ["/path/to/log", "/path/to/db"]
177
- end
178
-
179
- storage :ftp do
180
- ip 'example.com'
181
- user 'user'
182
- password 'password'
183
- path '/var/backups/archive/'
184
- end
185
-
186
- keep_backups 10
187
- encrypt_with_password false
188
- notify false
189
-
190
- end
191
-
192
-
193
- # Initialize with:
194
- # sudo backup --run custom-backup-sftp
195
- backup 'custom-backup-sftp' do
196
-
197
- adapter :custom do
198
- commands \
199
- [ "mysqldump [options] [database] > :tmp_path/my_mysql_dump.sql",
200
- "pg_dump [options] [database] > :tmp_path/my_postgresql_dump.sql",
201
- "any_other_db_format [options] [database] > :tmp_path/my_any_other_db_format.sql" ]
202
- end
203
-
204
- storage :sftp do
205
- ip 'example.com'
206
- user 'user'
207
- password 'password'
208
- path '/var/backups/custom/'
209
- end
210
-
211
- keep_backups :all
212
- encrypt_with_password 'password'
213
- notify false
214
-
215
- end
216
-
217
-
218
- # Initializ with:
219
- # sudo backup --run sqlite-backup-local
220
- backup 'sqlite-backup-local' do
221
-
222
- adapter :sqlite do
223
- database "/path/to/database.sqlite3"
224
- end
225
-
226
- storage :local do
227
- path "/path/to/storage/location/"
228
- end
229
-
230
- keep_backups :all
231
- encrypt_with_password false
232
- notify false
233
-
234
- end
235
-
236
-
237
- # Initialize with
238
- # sudo backup --run postgresql-backup-dropbox
239
- backup 'postgresql-backup-dropbox' do
240
-
241
- adapter :postgresql do
242
- user 'devmen'
243
- database 'domowoi_test'
244
- end
245
-
246
- storage :dropbox do
247
- api_key 'your_api_key'
248
- secret_access_key 'your_api_secret'
249
- username 'user@example.org'
250
- password 'super_s3cret'
251
- path 'backups'
252
- end
253
-
254
- keep_backups :all
255
- encrypt_with_password false
256
- notify false
257
- end
Binary file