loe-iclassify-interface 1.0.9 → 1.0.10
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/VERSION +1 -1
- data/iclassify-interface.gemspec +7 -2
- data/lib/iclassify-interface.rb +1 -2
- data/recipes/00_facter.rb +7 -0
- data/recipes/01_default_class.rb +1 -0
- data/recipes/02_ec2.rb +27 -0
- data/recipes/02_mongrel_server.rb +17 -0
- data/recipes/03_mysql_server.rb +13 -0
- metadata +6 -1
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.10
|
data/iclassify-interface.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{iclassify-interface}
|
|
5
|
-
s.version = "1.0.
|
|
5
|
+
s.version = "1.0.10"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["W. Andrew Loe III"]
|
|
@@ -24,7 +24,12 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
"lib/iclassify-interface.rb",
|
|
25
25
|
"lib/iclassify-interface/agent.rb",
|
|
26
26
|
"lib/iclassify-interface/client.rb",
|
|
27
|
-
"lib/iclassify-interface/node.rb"
|
|
27
|
+
"lib/iclassify-interface/node.rb",
|
|
28
|
+
"recipes/00_facter.rb",
|
|
29
|
+
"recipes/01_default_class.rb",
|
|
30
|
+
"recipes/02_ec2.rb",
|
|
31
|
+
"recipes/02_mongrel_server.rb",
|
|
32
|
+
"recipes/03_mysql_server.rb"
|
|
28
33
|
]
|
|
29
34
|
s.homepage = %q{http://github.com/loe/iclassify-interface}
|
|
30
35
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/lib/iclassify-interface.rb
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
add_tag("base") unless tag?("base")
|
data/recipes/02_ec2.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
|
|
3
|
+
ec2 = false
|
|
4
|
+
domain = attrib?('domain')
|
|
5
|
+
ec2 = true if domain =~ /(\.amazonaws.com|compute-1.internal)$/
|
|
6
|
+
|
|
7
|
+
if ec2
|
|
8
|
+
replace_attrib("ec2", "true")
|
|
9
|
+
else
|
|
10
|
+
replace_attrib("ec2", "false")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get_from_ec2(thing="/")
|
|
14
|
+
base_url = "http://169.254.169.254/latest/meta-data" + thing
|
|
15
|
+
url = URI.parse(base_url)
|
|
16
|
+
req = Net::HTTP::Get.new(url.path)
|
|
17
|
+
res = Net::HTTP.start(url.host, url.port) {|http|
|
|
18
|
+
http.request(req)
|
|
19
|
+
}
|
|
20
|
+
res.body
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if ec2
|
|
24
|
+
get_from_ec2.split("\n").each do |key|
|
|
25
|
+
add_attrib("ec2-#{key}", get_from_ec2("/#{key}"))
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
mongrel_size = 120
|
|
2
|
+
head_room = 512
|
|
3
|
+
|
|
4
|
+
total_memory = attrib?("memorysize")
|
|
5
|
+
if total_memory
|
|
6
|
+
if total_memory =~ /MB$/
|
|
7
|
+
total_memory.gsub!(/ MB/, '')
|
|
8
|
+
total_memory = total_memory.to_f
|
|
9
|
+
else
|
|
10
|
+
total_memory.gsub!(/ GB/, '')
|
|
11
|
+
total_memory = total_memory.to_f * 1024
|
|
12
|
+
end
|
|
13
|
+
available_memory = total_memory - head_room
|
|
14
|
+
total_mongrels = available_memory / mongrel_size
|
|
15
|
+
add_attrib("mongrel_servers", total_mongrels.to_i) unless attrib?("mongrel_servers")
|
|
16
|
+
add_attrib("mongrel_port_number", 5000) unless attrib?("mongrel_port_number")
|
|
17
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
total_memory = attrib?("memorysize")
|
|
2
|
+
if total_memory
|
|
3
|
+
if total_memory =~ /MB$/
|
|
4
|
+
total_memory.gsub!(/ MB/, '')
|
|
5
|
+
total_memory = total_memory.to_f
|
|
6
|
+
else
|
|
7
|
+
total_memory.gsub!(/ GB/, '')
|
|
8
|
+
total_memory = total_memory.to_f * 1024
|
|
9
|
+
end
|
|
10
|
+
buffer_pool_size = total_memory * 0.75
|
|
11
|
+
buffer_pool_size = buffer_pool_size.to_i
|
|
12
|
+
add_attrib("innodb_buffer_pool_size", buffer_pool_size.to_s + "M") unless attrib?("innodb_buffer_pool_size")
|
|
13
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: loe-iclassify-interface
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- W. Andrew Loe III
|
|
@@ -75,6 +75,11 @@ files:
|
|
|
75
75
|
- lib/iclassify-interface/agent.rb
|
|
76
76
|
- lib/iclassify-interface/client.rb
|
|
77
77
|
- lib/iclassify-interface/node.rb
|
|
78
|
+
- recipes/00_facter.rb
|
|
79
|
+
- recipes/01_default_class.rb
|
|
80
|
+
- recipes/02_ec2.rb
|
|
81
|
+
- recipes/02_mongrel_server.rb
|
|
82
|
+
- recipes/03_mysql_server.rb
|
|
78
83
|
has_rdoc: false
|
|
79
84
|
homepage: http://github.com/loe/iclassify-interface
|
|
80
85
|
post_install_message:
|