auser-poolparty 0.2.56 → 0.2.57
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -0
- data/bin/cloud-ensure-provisioning +3 -1
- data/bin/cloud-refresh +1 -0
- data/lib/erlang/messenger/include/defines.hrl +1 -1
- data/lib/poolparty.rb +25 -5
- data/lib/poolparty/base_packages/haproxy.rb +2 -2
- data/lib/poolparty/base_packages/poolparty.rb +1 -1
- data/lib/poolparty/helpers/provisioner_base.rb +2 -2
- data/lib/poolparty/helpers/provisioners/master.rb +1 -0
- data/lib/poolparty/helpers/provisioners/slave.rb +2 -2
- data/lib/poolparty/net/remote_bases/ec2.rb +8 -3
- data/lib/poolparty/pool/base.rb +1 -1
- data/lib/poolparty/pool/cloud.rb +2 -2
- data/lib/poolparty/templates/poolparty.monitor +1 -1
- data/lib/poolparty/version.rb +1 -1
- data/poolparty.gemspec +4 -2
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +1 -1
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +17 -1
- data/spec/poolparty/pool/base_spec.rb +2 -2
- data/spec/poolparty/spec_helper.rb +1 -1
- metadata +4 -2
data/Manifest.txt
CHANGED
@@ -23,7 +23,9 @@ o.loaded_clouds.each do |cloud|
|
|
23
23
|
s << "/usr/sbin/puppetca --clean #{node}.compute-1.internal"
|
24
24
|
s << "/usr/sbin/puppetca --clean #{node}.ec2.internal"
|
25
25
|
end.join(";")
|
26
|
-
|
26
|
+
cmd = ". /etc/profile && #{str};cloud-provision -i #{node.gsub(/node/, '')};#{str}"
|
27
|
+
vputs "Executing #{cmd}"
|
28
|
+
`#{cmd}`
|
27
29
|
end
|
28
30
|
# @tp.join
|
29
31
|
end
|
data/bin/cloud-refresh
CHANGED
data/lib/poolparty.rb
CHANGED
@@ -7,15 +7,35 @@ require 'rubygems'
|
|
7
7
|
require lib
|
8
8
|
rescue Exception => e
|
9
9
|
@required_software << lib
|
10
|
-
puts "Could not find library #{lib}: #{e}"
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
13
|
unless @required_software.empty?
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
@num_lines = 45
|
15
|
+
@centered_lines = @num_lines - 4
|
16
|
+
def wrap_cline(line)
|
17
|
+
"* #{line.center(@centered_lines)} *"
|
18
|
+
end
|
19
|
+
def wrap_lline(line)
|
20
|
+
"* #{line.ljust(@centered_lines)} *"
|
21
|
+
end
|
22
|
+
def header
|
23
|
+
"*"*@num_lines
|
24
|
+
end
|
25
|
+
empty_line = "* #{" ".ljust(@centered_lines)} *"
|
26
|
+
# error_initializing_message.txt
|
27
|
+
puts header
|
28
|
+
puts wrap_cline("Error")
|
29
|
+
puts wrap_lline("Missing required software")
|
30
|
+
puts @required_software.map {|a| wrap_lline(" #{a}") }
|
31
|
+
puts wrap_lline("Please install the required software")
|
32
|
+
puts wrap_lline("and try again")
|
33
|
+
puts empty_line
|
34
|
+
puts wrap_lline("Try installing #{@required_software.size == 1 ? "it" : "them"} with")
|
35
|
+
puts @required_software.map {|a| wrap_lline(" gem install #{a}") }
|
36
|
+
puts empty_line
|
37
|
+
puts "*"*@num_lines
|
38
|
+
exit(0)
|
19
39
|
end
|
20
40
|
|
21
41
|
# Use active supports auto load mechanism
|
@@ -11,8 +11,8 @@ module PoolParty
|
|
11
11
|
|
12
12
|
# Template variables
|
13
13
|
has_variable(:name => "name_haproxy", :value => "#{cloud.name}")
|
14
|
-
has_variable(:name => "nodenames_haproxy", :value => "generate('/usr/bin/env', '/
|
15
|
-
has_variable(:name => "node_ips_haproxy", :value => "generate('/usr/bin/env', '/
|
14
|
+
has_variable(:name => "nodenames_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'name')")
|
15
|
+
has_variable(:name => "node_ips_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'ip')")
|
16
16
|
|
17
17
|
has_variable(:name => "ports_haproxy", :value => ([(self.respond_to?(:port) ? port : Base.port)].flatten))
|
18
18
|
has_variable(:name => "forwarding_port", :value => (respond_to?(:forwarding_port) ? forwarding_port : Base.forwarding_port))
|
@@ -72,7 +72,7 @@ module PoolParty
|
|
72
72
|
requires get_gempackage("poolparty")
|
73
73
|
command(". /etc/profile && cloud-handle-load")
|
74
74
|
end
|
75
|
-
has_cron(:name => "provisioning ensurer", :user => Base.user, :minute => "*/
|
75
|
+
has_cron(:name => "provisioning ensurer", :user => Base.user, :minute => "*/2") do
|
76
76
|
requires get_gempackage("poolparty")
|
77
77
|
command ". /etc/profile && cloud-ensure-provisioning"
|
78
78
|
end
|
@@ -100,7 +100,7 @@ module PoolParty
|
|
100
100
|
process_clean_reconfigure_for!(@instance, testing)
|
101
101
|
|
102
102
|
vputs "Logging in and running provisioning on #{@instance.name}"
|
103
|
-
cmd = "cd #{Base.remote_storage_path} && chmod +x install_#{name}.sh && /bin/sh install_#{name}.sh; rm install_#{name}.sh"
|
103
|
+
cmd = "cd #{Base.remote_storage_path} && /bin/chmod +x install_#{name}.sh && /bin/sh install_#{name}.sh; /bin/rm install_#{name}.sh"
|
104
104
|
verbose ? @cloud.run_command_on(cmd, @instance) : hide_output {@cloud.run_command_on(cmd, @instance)}
|
105
105
|
|
106
106
|
process_clean_reconfigure_for!(@instance, testing)
|
@@ -134,7 +134,7 @@ module PoolParty
|
|
134
134
|
vputs "Logging on to #{@instance.ip}"
|
135
135
|
@cloud.rsync_storage_files_to(@instance)
|
136
136
|
|
137
|
-
cmd = "cd #{Base.remote_storage_path} && chmod +x configure_#{name}.sh && /bin/sh configure_#{name}.sh && rm configure_#{name}.sh"
|
137
|
+
cmd = "cd #{Base.remote_storage_path} && /bin/chmod +x configure_#{name}.sh && /bin/sh configure_#{name}.sh && /bin/rm configure_#{name}.sh"
|
138
138
|
verbose ? @cloud.run_command_on(cmd, @instance) : hide_output {@cloud.run_command_on(cmd, @instance)}
|
139
139
|
end
|
140
140
|
end
|
@@ -129,6 +129,7 @@ ps aux | grep puppetmaster | awk '{print $2}' | xargs kill #{unix_hide_string} #
|
|
129
129
|
rm -rf /etc/puppet/ssl
|
130
130
|
# Start it back up
|
131
131
|
puppetmasterd --verbose
|
132
|
+
/usr/bin/puppetcleaner
|
132
133
|
# /etc/init.d/puppetmaster start #{unix_hide_string}
|
133
134
|
EOS
|
134
135
|
end
|
@@ -34,7 +34,7 @@ module PoolParty
|
|
34
34
|
def run_once_and_clean
|
35
35
|
<<-EOS
|
36
36
|
rm -rf /etc/puppet/ssl
|
37
|
-
. /etc/profile && /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master #{unix_hide_string}
|
37
|
+
. /etc/profile && /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master #{unix_hide_string} &
|
38
38
|
rm -rf /etc/puppet/ssl
|
39
39
|
EOS
|
40
40
|
end
|
@@ -43,7 +43,7 @@ rm -rf /etc/puppet/ssl
|
|
43
43
|
# puppetd --listen --fqdn #{@instance.name}
|
44
44
|
def start_puppet
|
45
45
|
<<-EOS
|
46
|
-
. /etc/profile && /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master #{unix_hide_string}
|
46
|
+
. /etc/profile && /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master #{unix_hide_string} &
|
47
47
|
EOS
|
48
48
|
end
|
49
49
|
|
@@ -1,9 +1,13 @@
|
|
1
1
|
begin
|
2
2
|
require 'EC2'
|
3
|
+
require "date"
|
3
4
|
class String
|
4
5
|
def convert_from_ec2_to_ip
|
5
6
|
self.gsub(/.compute-1.amazonaws.com*/, '').gsub(/ec2-/, '').gsub(/-/, '.')
|
6
7
|
end
|
8
|
+
def parse_datetime
|
9
|
+
DateTime.parse( self.chomp ) rescue self
|
10
|
+
end
|
7
11
|
end
|
8
12
|
module PoolParty
|
9
13
|
module Ec2
|
@@ -44,13 +48,14 @@ begin
|
|
44
48
|
h.merge!({
|
45
49
|
:name => @name,
|
46
50
|
:hostname => h[:ip],
|
47
|
-
:ip => h[:ip].convert_from_ec2_to_ip
|
51
|
+
:ip => h[:ip].convert_from_ec2_to_ip,
|
52
|
+
:launching_time => (h[:launching_time].parse_datetime)
|
48
53
|
})
|
49
54
|
end
|
50
55
|
end
|
51
56
|
# Get the s3 description for the response in a hash format
|
52
57
|
def get_instances_description
|
53
|
-
EC2ResponseObject.get_descriptions(ec2.describe_instances).sort_by {|a| a[:launching_time]}
|
58
|
+
EC2ResponseObject.get_descriptions(ec2.describe_instances).sort_by {|a| a[:launching_time] }
|
54
59
|
end
|
55
60
|
|
56
61
|
def after_launch_master(instance=nil)
|
@@ -146,7 +151,7 @@ begin
|
|
146
151
|
end
|
147
152
|
rs
|
148
153
|
end
|
149
|
-
def self.get_hash_from_response(resp)
|
154
|
+
def self.get_hash_from_response(resp)
|
150
155
|
begin
|
151
156
|
{
|
152
157
|
:instance_id => resp.instanceId,
|
data/lib/poolparty/pool/base.rb
CHANGED
@@ -12,7 +12,7 @@ module PoolParty
|
|
12
12
|
default_options({
|
13
13
|
:environment => "production",
|
14
14
|
:user => "root", # This should change here
|
15
|
-
:base_keypair_path => "
|
15
|
+
:base_keypair_path => "#{ENV["HOME"]}/.ec2",
|
16
16
|
:tmp_path => "/tmp/poolparty",
|
17
17
|
:remote_storage_path => "/var/poolparty",
|
18
18
|
:remote_gem_path => "/var/poolparty/gems",
|
data/lib/poolparty/pool/cloud.rb
CHANGED
@@ -33,8 +33,8 @@ module PoolParty
|
|
33
33
|
default_options({
|
34
34
|
:minimum_instances => 2,
|
35
35
|
:maximum_instances => 5,
|
36
|
-
:contract_when => "cpu < 0.
|
37
|
-
:expand_when => "cpu >
|
36
|
+
:contract_when => "cpu < 0.65",
|
37
|
+
:expand_when => "cpu > 1.9",
|
38
38
|
:access_key => Base.access_key,
|
39
39
|
:secret_access_key => Base.secret_access_key,
|
40
40
|
:ec2_dir => ENV["EC2_HOME"],
|
data/lib/poolparty/version.rb
CHANGED
data/poolparty.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poolparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-13 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -77,6 +77,7 @@ executables:
|
|
77
77
|
- pool
|
78
78
|
- pool-console
|
79
79
|
- pool-describe
|
80
|
+
- pool-init
|
80
81
|
- pool-list
|
81
82
|
- pool-spec
|
82
83
|
- pool-start
|
@@ -132,6 +133,7 @@ files:
|
|
132
133
|
- bin/pool
|
133
134
|
- bin/pool-console
|
134
135
|
- bin/pool-describe
|
136
|
+
- bin/pool-init
|
135
137
|
- bin/pool-list
|
136
138
|
- bin/pool-spec
|
137
139
|
- bin/pool-start
|
@@ -73,7 +73,7 @@ describe "CloudResourcer" do
|
|
73
73
|
@tc.respond_to?(:keypair_path).should == true
|
74
74
|
end
|
75
75
|
it "should set the keypair to the Base.keypair_path" do
|
76
|
-
@tc.keypair_path.should =~
|
76
|
+
@tc.keypair_path.should =~ /\.ec2\/rangerbob/
|
77
77
|
end
|
78
78
|
it "should set the keypair to have the keypair set" do
|
79
79
|
@tc.keypair.should =~ /rangerbob/
|
@@ -13,7 +13,9 @@ class TestClass
|
|
13
13
|
|
14
14
|
def ami;"ami-abc123";end
|
15
15
|
def size; "small";end
|
16
|
-
|
16
|
+
def verbose
|
17
|
+
false
|
18
|
+
end
|
17
19
|
def ec2
|
18
20
|
@ec2 ||= EC2::Base.new( :access_key_id => "not_an_access_key", :secret_access_key => "not_a_secret_access_key")
|
19
21
|
end
|
@@ -32,6 +34,20 @@ describe "ec2 remote base" do
|
|
32
34
|
end
|
33
35
|
EOE
|
34
36
|
end
|
37
|
+
describe "helpers" do
|
38
|
+
it "should be able to convert an ec2 ip to a real ip" do
|
39
|
+
"ec2-72-44-36-12.compute-1.amazonaws.com".convert_from_ec2_to_ip.should == "72.44.36.12"
|
40
|
+
end
|
41
|
+
it "should not throw an error if another string is returned" do
|
42
|
+
"72.44.36.12".convert_from_ec2_to_ip.should == "72.44.36.12"
|
43
|
+
end
|
44
|
+
it "should be able to parse the date from the timestamp" do
|
45
|
+
"2008-11-13T09:33:09+0000".parse_datetime.should == DateTime.parse("2008-11-13T09:33:09+0000")
|
46
|
+
end
|
47
|
+
it "should rescue itself and just return the string if it fails" do
|
48
|
+
"thisisthedate".parse_datetime.should == "thisisthedate"
|
49
|
+
end
|
50
|
+
end
|
35
51
|
describe "launching" do
|
36
52
|
before(:each) do
|
37
53
|
@tr.ec2.stub!(:run_instances).and_return true
|
@@ -11,8 +11,8 @@ describe "Base" do
|
|
11
11
|
it "should set the user to root" do
|
12
12
|
Base.user.should == "root"
|
13
13
|
end
|
14
|
-
it "should set the base keypair path to
|
15
|
-
Base.base_keypair_path.should
|
14
|
+
it "should set the base keypair path to $HOME/.ec2" do
|
15
|
+
Base.base_keypair_path.should =~ /\.ec2/
|
16
16
|
end
|
17
17
|
it "should set the storage_directory to the tmp directory of the current working directory" do
|
18
18
|
Base.storage_directory.should =~ /tmp/
|
@@ -121,7 +121,7 @@ def remove_stub_instance_from(o, num)
|
|
121
121
|
# o.stub!(:remote_instances_list).once.and_return ris
|
122
122
|
end
|
123
123
|
def stub_instance(num=1, status="running", keypair="fake_keypair")
|
124
|
-
{:name => "node#{num}", :ip => "192.168.0.#{num}", :status => "#{status}", :launching_time => num.minutes.ago, :keypair => "#{keypair}"}
|
124
|
+
{:name => "node#{num}", :ip => "192.168.0.#{num}", :status => "#{status}", :launching_time => num.minutes.ago.to_s, :keypair => "#{keypair}"}
|
125
125
|
end
|
126
126
|
def drop_pending_instances_for(o)
|
127
127
|
puts "hi"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auser-poolparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-13 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -77,6 +77,7 @@ executables:
|
|
77
77
|
- pool
|
78
78
|
- pool-console
|
79
79
|
- pool-describe
|
80
|
+
- pool-init
|
80
81
|
- pool-list
|
81
82
|
- pool-spec
|
82
83
|
- pool-start
|
@@ -132,6 +133,7 @@ files:
|
|
132
133
|
- bin/pool
|
133
134
|
- bin/pool-console
|
134
135
|
- bin/pool-describe
|
136
|
+
- bin/pool-init
|
135
137
|
- bin/pool-list
|
136
138
|
- bin/pool-spec
|
137
139
|
- bin/pool-start
|