ey_cloud_server 1.4.28 → 1.4.29
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 +10 -0
- data/.rvmrc +1 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +124 -0
- data/LICENSE +20 -0
- data/README.rdoc +46 -0
- data/Rakefile +19 -0
- data/TODO +4 -0
- data/ey_cloud_server.gemspec +25 -0
- data/features/downloading_a_mysql_backup.feature +12 -0
- data/features/making_a_postgresql_backup.feature +12 -0
- data/features/restoring_postgres_backup.feature +12 -0
- data/features/step_definitions/backups.rb +61 -0
- data/features/step_definitions/commands.rb +9 -0
- data/features/step_definitions/mysql.rb +4 -0
- data/features/step_definitions/postgresql.rb +15 -0
- data/features/support/env.rb +24 -0
- data/lib/ey-flex/big-brother.rb +2 -2
- data/lib/ey-flex.rb +0 -3
- data/lib/ey_backup/cli.rb +1 -1
- data/lib/ey_backup/engines/postgresql_engine.rb +2 -2
- data/lib/ey_backup.rb +0 -1
- data/lib/ey_cloud_server/version.rb +4 -2
- data/script/ci +31 -0
- data/spec/config-example.yml +0 -3
- data/spec/ey_backup/postgres_backups_spec.rb +1 -1
- data/spec/helpers.rb +7 -52
- data/spec/spec_helper.rb +3 -3
- data/tmp/.gitignore +0 -0
- metadata +71 -256
- data/lib/ey-flex/ec2.rb +0 -17
- data/lib/ey_backup/engines/mongodb_engine.rb +0 -64
- data/spec/ey_backup/mongo_backups_spec.rb +0 -106
data/spec/helpers.rb
CHANGED
@@ -100,50 +100,25 @@ module Helpers
|
|
100
100
|
|
101
101
|
def drop_postgresql_database(db_key)
|
102
102
|
db_name = created_postgresql_dbs[db_key]
|
103
|
-
|
104
|
-
command=%Q{ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/#{postgresql_user}/.ssh/internal root@#{postgresql_host} "dropdb -U postgres -h localhost #{db_name}"}
|
103
|
+
command = %Q{ PGPASSWORD='#{postgresql_password}' dropdb -U #{postgresql_user} -h #{postgresql_host} #{db_name} }
|
105
104
|
system(command)
|
106
105
|
end
|
107
106
|
|
108
107
|
def check_postgresql_database(db_name)
|
109
|
-
command
|
108
|
+
command = %Q{ PGPASSWORD='#{postgresql_password}' psql -l -U #{postgresql_user} -h #{postgresql_host} | grep '#{db_name}' }
|
110
109
|
system(command) || raise("Could not find db: #{db_name} with command:\n #{command}")
|
111
110
|
db_name
|
112
111
|
end
|
113
112
|
|
114
113
|
def create_postgresql_database(db_key, region = 'us-east-1')
|
115
|
-
db_name = generate_database_name('
|
114
|
+
db_name = generate_database_name('postgresql')
|
116
115
|
created_postgresql_dbs[db_key] = db_name
|
117
116
|
drop_postgresql_database(db_key)
|
118
|
-
|
119
|
-
# system("PGPASSWORD='#{postgresql_password}' createdb -U #{postgresql_user} -h #{postgresql_host} #{db_name}") || raise("Could not create db: #{db_name}")
|
120
|
-
command=%Q{ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/#{postgresql_user}/.ssh/internal root@#{postgresql_host} "createdb -U postgres -h localhost -O #{postgresql_user} #{db_name}"}
|
117
|
+
command = %Q{ PGPASSWORD='#{postgresql_password}' createdb -U #{postgresql_user} -h #{postgresql_host} #{db_name} }
|
121
118
|
system(command) || raise("Could not create db: #{db_name} with command:\n #{command}")
|
122
119
|
write_database_config('postgresql', postgresql_user, postgresql_password, postgresql_host, created_postgresql_dbs.values, region)
|
123
120
|
db_name
|
124
121
|
end
|
125
|
-
|
126
|
-
def drop_mongodb_database(db_key)
|
127
|
-
db_name = created_mongodb_dbs[db_key]
|
128
|
-
command=%Q{ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/#{mongodb_user}/.ssh/internal root@#{mongodb_host} "mongo --host localhost #{db_name} --quiet --eval 'printjson(db.dropDatabase());'"}
|
129
|
-
system(command)
|
130
|
-
end
|
131
|
-
|
132
|
-
def check_mongodb_database(db_name)
|
133
|
-
command=%Q{ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/#{mongodb_user}/.ssh/internal root@#{mongodb_host} "mongo --host localhost --quiet --eval "for each(var db in db.runCommand('listDatabases').databases) if(db.sizeOnDisk > 1) print(db.name);" admin | grep '#{db_name}'"}
|
134
|
-
system(command) || raise("Could not find db: #{db_name} with command:\n #{command}")
|
135
|
-
db_name
|
136
|
-
end
|
137
|
-
|
138
|
-
def create_mongodb_database(db_key, region = 'us-east-1')
|
139
|
-
db_name = generate_database_name('test')
|
140
|
-
drop_mongodb_database(db_key)
|
141
|
-
command=%Q{ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/#{mongodb_user}/.ssh/internal root@#{mongodb_host} "mongo --host localhost #{db_name} --quiet --eval 'db.foo.save({ name : "derp"});'"}
|
142
|
-
system(command) || raise("Could not create db: #{db_name} with command:\n #{command}")
|
143
|
-
write_database_config('mongodb', mongodb_user, mongodb_password, mongodb_host, created_mongodb_dbs.values, region)
|
144
|
-
db_name
|
145
|
-
end
|
146
|
-
|
147
122
|
|
148
123
|
def write_database_config(type, root_user, root_password, host, databases, region)
|
149
124
|
@database_config = {
|
@@ -170,7 +145,7 @@ module Helpers
|
|
170
145
|
end
|
171
146
|
|
172
147
|
def run_sql(command, database)
|
173
|
-
system("
|
148
|
+
system("mysql -u#{mysql_user} -h#{mysql_host} #{mysql_password_option} -D#{database} -e '#{command}'")
|
174
149
|
end
|
175
150
|
|
176
151
|
def run_sql_pipe(io, database)
|
@@ -189,10 +164,6 @@ module Helpers
|
|
189
164
|
system("PGPASSWORD='#{postgresql_password}' psql -c '#{command}' -h #{postgresql_host} -U #{postgresql_user} #{database}")
|
190
165
|
end
|
191
166
|
|
192
|
-
def run_mongocmd(command, database)
|
193
|
-
system("mongo #{database} --quiet --eval \"#{command}\" --quiet")
|
194
|
-
end
|
195
|
-
|
196
167
|
def tmp_dir
|
197
168
|
if spec_config['tmp_dir'].blank?
|
198
169
|
File.dirname(__FILE__) + "/tmp/"
|
@@ -209,10 +180,6 @@ module Helpers
|
|
209
180
|
spec_config['postgresql_user'] || raise("No postgresql user provided")
|
210
181
|
end
|
211
182
|
|
212
|
-
def mongodb_user
|
213
|
-
spec_config['mongodb_user'] || raise("No mongodb user provided")
|
214
|
-
end
|
215
|
-
|
216
183
|
def mysql_password
|
217
184
|
spec_config['mysql_password']
|
218
185
|
end
|
@@ -221,20 +188,12 @@ module Helpers
|
|
221
188
|
spec_config['postgresql_password']
|
222
189
|
end
|
223
190
|
|
224
|
-
def mongodb_password #<- is this really needed? Supported mongo will run in trusted mode
|
225
|
-
spec_config['mongodb_password']
|
226
|
-
end
|
227
|
-
|
228
191
|
def mysql_host
|
229
|
-
spec_config['mysql_host']
|
192
|
+
spec_config['mysql_host'] || 'localhost'
|
230
193
|
end
|
231
194
|
|
232
195
|
def postgresql_host
|
233
|
-
spec_config['postgresql_host']
|
234
|
-
end
|
235
|
-
|
236
|
-
def mongodb_host
|
237
|
-
spec_config['mongodb_host']
|
196
|
+
spec_config['postgresql_host'] || 'localhost'
|
238
197
|
end
|
239
198
|
|
240
199
|
def created_mysql_dbs
|
@@ -245,10 +204,6 @@ module Helpers
|
|
245
204
|
@created_postgresql_dbs ||= {}
|
246
205
|
end
|
247
206
|
|
248
|
-
def created_mongodb_dbs
|
249
|
-
@created_mongodb_dbs ||= {}
|
250
|
-
end
|
251
|
-
|
252
207
|
def spec_config
|
253
208
|
Helpers.spec_config
|
254
209
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,8 +7,8 @@ require 'randexp'
|
|
7
7
|
require 'fog'
|
8
8
|
|
9
9
|
# Made tests work with actual storage; better tests. - rpowell Fri Aug 5 17:53:17 PDT 2011
|
10
|
-
#
|
11
|
-
|
10
|
+
#
|
11
|
+
Fog.mock!
|
12
12
|
|
13
13
|
require File.dirname(__FILE__) + '/fakefs_hax'
|
14
14
|
require File.dirname(__FILE__) + '/helpers'
|
@@ -18,7 +18,7 @@ Helpers.load_spec_config
|
|
18
18
|
FakeWeb.allow_net_connect = false # if it's not here, it doesn't exist
|
19
19
|
Randexp::Dictionary.words
|
20
20
|
|
21
|
-
|
21
|
+
RSpec.configure do |config|
|
22
22
|
config.include(Helpers)
|
23
23
|
|
24
24
|
config.before(:each) do
|
data/tmp/.gitignore
ADDED
File without changes
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_cloud_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 29
|
10
|
+
version: 1.4.29
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
-
|
13
|
+
- EngineYard
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -23,124 +23,52 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 7
|
29
29
|
segments:
|
30
|
-
-
|
31
|
-
|
30
|
+
- 1
|
31
|
+
- 6
|
32
|
+
- 4
|
33
|
+
version: 1.6.4
|
32
34
|
type: :runtime
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
37
|
+
name: open4
|
36
38
|
prerelease: false
|
37
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
40
|
none: false
|
39
41
|
requirements:
|
40
|
-
- -
|
42
|
+
- - ~>
|
41
43
|
- !ruby/object:Gem::Version
|
42
|
-
hash:
|
44
|
+
hash: 27
|
43
45
|
segments:
|
44
46
|
- 1
|
45
|
-
-
|
46
|
-
-
|
47
|
-
version: 1.
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
version: 1.3.0
|
48
50
|
type: :runtime
|
49
51
|
version_requirements: *id002
|
50
52
|
- !ruby/object:Gem::Dependency
|
51
|
-
name:
|
53
|
+
name: fog
|
52
54
|
prerelease: false
|
53
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
56
|
none: false
|
55
57
|
requirements:
|
56
|
-
- -
|
58
|
+
- - ~>
|
57
59
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
60
|
+
hash: 23
|
59
61
|
segments:
|
62
|
+
- 1
|
63
|
+
- 1
|
60
64
|
- 2
|
61
|
-
|
62
|
-
- 0
|
63
|
-
version: 2.0.0
|
65
|
+
version: 1.1.2
|
64
66
|
type: :runtime
|
65
67
|
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: open4
|
68
|
-
prerelease: false
|
69
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
72
|
-
- - "="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 55
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
- 9
|
78
|
-
- 6
|
79
|
-
version: 0.9.6
|
80
|
-
type: :runtime
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: aws-s3
|
84
|
-
prerelease: false
|
85
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
94
|
-
type: :runtime
|
95
|
-
version_requirements: *id005
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: fog
|
98
|
-
prerelease: false
|
99
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
|
-
requirements:
|
102
|
-
- - "="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
hash: 7
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
- 7
|
108
|
-
- 2
|
109
|
-
version: 0.7.2
|
110
|
-
type: :runtime
|
111
|
-
version_requirements: *id006
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: rest-client
|
114
|
-
prerelease: false
|
115
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
|
-
requirements:
|
118
|
-
- - ">="
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
hash: 3
|
121
|
-
segments:
|
122
|
-
- 0
|
123
|
-
version: "0"
|
124
|
-
type: :runtime
|
125
|
-
version_requirements: *id007
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: mysql
|
128
|
-
prerelease: false
|
129
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
|
-
requirements:
|
132
|
-
- - ">="
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
hash: 3
|
135
|
-
segments:
|
136
|
-
- 0
|
137
|
-
version: "0"
|
138
|
-
type: :runtime
|
139
|
-
version_requirements: *id008
|
140
68
|
- !ruby/object:Gem::Dependency
|
141
69
|
name: ey_enzyme
|
142
70
|
prerelease: false
|
143
|
-
requirement: &
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
144
72
|
none: false
|
145
73
|
requirements:
|
146
74
|
- - ">="
|
@@ -150,162 +78,26 @@ dependencies:
|
|
150
78
|
- 0
|
151
79
|
version: "0"
|
152
80
|
type: :runtime
|
153
|
-
version_requirements: *
|
81
|
+
version_requirements: *id004
|
154
82
|
- !ruby/object:Gem::Dependency
|
155
83
|
name: ey_instance_api_client
|
156
84
|
prerelease: false
|
157
|
-
requirement: &
|
158
|
-
none: false
|
159
|
-
requirements:
|
160
|
-
- - "="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
hash: 25
|
163
|
-
segments:
|
164
|
-
- 0
|
165
|
-
- 1
|
166
|
-
- 1
|
167
|
-
version: 0.1.1
|
168
|
-
type: :runtime
|
169
|
-
version_requirements: *id010
|
170
|
-
- !ruby/object:Gem::Dependency
|
171
|
-
name: rspec
|
172
|
-
prerelease: false
|
173
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
174
86
|
none: false
|
175
87
|
requirements:
|
176
88
|
- - ~>
|
177
89
|
- !ruby/object:Gem::Version
|
178
|
-
hash:
|
179
|
-
segments:
|
180
|
-
- 1
|
181
|
-
- 1
|
182
|
-
version: "1.1"
|
183
|
-
type: :development
|
184
|
-
version_requirements: *id011
|
185
|
-
- !ruby/object:Gem::Dependency
|
186
|
-
name: randexp
|
187
|
-
prerelease: false
|
188
|
-
requirement: &id012 !ruby/object:Gem::Requirement
|
189
|
-
none: false
|
190
|
-
requirements:
|
191
|
-
- - ">="
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
hash: 3
|
194
|
-
segments:
|
195
|
-
- 0
|
196
|
-
version: "0"
|
197
|
-
type: :development
|
198
|
-
version_requirements: *id012
|
199
|
-
- !ruby/object:Gem::Dependency
|
200
|
-
name: cucumber
|
201
|
-
prerelease: false
|
202
|
-
requirement: &id013 !ruby/object:Gem::Requirement
|
203
|
-
none: false
|
204
|
-
requirements:
|
205
|
-
- - ">="
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
hash: 3
|
90
|
+
hash: 17
|
208
91
|
segments:
|
209
92
|
- 0
|
210
|
-
version: "0"
|
211
|
-
type: :development
|
212
|
-
version_requirements: *id013
|
213
|
-
- !ruby/object:Gem::Dependency
|
214
|
-
name: rcov
|
215
|
-
prerelease: false
|
216
|
-
requirement: &id014 !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
|
-
requirements:
|
219
|
-
- - "="
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
hash: -1842207251
|
222
|
-
segments:
|
223
|
-
- 0
|
224
|
-
- 8
|
225
|
-
- 6
|
226
|
-
- ninjas
|
227
|
-
version: 0.8.6.ninjas
|
228
|
-
type: :development
|
229
|
-
version_requirements: *id014
|
230
|
-
- !ruby/object:Gem::Dependency
|
231
|
-
name: fakeweb
|
232
|
-
prerelease: false
|
233
|
-
requirement: &id015 !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
|
-
requirements:
|
236
|
-
- - "="
|
237
|
-
- !ruby/object:Gem::Version
|
238
|
-
hash: -1842207315
|
239
|
-
segments:
|
240
93
|
- 1
|
241
|
-
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
version_requirements: *id015
|
247
|
-
- !ruby/object:Gem::Dependency
|
248
|
-
name: fakefs
|
249
|
-
prerelease: false
|
250
|
-
requirement: &id016 !ruby/object:Gem::Requirement
|
251
|
-
none: false
|
252
|
-
requirements:
|
253
|
-
- - "="
|
254
|
-
- !ruby/object:Gem::Version
|
255
|
-
hash: -1842207311
|
256
|
-
segments:
|
257
|
-
- 0
|
258
|
-
- 0
|
259
|
-
- 1
|
260
|
-
- ninjas
|
261
|
-
version: 0.0.1.ninjas
|
262
|
-
type: :development
|
263
|
-
version_requirements: *id016
|
264
|
-
- !ruby/object:Gem::Dependency
|
265
|
-
name: dbi
|
266
|
-
prerelease: false
|
267
|
-
requirement: &id017 !ruby/object:Gem::Requirement
|
268
|
-
none: false
|
269
|
-
requirements:
|
270
|
-
- - ">="
|
271
|
-
- !ruby/object:Gem::Version
|
272
|
-
hash: 3
|
273
|
-
segments:
|
274
|
-
- 0
|
275
|
-
version: "0"
|
276
|
-
type: :development
|
277
|
-
version_requirements: *id017
|
278
|
-
- !ruby/object:Gem::Dependency
|
279
|
-
name: dbd-mysql
|
280
|
-
prerelease: false
|
281
|
-
requirement: &id018 !ruby/object:Gem::Requirement
|
282
|
-
none: false
|
283
|
-
requirements:
|
284
|
-
- - ">="
|
285
|
-
- !ruby/object:Gem::Version
|
286
|
-
hash: 3
|
287
|
-
segments:
|
288
|
-
- 0
|
289
|
-
version: "0"
|
290
|
-
type: :development
|
291
|
-
version_requirements: *id018
|
292
|
-
- !ruby/object:Gem::Dependency
|
293
|
-
name: ruby-debug
|
294
|
-
prerelease: false
|
295
|
-
requirement: &id019 !ruby/object:Gem::Requirement
|
296
|
-
none: false
|
297
|
-
requirements:
|
298
|
-
- - ">="
|
299
|
-
- !ruby/object:Gem::Version
|
300
|
-
hash: 3
|
301
|
-
segments:
|
302
|
-
- 0
|
303
|
-
version: "0"
|
304
|
-
type: :development
|
305
|
-
version_requirements: *id019
|
306
|
-
description: Server side components for Engine Yard's cloud
|
94
|
+
- 5
|
95
|
+
version: 0.1.5
|
96
|
+
type: :runtime
|
97
|
+
version_requirements: *id005
|
98
|
+
description: ""
|
307
99
|
email:
|
308
|
-
-
|
100
|
+
- engineering@engineyard.com
|
309
101
|
executables:
|
310
102
|
- binary_log_purge
|
311
103
|
- clear_binlogs_from_slave
|
@@ -318,12 +110,35 @@ extensions: []
|
|
318
110
|
extra_rdoc_files: []
|
319
111
|
|
320
112
|
files:
|
113
|
+
- .gitignore
|
114
|
+
- .rvmrc
|
115
|
+
- Gemfile
|
116
|
+
- Gemfile.lock
|
117
|
+
- LICENSE
|
118
|
+
- README.rdoc
|
119
|
+
- Rakefile
|
120
|
+
- TODO
|
121
|
+
- bin/binary_log_purge
|
122
|
+
- bin/clear_binlogs_from_slave
|
123
|
+
- bin/ey-agent
|
124
|
+
- bin/ey-snapshots
|
125
|
+
- bin/eybackup
|
126
|
+
- bin/mysql_start
|
127
|
+
- ey_cloud_server.gemspec
|
128
|
+
- features/downloading_a_mysql_backup.feature
|
129
|
+
- features/making_a_postgresql_backup.feature
|
130
|
+
- features/restoring_postgres_backup.feature
|
131
|
+
- features/step_definitions/backups.rb
|
132
|
+
- features/step_definitions/commands.rb
|
133
|
+
- features/step_definitions/mysql.rb
|
134
|
+
- features/step_definitions/postgresql.rb
|
135
|
+
- features/support/env.rb
|
136
|
+
- lib/ey-flex.rb
|
321
137
|
- lib/ey-flex/big-brother.rb
|
322
138
|
- lib/ey-flex/bucket_minder.rb
|
323
|
-
- lib/ey-flex/ec2.rb
|
324
139
|
- lib/ey-flex/ey-api.rb
|
325
140
|
- lib/ey-flex/snapshot_minder.rb
|
326
|
-
- lib/
|
141
|
+
- lib/ey_backup.rb
|
327
142
|
- lib/ey_backup/backend.rb
|
328
143
|
- lib/ey_backup/backup_set.rb
|
329
144
|
- lib/ey_backup/base.rb
|
@@ -331,7 +146,6 @@ files:
|
|
331
146
|
- lib/ey_backup/database.rb
|
332
147
|
- lib/ey_backup/dumper.rb
|
333
148
|
- lib/ey_backup/engine.rb
|
334
|
-
- lib/ey_backup/engines/mongodb_engine.rb
|
335
149
|
- lib/ey_backup/engines/mysql_engine.rb
|
336
150
|
- lib/ey_backup/engines/postgresql_engine.rb
|
337
151
|
- lib/ey_backup/loader.rb
|
@@ -340,10 +154,10 @@ files:
|
|
340
154
|
- lib/ey_backup/processors/gzipper.rb
|
341
155
|
- lib/ey_backup/processors/splitter.rb
|
342
156
|
- lib/ey_backup/spawner.rb
|
343
|
-
- lib/
|
157
|
+
- lib/ey_cloud_server.rb
|
344
158
|
- lib/ey_cloud_server/mysql_start.rb
|
345
159
|
- lib/ey_cloud_server/version.rb
|
346
|
-
-
|
160
|
+
- script/ci
|
347
161
|
- spec/big-brother_spec.rb
|
348
162
|
- spec/bucket_minder_spec.rb
|
349
163
|
- spec/config-example.yml
|
@@ -351,7 +165,6 @@ files:
|
|
351
165
|
- spec/ey_backup/backend_spec.rb
|
352
166
|
- spec/ey_backup/backup_spec.rb
|
353
167
|
- spec/ey_backup/cli_spec.rb
|
354
|
-
- spec/ey_backup/mongo_backups_spec.rb
|
355
168
|
- spec/ey_backup/mysql_backups_spec.rb
|
356
169
|
- spec/ey_backup/postgres_backups_spec.rb
|
357
170
|
- spec/ey_backup/spec_helper.rb
|
@@ -361,13 +174,8 @@ files:
|
|
361
174
|
- spec/helpers.rb
|
362
175
|
- spec/snapshot_minder_spec.rb
|
363
176
|
- spec/spec_helper.rb
|
364
|
-
-
|
365
|
-
|
366
|
-
- bin/ey-agent
|
367
|
-
- bin/ey-snapshots
|
368
|
-
- bin/eybackup
|
369
|
-
- bin/mysql_start
|
370
|
-
homepage: http://github.com/engineyard/ey_cloud_server
|
177
|
+
- tmp/.gitignore
|
178
|
+
homepage: ""
|
371
179
|
licenses: []
|
372
180
|
|
373
181
|
post_install_message:
|
@@ -396,11 +204,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
204
|
requirements: []
|
397
205
|
|
398
206
|
rubyforge_project:
|
399
|
-
rubygems_version: 1.8.
|
207
|
+
rubygems_version: 1.8.10
|
400
208
|
signing_key:
|
401
209
|
specification_version: 3
|
402
210
|
summary: Server side components for Engine Yard's cloud
|
403
211
|
test_files:
|
212
|
+
- features/downloading_a_mysql_backup.feature
|
213
|
+
- features/making_a_postgresql_backup.feature
|
214
|
+
- features/restoring_postgres_backup.feature
|
215
|
+
- features/step_definitions/backups.rb
|
216
|
+
- features/step_definitions/commands.rb
|
217
|
+
- features/step_definitions/mysql.rb
|
218
|
+
- features/step_definitions/postgresql.rb
|
219
|
+
- features/support/env.rb
|
404
220
|
- spec/big-brother_spec.rb
|
405
221
|
- spec/bucket_minder_spec.rb
|
406
222
|
- spec/config-example.yml
|
@@ -408,7 +224,6 @@ test_files:
|
|
408
224
|
- spec/ey_backup/backend_spec.rb
|
409
225
|
- spec/ey_backup/backup_spec.rb
|
410
226
|
- spec/ey_backup/cli_spec.rb
|
411
|
-
- spec/ey_backup/mongo_backups_spec.rb
|
412
227
|
- spec/ey_backup/mysql_backups_spec.rb
|
413
228
|
- spec/ey_backup/postgres_backups_spec.rb
|
414
229
|
- spec/ey_backup/spec_helper.rb
|
data/lib/ey-flex/ec2.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
class EC2
|
3
|
-
def initialize(opts = {})
|
4
|
-
@ec2 = RightAws::Ec2.new(opts[:aws_secret_id], opts[:aws_secret_key], :logger => Logger.new("/dev/null"))
|
5
|
-
end
|
6
|
-
|
7
|
-
def method_missing(method, *a, &b)
|
8
|
-
@ec2.send(method, *a, &b)
|
9
|
-
rescue RightAws::AwsError => e
|
10
|
-
retries ||= 10
|
11
|
-
retries -= 1
|
12
|
-
raise e if retries == 0
|
13
|
-
sleep 30
|
14
|
-
retry
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Backup
|
3
|
-
class Mongodb < Engine
|
4
|
-
register 'mongodb'
|
5
|
-
|
6
|
-
def dump(database_name, basename)
|
7
|
-
# Mongo dumps in directories. Compressing
|
8
|
-
file = basename
|
9
|
-
|
10
|
-
command = "mongodump --host #{host} -o #{file} --db #{database_name}; tar -cz #{file}"
|
11
|
-
|
12
|
-
if gpg?
|
13
|
-
command << " | " << GPGEncryptor.command_for(key_id)
|
14
|
-
file << GPGEncryptor.extension
|
15
|
-
end
|
16
|
-
|
17
|
-
command << " > #{file}"
|
18
|
-
|
19
|
-
run(command)
|
20
|
-
|
21
|
-
file
|
22
|
-
end
|
23
|
-
|
24
|
-
def load(database_name, file)
|
25
|
-
if database_exists?(database_name)
|
26
|
-
cycle_database(database_name)
|
27
|
-
else
|
28
|
-
create_database(database_name)
|
29
|
-
end
|
30
|
-
|
31
|
-
command = "cat #{file}"
|
32
|
-
|
33
|
-
if gpg?
|
34
|
-
raise "Cannot load a GPG backup"
|
35
|
-
end
|
36
|
-
|
37
|
-
command << " | mongorestore --host #{host} --db #{database_name}"
|
38
|
-
|
39
|
-
run(command)
|
40
|
-
end
|
41
|
-
|
42
|
-
def database_exists?(database_name)
|
43
|
-
runs?("mongo --host #{host} --quiet --eval \"for each(var db in db.runCommand('listDatabases').databases) if(db.sizeOnDisk > 1) print(db.name);\" admin | grep '#{database_name}'")
|
44
|
-
end
|
45
|
-
|
46
|
-
def drop_database(database_name)
|
47
|
-
runs?("mongo --host #{host} #{database_name} --quiet --eval 'printjson(db.dropDatabase());'")
|
48
|
-
end
|
49
|
-
|
50
|
-
def create_database(database_name)
|
51
|
-
runs?("mongo --host #{host} #{database_name} --quiet --eval 'db.createCollection('ey_backup');'")
|
52
|
-
end
|
53
|
-
|
54
|
-
def cycle_database(database_name)
|
55
|
-
drop_database(database_name)
|
56
|
-
create_database(database_name)
|
57
|
-
end
|
58
|
-
|
59
|
-
def suffix
|
60
|
-
/\.(gz)$/
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|