netguru-safe 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +42 -0
- data/.document +5 -0
- data/.gitignore +11 -0
- data/CHANGELOG +25 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +20 -0
- data/README.markdown +237 -0
- data/Rakefile +32 -0
- data/TODO +11 -0
- data/VERSION +1 -0
- data/astrails-safe.gemspec +37 -0
- data/bin/astrails-safe +53 -0
- data/examples/example_helper.rb +19 -0
- data/lib/astrails/safe.rb +73 -0
- data/lib/astrails/safe/archive.rb +24 -0
- data/lib/astrails/safe/backup.rb +20 -0
- data/lib/astrails/safe/cloudfiles.rb +77 -0
- data/lib/astrails/safe/config/builder.rb +60 -0
- data/lib/astrails/safe/config/node.rb +76 -0
- data/lib/astrails/safe/gpg.rb +46 -0
- data/lib/astrails/safe/gzip.rb +25 -0
- data/lib/astrails/safe/local.rb +51 -0
- data/lib/astrails/safe/mongodump.rb +23 -0
- data/lib/astrails/safe/mysqldump.rb +32 -0
- data/lib/astrails/safe/pgdump.rb +36 -0
- data/lib/astrails/safe/pipe.rb +17 -0
- data/lib/astrails/safe/s3.rb +75 -0
- data/lib/astrails/safe/sftp.rb +88 -0
- data/lib/astrails/safe/sink.rb +35 -0
- data/lib/astrails/safe/source.rb +47 -0
- data/lib/astrails/safe/stream.rb +20 -0
- data/lib/astrails/safe/svndump.rb +13 -0
- data/lib/astrails/safe/tmp_file.rb +48 -0
- data/lib/astrails/safe/version.rb +5 -0
- data/lib/extensions/mktmpdir.rb +45 -0
- data/spec/integration/airbrake_integration_spec.rb +76 -0
- data/spec/integration/archive_integration_spec.rb +88 -0
- data/spec/integration/cleanup_spec.rb +61 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/unit/archive_spec.rb +67 -0
- data/spec/unit/cloudfiles_spec.rb +177 -0
- data/spec/unit/config_spec.rb +234 -0
- data/spec/unit/gpg_spec.rb +148 -0
- data/spec/unit/gzip_spec.rb +64 -0
- data/spec/unit/local_spec.rb +110 -0
- data/spec/unit/mongodump_spec.rb +54 -0
- data/spec/unit/mysqldump_spec.rb +83 -0
- data/spec/unit/pgdump_spec.rb +45 -0
- data/spec/unit/s3_spec.rb +163 -0
- data/spec/unit/svndump_spec.rb +39 -0
- data/templates/script.rb +160 -0
- metadata +222 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Astrails::Safe::Svndump do
|
4
|
+
def def_config
|
5
|
+
{
|
6
|
+
:options => "OPTS",
|
7
|
+
:repo_path => "bar/baz"
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
def svndump(id = :foo, config = def_config)
|
12
|
+
Astrails::Safe::Svndump.new(id, Astrails::Safe::Config::Node.new(nil, config))
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
stub(Time).now.stub!.strftime {"NOW"}
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:each) { Astrails::Safe::TmpFile.cleanup }
|
20
|
+
|
21
|
+
describe :backup do
|
22
|
+
before(:each) do
|
23
|
+
@svn = svndump
|
24
|
+
end
|
25
|
+
|
26
|
+
{
|
27
|
+
:id => "foo",
|
28
|
+
:kind => "svndump",
|
29
|
+
:extension => ".svn",
|
30
|
+
:filename => "svndump-foo.NOW",
|
31
|
+
:command => "svnadmin dump OPTS bar/baz",
|
32
|
+
}.each do |k, v|
|
33
|
+
it "should set #{k} to #{v}" do
|
34
|
+
@svn.backup.send(k).should == v
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/templates/script.rb
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
safe do
|
2
|
+
|
3
|
+
# backup file path (not including filename)
|
4
|
+
# supported substitutions:
|
5
|
+
# :kind -> backup 'engine' kind, e.g. "mysqldump" or "archive"
|
6
|
+
# :id -> backup 'id', e.g. "blog", "production", etc.
|
7
|
+
# :timestamp -> current run timestamp (same for all the backups in the same 'run')
|
8
|
+
# you can set separate :path for all backups (or once globally here)
|
9
|
+
local do
|
10
|
+
path "/backup/:kind"
|
11
|
+
end
|
12
|
+
|
13
|
+
## uncomment to enable uploads to Amazon S3
|
14
|
+
## Amazon S3 auth (optional)
|
15
|
+
# s3 do
|
16
|
+
# key YOUR_S3_KEY
|
17
|
+
# secret YOUR_S3_SECRET
|
18
|
+
# bucket S3_BUCKET
|
19
|
+
# # path for uploads to S3. supports same substitution like :local/:path
|
20
|
+
# path ":kind/" # this is default
|
21
|
+
# end
|
22
|
+
|
23
|
+
## alternative style:
|
24
|
+
# s3 :key => YOUR_S3_KEY, :secret => YOUR_S3_SECRET, :bucket => S3_BUCKET, :path => ":kind/"
|
25
|
+
|
26
|
+
## uncomment to enable uploads to Rackspace Cloud Files
|
27
|
+
## http://www.rackspacecloud.com/cloud_hosting_products/files
|
28
|
+
## Rackspace auth (optional)
|
29
|
+
# cloudfiles do
|
30
|
+
# user "YOUR_RACKSPACE_CLOUD_USERNAME"
|
31
|
+
# api_key "YOUR_RACKSPACE_API_KEY"
|
32
|
+
# container "YOUR_CONTAINER_NAME"
|
33
|
+
# # path for uploads to Cloud Files, supports same substitution like :local/:path
|
34
|
+
# path ":kind/" # this is default
|
35
|
+
# # If you are running the backup from a system within the Rackspace/Slicehost network and would like
|
36
|
+
# # to back up over the private (unbilled) service net, set this value to true.
|
37
|
+
# # service_net true
|
38
|
+
# end
|
39
|
+
|
40
|
+
## uncomment to enable uploads via SFTP
|
41
|
+
# sftp do
|
42
|
+
# host "YOUR_REMOTE_HOSTNAME"
|
43
|
+
# user "YOUR_REMOTE_USERNAME"
|
44
|
+
# # port "NON STANDARD SSH PORT"
|
45
|
+
# password "YOUR_REMOTE_PASSWORD"
|
46
|
+
# path ":kind/:id" # this is the default
|
47
|
+
# end
|
48
|
+
|
49
|
+
## uncomment to enable GPG encryption.
|
50
|
+
## Note: you can use public 'key' or symmetric password but not both!
|
51
|
+
# gpg do
|
52
|
+
# # you can specify your own gpg executable with the 'command' options
|
53
|
+
# # this can be useful for example to choose b/w gpg and gpg2 if both are installed
|
54
|
+
# # some gpg installations will automatically set 'use-agent' option in the
|
55
|
+
# # config file on the 1st run. see README for more details
|
56
|
+
# options "--no-use-agent"
|
57
|
+
# # command "/usr/local/bin/gpg"
|
58
|
+
# # key "backup@astrails.com"
|
59
|
+
# password "astrails"
|
60
|
+
# end
|
61
|
+
|
62
|
+
## uncomment to enable backup rotation. keep only given number of latest
|
63
|
+
## backups. remove the rest
|
64
|
+
# keep do
|
65
|
+
# local 4 # keep 4 local backups
|
66
|
+
# s3 20 # keep 20 S3 backups
|
67
|
+
# end
|
68
|
+
|
69
|
+
# backup mysql databases with mysqldump
|
70
|
+
mysqldump do
|
71
|
+
# you can override any setting from parent in a child:
|
72
|
+
options "-ceKq --single-transaction --create-options"
|
73
|
+
|
74
|
+
user "astrails"
|
75
|
+
password ""
|
76
|
+
# host "localhost"
|
77
|
+
# port 3306
|
78
|
+
socket "/var/run/mysqld/mysqld.sock"
|
79
|
+
|
80
|
+
# database is a 'collection' element. it must have a hash or block parameter
|
81
|
+
# it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
|
82
|
+
# the following code will create mysqldump/databases/blog and mysqldump/databases/mysql ocnfiguration 'nodes'
|
83
|
+
|
84
|
+
# backup database with default values
|
85
|
+
# database :blog
|
86
|
+
|
87
|
+
# backup overriding some values
|
88
|
+
# database :production do
|
89
|
+
# # you can override 'partially'
|
90
|
+
# keep :local => 3
|
91
|
+
# # keep/local is 3, and keep/s3 is 20 (from parent)
|
92
|
+
|
93
|
+
# # local override for gpg password
|
94
|
+
# gpg do
|
95
|
+
# password "custom-production-pass"
|
96
|
+
# end
|
97
|
+
# # skip those tables during backup
|
98
|
+
# # you can pass an array
|
99
|
+
# skip_tables [:logger_exceptions, :request_logs]
|
100
|
+
# # or pass them all separately
|
101
|
+
# skip_tables :test1
|
102
|
+
# skip_tables :test2
|
103
|
+
# end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
# # uncomment to enable
|
108
|
+
# # backup PostgreSQL databases with pg_dump
|
109
|
+
# pgdump do
|
110
|
+
# options "-i -x -O"
|
111
|
+
#
|
112
|
+
# user "markmansour"
|
113
|
+
# # password "" - leave this out if you have ident setup
|
114
|
+
#
|
115
|
+
# # database is a 'collection' element. it must have a hash or block parameter
|
116
|
+
# # it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
|
117
|
+
# database :blog
|
118
|
+
# database :production
|
119
|
+
# end
|
120
|
+
|
121
|
+
tar do
|
122
|
+
# options "-h" # uncomment this to dereference symbolic links
|
123
|
+
|
124
|
+
# 'archive' is a collection item, just like 'database'
|
125
|
+
# archive "git-repositories" do
|
126
|
+
# # files and directories to backup
|
127
|
+
# files "/home/git/repositories"
|
128
|
+
# # can have more then one 'files' lines or/and use an array
|
129
|
+
# files ["/home/dev/work/foo", "/home/dev/work/bar"]
|
130
|
+
# end
|
131
|
+
|
132
|
+
# archive "etc-files" do
|
133
|
+
# files "/etc"
|
134
|
+
# # exlude those files/directories
|
135
|
+
# exclude "/etc/puppet/other"
|
136
|
+
# # can have multiple 'exclude' lines or/and use an array
|
137
|
+
# exclude ["/etc/tmp/a", "/etc/tmp/b"]
|
138
|
+
# end
|
139
|
+
|
140
|
+
# archive "dot-configs" do
|
141
|
+
# files "/home/*/.[^.]*"
|
142
|
+
# end
|
143
|
+
|
144
|
+
# archive "blog" do
|
145
|
+
# files "/var/www/blog.astrails.com/"
|
146
|
+
# # specify multiple files/directories as array
|
147
|
+
# exclude ["/var/www/blog.astrails.com/log", "/var/www/blog.astrails.com/tmp"]
|
148
|
+
# end
|
149
|
+
|
150
|
+
# archive "site" do
|
151
|
+
# files "/var/www/astrails.com/"
|
152
|
+
# exclude ["/var/www/astrails.com/log", "/var/www/astrails.com/tmp"]
|
153
|
+
# end
|
154
|
+
|
155
|
+
# archive :misc do
|
156
|
+
# files [ "/backup/*.rb" ]
|
157
|
+
# end
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
metadata
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: netguru-safe
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.9
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Astrails Ltd.
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.3.2
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rr
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.0.4
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.4
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aws-sdk
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.2.3
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cloudfiles
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.4.7
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.7
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: net-sftp
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.0.4
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.0.4
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: toadhopper
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '2.0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.0'
|
110
|
+
description: ! 'Astrails-Safe is a simple tool to backup databases (MySQL and PostgreSQL),
|
111
|
+
Subversion repositories (with svndump) and just files.
|
112
|
+
|
113
|
+
Backups can be stored locally or remotely and can be enctypted.
|
114
|
+
|
115
|
+
Remote storage is supported on Amazon S3, Rackspace Cloud Files, or just plain SFTP.
|
116
|
+
|
117
|
+
'
|
118
|
+
email: we@astrails.com
|
119
|
+
executables:
|
120
|
+
- astrails-safe
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files:
|
123
|
+
- LICENSE
|
124
|
+
- README.markdown
|
125
|
+
- TODO
|
126
|
+
files:
|
127
|
+
- .autotest
|
128
|
+
- .document
|
129
|
+
- .gitignore
|
130
|
+
- CHANGELOG
|
131
|
+
- Gemfile
|
132
|
+
- Gemfile.lock
|
133
|
+
- LICENSE
|
134
|
+
- README.markdown
|
135
|
+
- Rakefile
|
136
|
+
- TODO
|
137
|
+
- VERSION
|
138
|
+
- astrails-safe.gemspec
|
139
|
+
- bin/astrails-safe
|
140
|
+
- examples/example_helper.rb
|
141
|
+
- lib/astrails/safe.rb
|
142
|
+
- lib/astrails/safe/archive.rb
|
143
|
+
- lib/astrails/safe/backup.rb
|
144
|
+
- lib/astrails/safe/cloudfiles.rb
|
145
|
+
- lib/astrails/safe/config/builder.rb
|
146
|
+
- lib/astrails/safe/config/node.rb
|
147
|
+
- lib/astrails/safe/gpg.rb
|
148
|
+
- lib/astrails/safe/gzip.rb
|
149
|
+
- lib/astrails/safe/local.rb
|
150
|
+
- lib/astrails/safe/mongodump.rb
|
151
|
+
- lib/astrails/safe/mysqldump.rb
|
152
|
+
- lib/astrails/safe/pgdump.rb
|
153
|
+
- lib/astrails/safe/pipe.rb
|
154
|
+
- lib/astrails/safe/s3.rb
|
155
|
+
- lib/astrails/safe/sftp.rb
|
156
|
+
- lib/astrails/safe/sink.rb
|
157
|
+
- lib/astrails/safe/source.rb
|
158
|
+
- lib/astrails/safe/stream.rb
|
159
|
+
- lib/astrails/safe/svndump.rb
|
160
|
+
- lib/astrails/safe/tmp_file.rb
|
161
|
+
- lib/astrails/safe/version.rb
|
162
|
+
- lib/extensions/mktmpdir.rb
|
163
|
+
- spec/integration/airbrake_integration_spec.rb
|
164
|
+
- spec/integration/archive_integration_spec.rb
|
165
|
+
- spec/integration/cleanup_spec.rb
|
166
|
+
- spec/spec.opts
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
- spec/unit/archive_spec.rb
|
169
|
+
- spec/unit/cloudfiles_spec.rb
|
170
|
+
- spec/unit/config_spec.rb
|
171
|
+
- spec/unit/gpg_spec.rb
|
172
|
+
- spec/unit/gzip_spec.rb
|
173
|
+
- spec/unit/local_spec.rb
|
174
|
+
- spec/unit/mongodump_spec.rb
|
175
|
+
- spec/unit/mysqldump_spec.rb
|
176
|
+
- spec/unit/pgdump_spec.rb
|
177
|
+
- spec/unit/s3_spec.rb
|
178
|
+
- spec/unit/svndump_spec.rb
|
179
|
+
- templates/script.rb
|
180
|
+
homepage: http://blog.astrails.com/astrails-safe
|
181
|
+
licenses: []
|
182
|
+
post_install_message:
|
183
|
+
rdoc_options: []
|
184
|
+
require_paths:
|
185
|
+
- lib
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
188
|
+
requirements:
|
189
|
+
- - ! '>='
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - '='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 1.5.0
|
198
|
+
requirements: []
|
199
|
+
rubyforge_project:
|
200
|
+
rubygems_version: 1.8.23
|
201
|
+
signing_key:
|
202
|
+
specification_version: 3
|
203
|
+
summary: Backup filesystem and databases (MySQL and PostgreSQL) locally or to a remote
|
204
|
+
server/service (with encryption)
|
205
|
+
test_files:
|
206
|
+
- spec/integration/airbrake_integration_spec.rb
|
207
|
+
- spec/integration/archive_integration_spec.rb
|
208
|
+
- spec/integration/cleanup_spec.rb
|
209
|
+
- spec/spec.opts
|
210
|
+
- spec/spec_helper.rb
|
211
|
+
- spec/unit/archive_spec.rb
|
212
|
+
- spec/unit/cloudfiles_spec.rb
|
213
|
+
- spec/unit/config_spec.rb
|
214
|
+
- spec/unit/gpg_spec.rb
|
215
|
+
- spec/unit/gzip_spec.rb
|
216
|
+
- spec/unit/local_spec.rb
|
217
|
+
- spec/unit/mongodump_spec.rb
|
218
|
+
- spec/unit/mysqldump_spec.rb
|
219
|
+
- spec/unit/pgdump_spec.rb
|
220
|
+
- spec/unit/s3_spec.rb
|
221
|
+
- spec/unit/svndump_spec.rb
|
222
|
+
has_rdoc:
|