dployr 0.0.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.
- checksums.yaml +7 -0
- data/.editorconfig +9 -0
- data/.gitignore +7 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +294 -0
- data/Rakefile +11 -0
- data/bin/dployr +4 -0
- data/dployr.gemspec +33 -0
- data/lib/dployr/cli/cli.rb +77 -0
- data/lib/dployr/cli/commands/config.rb +66 -0
- data/lib/dployr/cli/commands.rb +1 -0
- data/lib/dployr/compute/client.rb +28 -0
- data/lib/dployr/config/constants.rb +10 -0
- data/lib/dployr/config/create.rb +54 -0
- data/lib/dployr/config/file_utils.rb +36 -0
- data/lib/dployr/config/instance.rb +99 -0
- data/lib/dployr/configuration.rb +163 -0
- data/lib/dployr/init.rb +72 -0
- data/lib/dployr/logger.rb +11 -0
- data/lib/dployr/utils.rb +127 -0
- data/lib/dployr/version.rb +3 -0
- data/lib/dployr.rb +8 -0
- data/spec/config_file_utils_spec.rb +61 -0
- data/spec/config_instance_spec.rb +60 -0
- data/spec/configuration_spec.rb +516 -0
- data/spec/fixtures/Dployrfile +59 -0
- data/spec/fixtures/Dployrfile.yml +91 -0
- data/spec/fog_spec_.rb +44 -0
- data/spec/init_spec.rb +27 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/utils_spec.rb +317 -0
- metadata +146 -0
@@ -0,0 +1,516 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dployr::Configuration do
|
4
|
+
|
5
|
+
config = Dployr::Configuration.new
|
6
|
+
|
7
|
+
describe "setting config" do
|
8
|
+
before :all do
|
9
|
+
ENV['DPLOYR'] = '0.1.0'
|
10
|
+
end
|
11
|
+
|
12
|
+
after :all do
|
13
|
+
ENV.delete 'DPLOYR'
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "default values" do
|
17
|
+
let(:defaults) do
|
18
|
+
{
|
19
|
+
attributes: {
|
20
|
+
name: "example",
|
21
|
+
instance_type: "m1.small",
|
22
|
+
version: "${DPLOYR}"
|
23
|
+
},
|
24
|
+
scripts: [
|
25
|
+
{ path: "configure.sh" }
|
26
|
+
],
|
27
|
+
providers: {
|
28
|
+
aws: {
|
29
|
+
attributes: {
|
30
|
+
network_id: "be457fca",
|
31
|
+
instance_type: "m1.small",
|
32
|
+
"type-%{name}" => "small"
|
33
|
+
},
|
34
|
+
scripts: [
|
35
|
+
{ path: "router.sh", args: ["%{name}", "${region}", "${provider}"] }
|
36
|
+
],
|
37
|
+
regions: {
|
38
|
+
"eu-west-1a" => {
|
39
|
+
attributes: {
|
40
|
+
keypair: "vagrant-aws-ireland"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "add default values" do
|
50
|
+
before do
|
51
|
+
config.set_default defaults
|
52
|
+
end
|
53
|
+
|
54
|
+
context "when was added" do
|
55
|
+
it "should create a default instance" do
|
56
|
+
config.default.should be_an_instance_of Dployr::Config::Instance
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should have valid attributes" do
|
60
|
+
config.default.attributes.should be_a Hash
|
61
|
+
config.default.attributes.should have(3).items
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should have scripts" do
|
65
|
+
config.default.scripts.should be_a Array
|
66
|
+
config.default.scripts.should have(1).items
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should have providers" do
|
70
|
+
config.default.providers.should be_a Hash
|
71
|
+
config.default.providers.should have(1).items
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should provider must be for AWS" do
|
75
|
+
config.default.get_provider(:aws).should be_a Hash
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "instance" do
|
82
|
+
|
83
|
+
hera_config = {
|
84
|
+
attributes: {
|
85
|
+
name: "hera"
|
86
|
+
},
|
87
|
+
providers: {
|
88
|
+
gce: {
|
89
|
+
attributes: {
|
90
|
+
instance_type: "m1.large"
|
91
|
+
},
|
92
|
+
regions: {
|
93
|
+
"los-angeles-ca" => {
|
94
|
+
attributes: {
|
95
|
+
keypair: "google"
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
zeus_config = {
|
104
|
+
extends: "hera",
|
105
|
+
attributes: {
|
106
|
+
name: "zeus"
|
107
|
+
},
|
108
|
+
authentication: {
|
109
|
+
user: "admin",
|
110
|
+
key_path: "path/to/key.pem"
|
111
|
+
},
|
112
|
+
scripts: [
|
113
|
+
{ path: "setup.sh", args: ["--id ${index}"], remote: true }
|
114
|
+
],
|
115
|
+
providers: {
|
116
|
+
aws: {
|
117
|
+
attributes: {
|
118
|
+
instance_type: "m1.small"
|
119
|
+
},
|
120
|
+
regions: {
|
121
|
+
"europe-west1-a" => {
|
122
|
+
attributes: {
|
123
|
+
keypair: "vagrant-aws-ireland"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
before :all do
|
132
|
+
config.add_instance :hera, hera_config
|
133
|
+
config.add_instance :zeus, zeus_config
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "add new instance" do
|
137
|
+
let(:instance) { config.get_instance :zeus }
|
138
|
+
|
139
|
+
context "when was added" do
|
140
|
+
it "should exists the new instance" do
|
141
|
+
instance.should be_an_instance_of Dployr::Config::Instance
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should have valid attributes" do
|
145
|
+
instance.attributes.should be_a Hash
|
146
|
+
instance.attributes.should have(1).items
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should have scripts" do
|
150
|
+
instance.scripts.should be_a Array
|
151
|
+
instance.scripts.should have(1).items
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should have providers" do
|
155
|
+
instance.providers.should be_a Hash
|
156
|
+
instance.providers.should have(1).items
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should provider must be for AWS" do
|
160
|
+
instance.get_provider(:aws).should be_a Hash
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe "getting config" do
|
167
|
+
let(:zeus) { config.get_config :zeus }
|
168
|
+
|
169
|
+
it "should exists and be a valid" do
|
170
|
+
zeus.should be_a Hash
|
171
|
+
end
|
172
|
+
|
173
|
+
describe "attributes" do
|
174
|
+
it "shoudl exists" do
|
175
|
+
zeus[:attributes].should be_a Hash
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should overwrite the name" do
|
179
|
+
zeus[:attributes][:name].should eql 'zeus'
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should have the default instance type" do
|
183
|
+
zeus[:attributes][:instance_type].should eql 'm1.small'
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "scripts" do
|
188
|
+
it "should exists" do
|
189
|
+
zeus[:scripts].should be_a Array
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should have a valid number" do
|
193
|
+
zeus[:scripts].should have(2).items
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should have the default script" do
|
197
|
+
zeus[:scripts][0][:path].should eql 'configure.sh'
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should have the instance specific script" do
|
201
|
+
zeus[:scripts][1][:path].should eql 'setup.sh'
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
describe "autentication" do
|
206
|
+
it "should exists" do
|
207
|
+
zeus[:authentication].should be_a Hash
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should have a valid number of values" do
|
211
|
+
zeus[:authentication].should have(2).items
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should have a valid authentication values" do
|
215
|
+
zeus[:authentication][:user].should eql 'admin'
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
describe "providers" do
|
220
|
+
it "should exists" do
|
221
|
+
zeus[:providers].should be_a Hash
|
222
|
+
zeus[:providers].should have(2).items
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should exists the aws provider config" do
|
226
|
+
zeus[:providers][:aws].should be_a Hash
|
227
|
+
end
|
228
|
+
|
229
|
+
describe "inherited from parent" do
|
230
|
+
it "should exists the gce provider config" do
|
231
|
+
zeus[:providers][:gce].should be_a Hash
|
232
|
+
end
|
233
|
+
|
234
|
+
describe "gce" do
|
235
|
+
let(:gce) {
|
236
|
+
zeus[:providers][:gce]
|
237
|
+
}
|
238
|
+
|
239
|
+
it "should have a valid number of attributes" do
|
240
|
+
gce[:attributes].should have(3).items
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should have the instance_type attributes" do
|
244
|
+
gce[:attributes][:instance_type].should eql "m1.large"
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should have valid number of regions" do
|
248
|
+
gce[:regions].should have(1).items
|
249
|
+
end
|
250
|
+
|
251
|
+
it "should have a valid region" do
|
252
|
+
gce[:regions]["los-angeles-ca"].should be_a Hash
|
253
|
+
end
|
254
|
+
|
255
|
+
describe "los-angeles-ca region" do
|
256
|
+
let(:region) {
|
257
|
+
gce[:regions]["los-angeles-ca"]
|
258
|
+
}
|
259
|
+
|
260
|
+
it "should have a valid number of attributes" do
|
261
|
+
region[:attributes].should have(4).items
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should have inherited scripts" do
|
265
|
+
region[:scripts].should have(2).items
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should have inherited autentication" do
|
269
|
+
region[:authentication].should have(2).items
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
describe "aws" do
|
277
|
+
it "should have the expected values" do
|
278
|
+
zeus[:providers][:aws].should have(4).items
|
279
|
+
end
|
280
|
+
|
281
|
+
describe "attributes" do
|
282
|
+
it "should have valid attributes" do
|
283
|
+
zeus[:providers][:aws][:attributes].should be_a Hash
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should have a valid number of attributes" do
|
287
|
+
zeus[:providers][:aws][:attributes].should have(5).items
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should have a valid instance_type" do
|
291
|
+
zeus[:providers][:aws][:attributes][:instance_type].should eql "m1.small"
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should have a valid netword_id" do
|
295
|
+
zeus[:providers][:aws][:attributes][:network_id].should eql "be457fca"
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should have a valid name" do
|
299
|
+
zeus[:providers][:aws][:attributes][:name].should eql "zeus"
|
300
|
+
end
|
301
|
+
|
302
|
+
describe "templating" do
|
303
|
+
it "should have a version attribute" do
|
304
|
+
zeus[:providers][:aws][:attributes][:version].should eql "0.1.0"
|
305
|
+
end
|
306
|
+
|
307
|
+
it "should have a type key with valid replacement" do
|
308
|
+
zeus[:providers][:aws][:attributes]["type-zeus"].should eql "small"
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
describe "scripts" do
|
314
|
+
it "should exists" do
|
315
|
+
zeus[:providers][:aws][:scripts].should be_a Array
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should have a valid number" do
|
319
|
+
zeus[:providers][:aws][:scripts].should have(3).items
|
320
|
+
end
|
321
|
+
|
322
|
+
it "should have a valid path" do
|
323
|
+
zeus[:providers][:aws][:scripts][0][:path].should eql "configure.sh"
|
324
|
+
end
|
325
|
+
|
326
|
+
it "should have a valid path" do
|
327
|
+
zeus[:providers][:aws][:scripts][1][:path].should eql "setup.sh"
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should have a valid path" do
|
331
|
+
zeus[:providers][:aws][:scripts][2][:path].should eql "router.sh"
|
332
|
+
end
|
333
|
+
|
334
|
+
describe "templating" do
|
335
|
+
it "should replace the argument with the instance name" do
|
336
|
+
zeus[:providers][:aws][:scripts][2][:args][0].should eql "zeus"
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
describe "regions" do
|
342
|
+
it "should have valid regions" do
|
343
|
+
zeus[:providers][:aws][:regions].should be_a Hash
|
344
|
+
end
|
345
|
+
|
346
|
+
it "should have a valid number of providers" do
|
347
|
+
zeus[:providers][:aws][:regions].should have(2).items
|
348
|
+
end
|
349
|
+
|
350
|
+
it "should exists an europe-west1-a region" do
|
351
|
+
zeus[:providers][:aws][:regions]["europe-west1-a"].should be_a Hash
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should exists an eu-west-1a region" do
|
355
|
+
zeus[:providers][:aws][:regions]["eu-west-1a"].should be_a Hash
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should exists an europe-west1-a region" do
|
359
|
+
zeus[:providers][:aws][:regions]["eu-west-1a"].should be_a Hash
|
360
|
+
end
|
361
|
+
|
362
|
+
describe "eu-west-1a" do
|
363
|
+
let(:region) {
|
364
|
+
zeus[:providers][:aws][:regions]["eu-west-1a"]
|
365
|
+
}
|
366
|
+
|
367
|
+
describe "attributes" do
|
368
|
+
it "should exists" do
|
369
|
+
region[:attributes].should be_a Hash
|
370
|
+
end
|
371
|
+
|
372
|
+
it "should have the name attribute" do
|
373
|
+
region[:attributes][:name].should eql "zeus"
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should have the instance_type attribute" do
|
377
|
+
region[:attributes][:instance_type].should eql "m1.small"
|
378
|
+
end
|
379
|
+
|
380
|
+
it "should have the network_id attribute" do
|
381
|
+
region[:attributes][:network_id].should eql "be457fca"
|
382
|
+
end
|
383
|
+
|
384
|
+
it "should have the keypair attribute" do
|
385
|
+
region[:attributes][:keypair].should eql "vagrant-aws-ireland"
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
describe "scripts" do
|
390
|
+
it "should exists" do
|
391
|
+
region[:scripts].should be_a Array
|
392
|
+
end
|
393
|
+
|
394
|
+
it "should have a valid number" do
|
395
|
+
region[:scripts].should have(3).items
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should have the proper first script" do
|
399
|
+
region[:scripts][0][:path].should eql "configure.sh"
|
400
|
+
end
|
401
|
+
|
402
|
+
it "should have the proper second script" do
|
403
|
+
region[:scripts][1][:path].should eql "setup.sh"
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should have a valid index argument" do
|
407
|
+
region[:scripts][1][:args][0].should eql "--id "
|
408
|
+
end
|
409
|
+
|
410
|
+
it "should have the proper third script" do
|
411
|
+
region[:scripts][2][:path].should eql "router.sh"
|
412
|
+
end
|
413
|
+
|
414
|
+
describe "templating" do
|
415
|
+
it "should replace the argument with the current region" do
|
416
|
+
region[:scripts][2][:args][1].should eql "eu-west-1a"
|
417
|
+
end
|
418
|
+
|
419
|
+
it "should replace the argument with the current provider" do
|
420
|
+
region[:scripts][2][:args][2].should eql "aws"
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
describe "authentication" do
|
426
|
+
it "should exists" do
|
427
|
+
region[:authentication].should be_a Hash
|
428
|
+
end
|
429
|
+
|
430
|
+
it "should have a valid number" do
|
431
|
+
region[:authentication].should have(2).items
|
432
|
+
end
|
433
|
+
|
434
|
+
it "should have a valid user" do
|
435
|
+
region[:authentication][:user].should eql "admin"
|
436
|
+
end
|
437
|
+
|
438
|
+
it "should have a valid key_path" do
|
439
|
+
region[:authentication][:key_path].should eql "path/to/key.pem"
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
describe "get instance config" do
|
449
|
+
attributes = { name: "hera" }
|
450
|
+
|
451
|
+
describe "provider" do
|
452
|
+
before :all do
|
453
|
+
@config = config.get_provider :zeus, :aws, attributes
|
454
|
+
end
|
455
|
+
|
456
|
+
it "should exists the config" do
|
457
|
+
@config.should be_a Hash
|
458
|
+
end
|
459
|
+
|
460
|
+
it "should have one provider" do
|
461
|
+
@config.should have(4).items
|
462
|
+
end
|
463
|
+
|
464
|
+
it "should have two regions" do
|
465
|
+
@config[:regions].should have(2).items
|
466
|
+
end
|
467
|
+
|
468
|
+
describe "attributes" do
|
469
|
+
it "should exists" do
|
470
|
+
@config[:attributes].should be_a Hash
|
471
|
+
end
|
472
|
+
|
473
|
+
it "should have a valid name" do
|
474
|
+
@config[:attributes][:name].should eql "zeus"
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
describe "scripts" do
|
479
|
+
it "should exists" do
|
480
|
+
@config[:scripts].should be_a Array
|
481
|
+
end
|
482
|
+
|
483
|
+
it "should have a valid number" do
|
484
|
+
@config[:scripts].should have(3).items
|
485
|
+
end
|
486
|
+
|
487
|
+
it "should overwrite the argument" do
|
488
|
+
@config[:scripts][2][:args][0].should eql "hera"
|
489
|
+
end
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
describe "region" do
|
494
|
+
before :all do
|
495
|
+
@config = config.get_region :zeus, :aws, "eu-west-1a", attributes
|
496
|
+
end
|
497
|
+
|
498
|
+
it "should exists" do
|
499
|
+
@config.should be_a Hash
|
500
|
+
end
|
501
|
+
|
502
|
+
it "should have a valid number of keys" do
|
503
|
+
@config.should have(3).items
|
504
|
+
end
|
505
|
+
|
506
|
+
it "should have a attributes" do
|
507
|
+
@config[:attributes].should be_a Hash
|
508
|
+
end
|
509
|
+
|
510
|
+
it "should have a attributes" do
|
511
|
+
@config[:attributes].should be_a Hash
|
512
|
+
end
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
Dployr::configure do |dployr|
|
3
|
+
dployr.config.set_default({
|
4
|
+
attributes: {
|
5
|
+
name: "example",
|
6
|
+
instance_type: "m1.small",
|
7
|
+
version: "${DPLOYR}"
|
8
|
+
},
|
9
|
+
scripts: [
|
10
|
+
{ path: "configure.sh" }
|
11
|
+
],
|
12
|
+
providers: {
|
13
|
+
aws: {
|
14
|
+
attributes: {
|
15
|
+
network_id: "be457fca",
|
16
|
+
instance_type: "m1.small",
|
17
|
+
"type-%{name}" => "small"
|
18
|
+
},
|
19
|
+
scripts: [
|
20
|
+
{ path: "router.sh", args: ["%{name}", "${region}", "${provider}"] }
|
21
|
+
],
|
22
|
+
regions: {
|
23
|
+
"eu-west-1a" => {
|
24
|
+
attributes: {
|
25
|
+
keypair: "vagrant-aws-ireland"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
})
|
32
|
+
|
33
|
+
dployr.config.add_instance('zeus', {
|
34
|
+
attributes: {
|
35
|
+
name: "zeus"
|
36
|
+
},
|
37
|
+
authentication: {
|
38
|
+
user: "admin",
|
39
|
+
key_path: "path/to/key.pem"
|
40
|
+
},
|
41
|
+
scripts: [
|
42
|
+
{ path: "setup.sh", args: ["--id ${index}"], remote: true }
|
43
|
+
],
|
44
|
+
providers: {
|
45
|
+
aws: {
|
46
|
+
attributes: {
|
47
|
+
instance_type: "m1.small"
|
48
|
+
},
|
49
|
+
regions: {
|
50
|
+
"europe-west1-a" => {
|
51
|
+
attributes: {
|
52
|
+
keypair: "vagrant-aws-ireland"
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
})
|
59
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
---
|
2
|
+
default:
|
3
|
+
attributes:
|
4
|
+
name: "%{name}"
|
5
|
+
prefix: dev
|
6
|
+
private_key_path: ~/pems/innotechdev.pem
|
7
|
+
username: innotechdev
|
8
|
+
authentication:
|
9
|
+
private_key_path: ~/.ssh/id_rsa
|
10
|
+
public_key_path: ~/.ssh/id_rsa.pub
|
11
|
+
username: ubuntu
|
12
|
+
providers:
|
13
|
+
aws:
|
14
|
+
attributes:
|
15
|
+
instance_type: m1.small
|
16
|
+
regions:
|
17
|
+
eu-west-1a:
|
18
|
+
attributes:
|
19
|
+
ami: ami-f5ca3682
|
20
|
+
keypair: vagrant-aws-ireland
|
21
|
+
security_groups:
|
22
|
+
- sg-576c7635
|
23
|
+
- sg-1e648a7b
|
24
|
+
subnet_id: subnet-be457fca
|
25
|
+
us-west-2b:
|
26
|
+
attributes:
|
27
|
+
ami: ami-c66608f6
|
28
|
+
keypair: vagrant-aws-oregon
|
29
|
+
security_groups:
|
30
|
+
- sg-88283cea
|
31
|
+
- sg-f233ca97
|
32
|
+
subnet_id: subnet-ef757e8d
|
33
|
+
gce:
|
34
|
+
attributes:
|
35
|
+
client_email: sample@developer.com
|
36
|
+
instance_type: m1.small
|
37
|
+
key_location: ~/pems/privatekey.p12
|
38
|
+
project_id: innotechapp
|
39
|
+
regions:
|
40
|
+
europe-west1-a:
|
41
|
+
attributes:
|
42
|
+
ami: centos-base-v5
|
43
|
+
instance_type: n1-standard-1
|
44
|
+
network: liberty-gce
|
45
|
+
scripts:
|
46
|
+
-
|
47
|
+
path: ./scripts/routes_allregions.sh
|
48
|
+
-
|
49
|
+
args: "%{name}"
|
50
|
+
path: ./scripts/updatedns.sh
|
51
|
+
|
52
|
+
|
53
|
+
custom:
|
54
|
+
name: 1
|
55
|
+
web-server:
|
56
|
+
attributes:
|
57
|
+
prefix: zeus-dev
|
58
|
+
authentication:
|
59
|
+
private_key_path: ~/.ssh/id_rsa
|
60
|
+
public_key_path: ~/.ssh/id_rsa.pub
|
61
|
+
username: ubuntu
|
62
|
+
providers:
|
63
|
+
aws:
|
64
|
+
regions:
|
65
|
+
attributes:
|
66
|
+
instance_type: m1.medium
|
67
|
+
gce:
|
68
|
+
attributes:
|
69
|
+
instance_type: m1.large
|
70
|
+
scripts:
|
71
|
+
-
|
72
|
+
args:
|
73
|
+
- "%{name}"
|
74
|
+
- "%{type}"
|
75
|
+
- "%{domain}"
|
76
|
+
path: ./scripts/configure.sh
|
77
|
+
-
|
78
|
+
args:
|
79
|
+
- "%{hydra}"
|
80
|
+
path: ./scripts/configureListener.sh
|
81
|
+
-
|
82
|
+
args:
|
83
|
+
- "%{$provider}-%{region}"
|
84
|
+
- "%{type}"
|
85
|
+
path: ./scripts/hydraProbe.sh
|
86
|
+
|
87
|
+
#instances:
|
88
|
+
# zeus:
|
89
|
+
# include: ['web-server']
|
90
|
+
# attributes:
|
91
|
+
# name: zeus
|
data/spec/fog_spec_.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fog'
|
2
|
+
|
3
|
+
describe "Fog" do
|
4
|
+
|
5
|
+
describe "compute" do
|
6
|
+
|
7
|
+
before { Fog.mock! }
|
8
|
+
|
9
|
+
after { Fog.unmock! }
|
10
|
+
|
11
|
+
let(:fog) do
|
12
|
+
Fog::Compute.new({
|
13
|
+
provider: 'AWS',
|
14
|
+
aws_access_key_id: 'key',
|
15
|
+
aws_secret_access_key: 'secret'
|
16
|
+
})
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "create server" do
|
20
|
+
|
21
|
+
before do
|
22
|
+
@server = fog.servers.create flavor_id => 1, :image_id => 'ami-5ee70037', :name => 'fake_server'
|
23
|
+
@server.wait_for { ready? }
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create the server" do
|
27
|
+
fog.servers.all.should have(1).items
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a valid image id" do
|
31
|
+
fog.servers.get(@server.id).image_id.should eql 'ami-5ee70037'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have a valid dns name" do
|
35
|
+
fog.servers.get(@server.id).dns_name.should include("compute-1.amazonaws.com")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should destroy the server" do
|
39
|
+
@server.destroy
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|