cloudster 2.15.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/README.md +31 -12
- data/VERSION +1 -1
- data/cloudster.gemspec +4 -2
- data/lib/cloudster.rb +1 -0
- data/lib/cloudster/chef_client.rb +2 -5
- data/lib/cloudster/elastic_ip.rb +59 -0
- data/lib/cloudster/elasticache.rb +2 -2
- data/spec/elastic_ip_spec.rb +40 -0
- metadata +5 -3
data/Gemfile.lock
CHANGED
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
highline (>= 1.6.15)
|
35
35
|
rake
|
36
36
|
rdoc
|
37
|
-
json (1.7.
|
37
|
+
json (1.7.6)
|
38
38
|
jwt (0.1.5)
|
39
39
|
multi_json (>= 1.0)
|
40
40
|
mime-types (1.19)
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
net-scp (1.0.4)
|
44
44
|
net-ssh (>= 1.99.1)
|
45
45
|
net-ssh (2.6.2)
|
46
|
-
nokogiri (1.5.
|
46
|
+
nokogiri (1.5.6)
|
47
47
|
oauth2 (0.8.0)
|
48
48
|
faraday (~> 0.8)
|
49
49
|
httpauth (~> 0.1)
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
rspec-core (2.12.2)
|
62
62
|
rspec-expectations (2.12.1)
|
63
63
|
diff-lcs (~> 1.1.3)
|
64
|
-
rspec-mocks (2.12.
|
64
|
+
rspec-mocks (2.12.1)
|
65
65
|
ruby-hmac (0.4.0)
|
66
66
|
|
67
67
|
PLATFORMS
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Cloudster is a Ruby gem that was born to cut the learning curve involved in writing your own CloudFormation templates. If you don't know what
|
4
4
|
a CloudFormation template is, but know about the AWS Cloud offerings, you can still use cloudster to provision your stack. Still in infancy , cloudster
|
5
|
-
can create a
|
5
|
+
can create a basic stack like a breeze. Checkout the Usage section for the supported features.
|
6
6
|
|
7
7
|
##Installation
|
8
8
|
|
@@ -26,7 +26,10 @@ Create AWS resources :
|
|
26
26
|
:interval => 1800
|
27
27
|
)
|
28
28
|
|
29
|
+
elastic_ip = Cloudster::ElasticIp.new
|
30
|
+
|
29
31
|
chef_client.add_to(app_server)
|
32
|
+
elastic_ip.add_to(app_server)
|
30
33
|
|
31
34
|
app_server_2 = Cloudster::Ec2.new(:name => 'AppServer2',
|
32
35
|
:key_name => 'mykey',
|
@@ -40,17 +43,25 @@ Create AWS resources :
|
|
40
43
|
)
|
41
44
|
|
42
45
|
database = Cloudster::Rds.new(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
:name => 'MySqlDB',
|
47
|
+
:instance_class => 'db.t1.micro',
|
48
|
+
:storage_class => '100',
|
49
|
+
:username => 'admin',
|
50
|
+
:password => 'admin123',
|
51
|
+
:engine => 'MySQL',
|
52
|
+
:multi_az => true
|
50
53
|
)
|
51
54
|
|
52
55
|
storage = Cloudster::S3.new(
|
53
|
-
|
56
|
+
:name => 'MyBucket'
|
57
|
+
)
|
58
|
+
|
59
|
+
elasticache = Cloudster::ElastiCache.new(
|
60
|
+
:name => 'CacheResource',
|
61
|
+
:node_type => 'cache.t1.micro',
|
62
|
+
:cache_security_group_names => ['default'],
|
63
|
+
:engine => 'memcached',
|
64
|
+
:node_count => 3
|
54
65
|
)
|
55
66
|
|
56
67
|
Make a cloud :
|
@@ -59,7 +70,7 @@ Make a cloud :
|
|
59
70
|
|
60
71
|
Get the CloudFormation template for the stack :
|
61
72
|
|
62
|
-
cloud.template(:resources => [app_server, app_server_2, load_balancer, database], :description => 'Description of the stack')
|
73
|
+
cloud.template(:resources => [app_server, app_server_2, load_balancer, database, storage, elasticache], :description => 'Description of the stack')
|
63
74
|
|
64
75
|
Get the CloudFormation template for a resource as a Ruby Hash :
|
65
76
|
|
@@ -121,11 +132,15 @@ Cloudster can also do things on the AWS Cloud :
|
|
121
132
|
|
122
133
|
- ### More coming soon ..
|
123
134
|
|
135
|
+
I'm trying to add every AWS resource to cloudster, one by one. If you don't find what you need,
|
136
|
+
let me know and I'll try to get the feature included ASAP, or you can submit a pull request with the feature -
|
137
|
+
that would be awesome! Or, you can patiently wait till the feature is added to cloudster.
|
138
|
+
|
124
139
|
----------------
|
125
140
|
|
126
|
-
# Contribute
|
141
|
+
# Contribute
|
127
142
|
|
128
|
-
Got some love for Cloudster?
|
143
|
+
Got some love for Cloudster? Sweet!
|
129
144
|
|
130
145
|
## Found a bug?
|
131
146
|
|
@@ -174,4 +189,8 @@ above and this can hold things up considerably.
|
|
174
189
|
|
175
190
|
MIT
|
176
191
|
|
192
|
+
## Thanks
|
193
|
+
|
194
|
+
To Sinatra README for having a nice 'Contribute' section which I'm using(with minor changes) for Cloudster.
|
195
|
+
|
177
196
|
*Free Software, Forever . YEAH !*
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.16.0
|
data/cloudster.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "cloudster"
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.16.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Emil Soman"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-31"
|
13
13
|
s.description = "Cloudster is a Ruby gem that was born to cut the learning curve involved \n in writing your own CloudFormation templates. If you don't know what a CloudFormation template is, \n but know about the AWS Cloud offerings, you can still use cloudster to provision your stack. \n Still in infancy , cloudster can create a very basic stack like a breeze. All kinds of contribution welcome !"
|
14
14
|
s.email = "emil.soman@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/cloudster/cloud.rb",
|
33
33
|
"lib/cloudster/deep_merge.rb",
|
34
34
|
"lib/cloudster/ec2.rb",
|
35
|
+
"lib/cloudster/elastic_ip.rb",
|
35
36
|
"lib/cloudster/elasticache.rb",
|
36
37
|
"lib/cloudster/elb.rb",
|
37
38
|
"lib/cloudster/options_manager.rb",
|
@@ -40,6 +41,7 @@ Gem::Specification.new do |s|
|
|
40
41
|
"spec/chef_client_spec.rb",
|
41
42
|
"spec/cloud_spec.rb",
|
42
43
|
"spec/ec2_spec.rb",
|
44
|
+
"spec/elastic_ip_spec.rb",
|
43
45
|
"spec/elasticache_spec.rb",
|
44
46
|
"spec/elb_spec.rb",
|
45
47
|
"spec/rds_spec.rb",
|
data/lib/cloudster.rb
CHANGED
@@ -16,8 +16,7 @@ module Cloudster
|
|
16
16
|
# )
|
17
17
|
#
|
18
18
|
# ==== Parameters
|
19
|
-
# * options<~Hash> -
|
20
|
-
# * :instance_name: String containing the name of EC2 element on which chef-client is to be bootstrapped. Mandatory field
|
19
|
+
# * options<~Hash> -
|
21
20
|
# * :validation_key: String containing the key used for validating this client with the server. This can be taken from the chef-server validation.pem file. Mandatory field
|
22
21
|
# * :server_url: String containing the fully qualified domain name of the chef-server. Mandatory field
|
23
22
|
# * :node_name: String containing the name for the chef node. It has to be unique across all nodes in the particular chef client-server ecosystem. Mandatory field
|
@@ -35,7 +34,6 @@ module Cloudster
|
|
35
34
|
#
|
36
35
|
# ==== Examples
|
37
36
|
# chef_client = Cloudster::ChefClient.new(
|
38
|
-
# :instance_name => 'AppServer',
|
39
37
|
# :validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
|
40
38
|
# :server_url => 'http://10.50.60.70:4000',
|
41
39
|
# :node_name => 'project.environment.appserver_1'
|
@@ -53,13 +51,12 @@ module Cloudster
|
|
53
51
|
# * instance of EC2
|
54
52
|
def add_to(ec2)
|
55
53
|
ec2_template = ec2.template
|
56
|
-
@instance_name = ec2.name
|
54
|
+
@instance_name = ec2.name
|
57
55
|
chef_client_template = template
|
58
56
|
ec2.template.deep_merge(chef_client_template)
|
59
57
|
end
|
60
58
|
|
61
59
|
private
|
62
|
-
|
63
60
|
def template
|
64
61
|
return "Resources" => {
|
65
62
|
@instance_name => {
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Cloudster
|
2
|
+
#==ElasticIp resource
|
3
|
+
class ElasticIp
|
4
|
+
|
5
|
+
# Initialize an ElasticIp
|
6
|
+
#
|
7
|
+
# ==== Notes
|
8
|
+
# options parameter must include values for :name
|
9
|
+
#
|
10
|
+
# ==== Examples
|
11
|
+
# elastic_ip = Cloudster::ElasticIp.new(:name => 'ElasticIp')
|
12
|
+
#
|
13
|
+
# ==== Parameters
|
14
|
+
# * options<~Hash> -
|
15
|
+
# * :name: String containing the name of ElastiCache resource
|
16
|
+
def initialize(options = {})
|
17
|
+
require_options(options, [:name])
|
18
|
+
@name = options[:name]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Merges the required CloudFormation template for adding an ElasticIp to an EC2 instance
|
22
|
+
#
|
23
|
+
#
|
24
|
+
# ==== Examples
|
25
|
+
# elastic_ip = Cloudster::ElasticIp.new(:name => 'AppServerEIp')
|
26
|
+
# ec2 = Cloudster::Ec2.new(
|
27
|
+
# :name => 'AppServer',
|
28
|
+
# :key_name => 'mykey',
|
29
|
+
# :image_id => 'ami_image_id',
|
30
|
+
# :instance_type => 't1.micro'
|
31
|
+
# )
|
32
|
+
#
|
33
|
+
# elastic_ip.add_to ec2
|
34
|
+
#
|
35
|
+
# ==== Parameters
|
36
|
+
# * instance of EC2
|
37
|
+
def add_to(ec2)
|
38
|
+
ec2_template = ec2.template
|
39
|
+
@instance_name = ec2.name
|
40
|
+
elastic_ip_template = template
|
41
|
+
ec2.template.deep_merge(elastic_ip_template)
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def template
|
46
|
+
return "Resources" => {
|
47
|
+
@name => {
|
48
|
+
"Type" => "AWS::EC2::EIP",
|
49
|
+
"Properties" => {
|
50
|
+
"InstanceId" => {
|
51
|
+
"Ref" => @instance_name
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -21,7 +21,7 @@ module Cloudster
|
|
21
21
|
# :node_type => 'cache.t1.micro',
|
22
22
|
# :cache_security_group_names => ['default'],
|
23
23
|
# :engine => 'memcached',
|
24
|
-
# :node_count => 3
|
24
|
+
# :node_count => 3
|
25
25
|
# )
|
26
26
|
|
27
27
|
def initialize(options = {})
|
@@ -41,7 +41,7 @@ module Cloudster
|
|
41
41
|
# :node_type => 'cache.t1.micro',
|
42
42
|
# :cache_security_group_names => ['default'],
|
43
43
|
# :engine => 'memcached',
|
44
|
-
# :node_count => 3
|
44
|
+
# :node_count => 3
|
45
45
|
# )
|
46
46
|
# elasticache.template
|
47
47
|
#
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cloudster::ChefClient do
|
4
|
+
describe 'initialize' do
|
5
|
+
it "should raise argument error if no argument is not provided" do
|
6
|
+
expect { Cloudster::ElasticIp.new() }.to raise_error(ArgumentError, 'Missing required argument: name')
|
7
|
+
end
|
8
|
+
it "should not raise argument error if all arguments are provided" do
|
9
|
+
expect { Cloudster::ElasticIp.new(:name => 'ElasticIp') }.to_not raise_error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
describe '#add_to' do
|
13
|
+
it "should add elastic ip configuration to ec2 template" do
|
14
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'AppServer', :instance_type => 't1.micro' )
|
15
|
+
elastic_ip = Cloudster::ElasticIp.new(:name => 'ElasticIp')
|
16
|
+
elastic_ip.add_to ec2
|
17
|
+
ec2.template.should ==
|
18
|
+
{
|
19
|
+
"Resources"=>{
|
20
|
+
"AppServer"=>{
|
21
|
+
"Type"=>"AWS::EC2::Instance",
|
22
|
+
"Properties"=>{
|
23
|
+
"KeyName"=>"testkey",
|
24
|
+
"ImageId"=>"image_id",
|
25
|
+
"InstanceType"=>"t1.micro",
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"ElasticIp"=>{
|
29
|
+
"Type"=>"AWS::EC2::EIP",
|
30
|
+
"Properties"=>{
|
31
|
+
"InstanceId"=> {
|
32
|
+
"Ref" => "AppServer"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/cloudster/cloud.rb
|
135
135
|
- lib/cloudster/deep_merge.rb
|
136
136
|
- lib/cloudster/ec2.rb
|
137
|
+
- lib/cloudster/elastic_ip.rb
|
137
138
|
- lib/cloudster/elasticache.rb
|
138
139
|
- lib/cloudster/elb.rb
|
139
140
|
- lib/cloudster/options_manager.rb
|
@@ -142,6 +143,7 @@ files:
|
|
142
143
|
- spec/chef_client_spec.rb
|
143
144
|
- spec/cloud_spec.rb
|
144
145
|
- spec/ec2_spec.rb
|
146
|
+
- spec/elastic_ip_spec.rb
|
145
147
|
- spec/elasticache_spec.rb
|
146
148
|
- spec/elb_spec.rb
|
147
149
|
- spec/rds_spec.rb
|
@@ -162,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
164
|
version: '0'
|
163
165
|
segments:
|
164
166
|
- 0
|
165
|
-
hash:
|
167
|
+
hash: 648278835
|
166
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
169
|
none: false
|
168
170
|
requirements:
|