auser-poolparty 0.2.16 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +72 -7
- data/PostInstall.txt +1 -1
- data/Rakefile +11 -0
- data/bin/cloud-provision +6 -10
- data/bin/server-build-messenger +20 -0
- data/bin/server-fire-cmd +0 -2
- data/bin/server-list-responding +24 -0
- data/bin/server-start-master +4 -9
- data/bin/server-start-node +7 -6
- data/lib/erlang/messenger/Emakefile +1 -0
- data/lib/erlang/messenger/Rakefile +29 -20
- data/lib/erlang/messenger/ebin/master_app.beam +0 -0
- data/lib/erlang/messenger/ebin/node_app.beam +0 -0
- data/lib/erlang/messenger/ebin/packager.app +19 -0
- data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_event_handler.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +1 -7
- data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +1 -7
- data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
- data/lib/erlang/messenger/ebin/utils.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/AUTHORS +2 -0
- data/lib/erlang/messenger/lib/eunit/CHANGELOG +14 -0
- data/lib/erlang/messenger/lib/eunit/COPYING +504 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
- data/lib/erlang/messenger/lib/eunit/NOTES +276 -0
- data/lib/erlang/messenger/lib/eunit/README +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/edoc-info +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/erlang.png +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/eunit.html +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/index.html +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/modules-frame.html +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview-summary.html +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview.edoc +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/packages-frame.html +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/stylesheet.css +55 -0
- data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.app +21 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.appup +1 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/examples/eunit_examples.erl +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/fib.erl +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/tests.txt +1 -0
- data/lib/erlang/messenger/lib/eunit/include/eunit.hrl +313 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
- data/lib/erlang/messenger/lib/eunit/src/autoload.erl +388 -0
- data/lib/erlang/messenger/lib/eunit/src/code_monitor.erl +243 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.app.src +21 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.appup.src +1 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.erl +196 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl +102 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_data.erl +798 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl +48 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_lib.erl +682 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_proc.erl +552 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_serial.erl +157 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_server.erl +340 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl +64 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_test.erl +334 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tests.erl +45 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tty.erl +272 -0
- data/lib/erlang/messenger/lib/eunit/src/file_monitor.erl +409 -0
- data/lib/erlang/messenger/lib/eunit/sys.config +9 -0
- data/lib/erlang/messenger/lib/eunit/vsn.mk +1 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +75 -2
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +75 -2
- data/lib/erlang/messenger/src/pm_client.erl +8 -3
- data/lib/erlang/messenger/src/pm_cluster.erl +32 -9
- data/lib/erlang/messenger/src/pm_master.erl +10 -11
- data/lib/erlang/messenger/src/pm_node.erl +2 -3
- data/lib/erlang/messenger/src/pm_packager.erl +73 -0
- data/lib/erlang/messenger/src/utils.erl +3 -10
- data/lib/poolparty/base_packages/heartbeat.rb +9 -9
- data/lib/poolparty/base_packages/poolparty.rb +16 -10
- data/lib/poolparty/config/allowed_commands.yml +1 -0
- data/lib/poolparty/core/object.rb +8 -0
- data/lib/poolparty/exceptions/UnacceptableCommand.rb +5 -0
- data/lib/poolparty/helpers/messenger.rb +29 -0
- data/lib/poolparty/helpers/provisioner_base.rb +7 -7
- data/lib/poolparty/helpers/provisioners/master.rb +3 -7
- data/lib/poolparty/helpers/provisioners/slave.rb +1 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +7 -5
- data/lib/poolparty/modules/configurable.rb +1 -1
- data/lib/poolparty/modules/method_missing_sugar.rb +6 -1
- data/lib/poolparty/modules/pretty_printer.rb +1 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +2 -1
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
- data/lib/poolparty/net/remoter.rb +3 -1
- data/lib/poolparty/plugins/git.rb +3 -3
- data/lib/poolparty/pool/base.rb +7 -2
- data/lib/poolparty/pool/cloud.rb +3 -3
- data/lib/poolparty/pool/resource.rb +38 -24
- data/lib/poolparty/pool/resources/class_package.rb +2 -2
- data/lib/poolparty/pool/resources/conditional.rb +8 -4
- data/lib/poolparty/pool/resources/{gem.rb → gem_package.rb} +0 -0
- data/lib/poolparty/pool/resources/package.rb +8 -1
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +1 -1
- data/poolparty.gemspec +476 -61
- data/spec/poolparty/core/object_spec.rb +20 -0
- data/spec/poolparty/helpers/messenger_spec.rb +14 -0
- data/spec/poolparty/helpers/provisioners/master_spec.rb +2 -2
- data/spec/poolparty/net/remoter_spec.rb +1 -1
- data/spec/poolparty/plugins/git_spec.rb +26 -19
- data/spec/poolparty/pool/base_spec.rb +20 -2
- data/spec/poolparty/pool/cloud_spec.rb +256 -249
- data/spec/poolparty/pool/custom_resource_spec.rb +6 -1
- data/spec/poolparty/pool/plugin_spec.rb +71 -65
- data/spec/poolparty/pool/resource_spec.rb +314 -237
- data/spec/poolparty/pool/resources/class_package_spec.rb +71 -66
- data/spec/poolparty/pool/resources/conditional_spec.rb +30 -26
- data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
- data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
- data/spec/poolparty/pool/script_spec.rb +46 -37
- data/spec/poolparty/spec_helper.rb +4 -0
- data/tasks/cloud.rake +0 -54
- data/tasks/development.rake +11 -14
- data/tasks/ec2.rake +10 -17
- data/tasks/instance.rake +0 -61
- data/website/index.html +1 -1
- metadata +83 -10
@@ -4,81 +4,86 @@ include PoolParty::Resources
|
|
4
4
|
|
5
5
|
describe "File" do
|
6
6
|
before(:each) do
|
7
|
-
|
8
|
-
@class = PoolParty::Resources::Classpackage.new({:name => "rockstar"})
|
7
|
+
reset_resources!
|
9
8
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
9
|
+
describe "wrapped" do
|
10
|
+
before(:each) do
|
11
|
+
reset!
|
12
|
+
@class = PoolParty::Resources::Classpackage.new({:name => "rockstar"})
|
13
|
+
end
|
14
|
+
it "should have a method resources" do
|
15
|
+
@class.respond_to?(:resources).should == true
|
16
|
+
end
|
17
|
+
it "should store the resources in an array" do
|
18
|
+
@class.resources.class.should == Hash
|
19
|
+
end
|
20
|
+
describe "with resources" do
|
21
|
+
before(:each) do
|
22
|
+
cloud :application_cloud do
|
23
|
+
classpackage do
|
24
|
+
file({:name => "red"})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@class = cloud(:application_cloud).resource(:classpackage).first
|
28
|
+
end
|
29
|
+
it "should store a resource in the resources array" do
|
30
|
+
@class.resources.size.should == 1
|
31
|
+
end
|
32
|
+
it "should have a file resource in the cloud" do
|
33
|
+
@class.resource(:file).should_not == nil
|
34
|
+
end
|
35
|
+
describe "to_s" do
|
36
|
+
before(:each) do
|
37
|
+
@class.instance_eval do
|
38
|
+
name "rockstar"
|
39
|
+
file({:name => "red"}) do; end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
it "should output the class with the name as class [name]" do
|
43
|
+
@class.to_string.should =~ /class rockstar/
|
44
|
+
end
|
45
|
+
after do
|
46
|
+
@class.to_string
|
47
|
+
end
|
21
48
|
end
|
22
49
|
end
|
23
|
-
@class = cloud(:application_cloud).resource(:classpackage).first
|
24
|
-
end
|
25
|
-
it "should store a resource in the resources array" do
|
26
|
-
@class.resources.size.should == 1
|
27
50
|
end
|
28
|
-
|
29
|
-
@class.resource(:file).should_not == nil
|
30
|
-
end
|
31
|
-
describe "to_s" do
|
51
|
+
describe "setting with a block" do
|
32
52
|
before(:each) do
|
33
|
-
@
|
34
|
-
name "
|
35
|
-
file({:name => "
|
53
|
+
@class1 = classpackage do
|
54
|
+
name "my_class"
|
55
|
+
file({:name => "frank"})
|
36
56
|
end
|
37
57
|
end
|
38
|
-
it "should
|
39
|
-
@
|
58
|
+
it "should set the name when set" do
|
59
|
+
@class1.name.should == "my_class"
|
40
60
|
end
|
41
|
-
|
42
|
-
@
|
61
|
+
it "should have the file resource in the resources class" do
|
62
|
+
@class1.resources.size.should_not be_zero
|
63
|
+
end
|
64
|
+
it "should have the file resource in the resources array" do
|
65
|
+
@class1.resource(:file).class.should == Array
|
66
|
+
end
|
67
|
+
it "should store the file in the resources array" do
|
68
|
+
@class1.resource(:file).get_named("frank").first.name.should == "frank"
|
43
69
|
end
|
44
70
|
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
it "should store the file in the resources array" do
|
64
|
-
@class1.resource(:file).get_named("frank").first.name.should == "frank"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
describe "from a collection of resources to another" do
|
68
|
-
before(:each) do
|
69
|
-
self.stub!(:options).and_return({:name => "cook"})
|
70
|
-
file(:name => "franksfile")
|
71
|
-
exec(:name => "get file", :command => "kill frank for file")
|
72
|
-
end
|
73
|
-
it "should have the method classpackage_with_self" do
|
74
|
-
self.respond_to?(:classpackage_with_self).should == true
|
75
|
-
end
|
76
|
-
it "should transfer the resources to the class" do
|
77
|
-
@class2 = classpackage_with_self(self)
|
78
|
-
@class2.resources.should_not be_empty
|
79
|
-
end
|
80
|
-
it "should leave zero resources on the parent" do
|
81
|
-
@class2 = classpackage_with_self(self)
|
82
|
-
resources.should be_empty
|
71
|
+
describe "from a collection of resources to another" do
|
72
|
+
before(:each) do
|
73
|
+
self.stub!(:options).and_return({:name => "cook"})
|
74
|
+
file(:name => "franksfile")
|
75
|
+
exec(:name => "get file", :command => "kill frank for file")
|
76
|
+
end
|
77
|
+
it "should have the method classpackage_with_self" do
|
78
|
+
self.respond_to?(:classpackage_with_self).should == true
|
79
|
+
end
|
80
|
+
it "should transfer the resources to the class" do
|
81
|
+
@class2 = classpackage_with_self(self)
|
82
|
+
@class2.resources.should_not be_empty
|
83
|
+
end
|
84
|
+
it "should leave zero resources on the parent" do
|
85
|
+
@class2 = classpackage_with_self(self)
|
86
|
+
resources.should be_empty
|
87
|
+
end
|
83
88
|
end
|
84
89
|
end
|
@@ -4,35 +4,39 @@ include PoolParty::Resources
|
|
4
4
|
|
5
5
|
describe "Conditional" do
|
6
6
|
before(:each) do
|
7
|
-
|
8
|
-
@cloud.instance_eval do
|
9
|
-
execute_if("$hostname", "'master'", self) do
|
10
|
-
file({:name => "/etc/apache2/puppetmaster.conf"})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
@cond = @cloud.resource(:conditional).first
|
14
|
-
end
|
15
|
-
it "should add the block of resources on the parent" do
|
16
|
-
@cloud.resources.size.should == 1
|
17
|
-
end
|
18
|
-
it "should have a conditional in the resources" do
|
19
|
-
@cloud.resource(:conditional).first.name.should == "$hostname == 'master'"
|
7
|
+
reset_resources!
|
20
8
|
end
|
21
|
-
|
22
|
-
@cond.resources.size.should == 1
|
23
|
-
end
|
24
|
-
it "should have a file resource on the conditional" do
|
25
|
-
@cond.resource(:file).first.name.should == "/etc/apache2/puppetmaster.conf"
|
26
|
-
end
|
27
|
-
it "should have the parent as the cloud" do
|
28
|
-
@cond.parent.should == @cloud
|
29
|
-
end
|
30
|
-
describe "to_string" do
|
9
|
+
describe "wrapped" do
|
31
10
|
before(:each) do
|
32
|
-
@
|
11
|
+
@cloud = cloud :conditional_cloud_spec do
|
12
|
+
execute_if("$hostname", "'master'", self) do
|
13
|
+
has_file({:name => "/etc/apache2/puppetmaster2.conf"})
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@cond = @cloud.get_resource(:conditional, "$hostname == 'master'")
|
33
17
|
end
|
34
|
-
it "should
|
35
|
-
@
|
18
|
+
it "should add the block of resources on the parent" do
|
19
|
+
@cloud.resources.size.should == 1
|
20
|
+
end
|
21
|
+
it "should have a conditional in the resources" do
|
22
|
+
@cond.name.should == "$hostname == 'master'"
|
23
|
+
end
|
24
|
+
it "should push the resources onto the conditional resource" do
|
25
|
+
@cond.resources.size.should == 1
|
26
|
+
end
|
27
|
+
it "should have a file resource on the conditional" do
|
28
|
+
@cond.get_resource(:file, "/etc/apache2/puppetmaster2.conf").name.should == "/etc/apache2/puppetmaster2.conf"
|
29
|
+
end
|
30
|
+
it "should have the parent as the cloud" do
|
31
|
+
@cond.parent.should == @cloud
|
32
|
+
end
|
33
|
+
describe "to_string" do
|
34
|
+
before(:each) do
|
35
|
+
@string = @cond.to_string
|
36
|
+
end
|
37
|
+
it "should have a case statement for the hostname" do
|
38
|
+
@string.should =~ /case \$hostname/
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -10,7 +10,7 @@ describe "Gem" do
|
|
10
10
|
has_gempackage(:name => "rails")
|
11
11
|
end
|
12
12
|
end
|
13
|
-
@gem = @cloud.
|
13
|
+
@gem = @cloud.get_resource(:gempackage, "activesupport")
|
14
14
|
end
|
15
15
|
it "should have a package" do
|
16
16
|
@cloud.resource(:gempackage).should_not be_empty
|
@@ -19,24 +19,28 @@ describe "Gem" do
|
|
19
19
|
@gem.name.should == "activesupport"
|
20
20
|
end
|
21
21
|
it "should have the 'rails' gem in the packages" do
|
22
|
-
@cloud.
|
22
|
+
@cloud.get_resource(:gempackage, "activesupport").to_string.should =~ /activesupport/
|
23
23
|
end
|
24
24
|
describe "with parent options" do
|
25
25
|
before(:each) do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
reset_resources!
|
27
|
+
end
|
28
|
+
describe "reset" do
|
29
|
+
before(:each) do
|
30
|
+
@cloud1 = cloud :gem_version_cloud do
|
31
|
+
has_gempackage(:name => "ParseTree", :version => "2.2.0") do
|
32
|
+
has_gempackage(:name => "edge-rails")
|
33
|
+
end
|
30
34
|
end
|
35
|
+
@gem = @cloud1.resource(:gempackage).first
|
36
|
+
@gem2 = @gem.resource(:gempackage).first
|
37
|
+
end
|
38
|
+
it "should have the version set on the parent" do
|
39
|
+
@gem.version.should == "2.2.0"
|
40
|
+
end
|
41
|
+
it "should not take the version of the parent on the child" do
|
42
|
+
@gem.resource(:gempackage).first.version.should == nil
|
31
43
|
end
|
32
|
-
@gem = @cloud1.resource(:gempackage).first
|
33
|
-
@gem2 = @gem.resource(:gempackage).first
|
34
|
-
end
|
35
|
-
it "should have the version set on the parent" do
|
36
|
-
@gem.version.should == "2.2.0"
|
37
|
-
end
|
38
|
-
it "should not take the version of the parent on the child" do
|
39
|
-
@gem2.version.should == nil
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -1,50 +1,59 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
+
include PoolParty::Resources
|
4
|
+
|
3
5
|
describe "Script" do
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
it "should have inflate_file as an instance method" do
|
8
|
-
Script.respond_to?(:inflate_file).should == true
|
6
|
+
before(:each) do
|
7
|
+
reset_resources!
|
9
8
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
describe "with a script" do
|
15
|
-
before(:each) do
|
16
|
-
@script = 'script'
|
17
|
-
@filename = 'filename'
|
18
|
-
|
19
|
-
@pool = Script.new
|
20
|
-
Script.stub!(:new).and_return(@pool)
|
21
|
-
@pool.stub!(:inflate).and_return true
|
9
|
+
describe "wrapped" do
|
10
|
+
it "should have inflate as a class method" do
|
11
|
+
Script.respond_to?(:inflate).should == true
|
22
12
|
end
|
23
|
-
|
24
|
-
|
25
|
-
Script.should_receive(:new).and_return @pool
|
26
|
-
end
|
27
|
-
it "should instance eval the script" do
|
28
|
-
@pool.should_receive(:instance_eval).with(@script, @filename).and_return true
|
13
|
+
it "should have inflate_file as an instance method" do
|
14
|
+
Script.respond_to?(:inflate_file).should == true
|
29
15
|
end
|
30
|
-
it "should
|
31
|
-
|
16
|
+
it "should have inflate as an instance method" do
|
17
|
+
Script.new.respond_to?(:inflate).should == true
|
32
18
|
end
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
describe "save!" do
|
19
|
+
|
20
|
+
describe "with a script" do
|
37
21
|
before(:each) do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
@script = 'script'
|
23
|
+
@filename = 'filename'
|
24
|
+
|
25
|
+
@pool = Script.new
|
26
|
+
Script.stub!(:new).and_return(@pool)
|
27
|
+
@pool.stub!(:inflate).and_return true
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create a new Script when calling on the class method" do
|
31
|
+
Script.should_receive(:new).and_return @pool
|
32
|
+
end
|
33
|
+
it "should instance eval the script" do
|
34
|
+
@pool.should_receive(:instance_eval).with(@script, @filename).and_return true
|
35
|
+
end
|
36
|
+
it "should call inflate on itself" do
|
37
|
+
@pool.should_receive(:inflate).and_return true
|
38
|
+
end
|
39
|
+
after do
|
40
|
+
Script.inflate(@script, @filename)
|
41
|
+
end
|
42
|
+
describe "save!" do
|
43
|
+
before(:each) do
|
44
|
+
reset!
|
45
|
+
reset_resources!
|
46
|
+
pool :appdotcom do
|
47
|
+
keypair "snoodle"
|
48
|
+
cloud :app do
|
49
|
+
has_file :name => "/etc/httpd/httpd.conf"
|
50
|
+
end
|
42
51
|
end
|
52
|
+
@saved = Script.save!(false)
|
53
|
+
end
|
54
|
+
it "should save the keypair" do
|
55
|
+
@saved.should =~ /keypair "snoodle"/
|
43
56
|
end
|
44
|
-
@saved = Script.save!(false)
|
45
|
-
end
|
46
|
-
it "should save the keypair" do
|
47
|
-
@saved.should =~ /keypair "snoodle"/
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
data/tasks/cloud.rake
CHANGED
@@ -1,57 +1,3 @@
|
|
1
1
|
# Cloud tasks
|
2
2
|
namespace(:cloud) do
|
3
|
-
# Setup
|
4
|
-
task :init do
|
5
|
-
setup_application
|
6
|
-
raise Exception.new("You must specify your access_key and secret_access_key") unless Base.access_key && Base.secret_access_key
|
7
|
-
end
|
8
|
-
# Install the stack on all of the nodes
|
9
|
-
desc "Prepare all servers"
|
10
|
-
task :prepare => :init do
|
11
|
-
PoolParty::Master.new.nodes.each do |node|
|
12
|
-
node.install
|
13
|
-
end
|
14
|
-
end
|
15
|
-
# Start the cloud
|
16
|
-
desc "Start the cloud"
|
17
|
-
task :start => :init do
|
18
|
-
PoolParty::Master.new.start_cloud!
|
19
|
-
end
|
20
|
-
# Reload the cloud with the new updated data
|
21
|
-
desc "Reload all instances with updated data"
|
22
|
-
task :reload => :init do
|
23
|
-
PoolParty::Master.new.nodes.each do |node|
|
24
|
-
node.configure
|
25
|
-
node.restart_with_monit
|
26
|
-
end
|
27
|
-
end
|
28
|
-
# List the cloud
|
29
|
-
desc "List cloud"
|
30
|
-
task :list => :init do
|
31
|
-
puts PoolParty::Master.new.list
|
32
|
-
end
|
33
|
-
# Shutdown the cloud
|
34
|
-
desc "Shutdown the entire cloud"
|
35
|
-
task :shutdown => :init do
|
36
|
-
PoolParty::Master.new.request_termination_of_all_instances
|
37
|
-
end
|
38
|
-
# Watch the cloud and scale it if necessary
|
39
|
-
desc "Watch the cloud and maintain it"
|
40
|
-
task :scale => :init do
|
41
|
-
begin
|
42
|
-
PoolParty::Master.new.scale_cloud!
|
43
|
-
rescue Exception => e
|
44
|
-
puts "There was an error scaling the cloud: #{e}"
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
# Maintain the cloud in a background process
|
49
|
-
desc "Maintain the cloud (run on the master)"
|
50
|
-
task :maintain => :init do
|
51
|
-
begin
|
52
|
-
PoolParty::Master.new.start_monitor!
|
53
|
-
rescue Exception => e
|
54
|
-
puts "There was an error starting the monitor: #{e}"
|
55
|
-
end
|
56
|
-
end
|
57
3
|
end
|
data/tasks/development.rake
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
namespace(:dev) do
|
2
2
|
task :initialize do
|
3
|
-
|
4
|
-
run "mkdir ~/.ec2 >/dev/null 2>/dev/null" unless File.directory?("~/.ec2")
|
3
|
+
Kernel.system"mkdir ~/.ec2 >/dev/null 2>/dev/null" unless File.directory?("~/.ec2")
|
5
4
|
end
|
6
5
|
# Setup a basic development environment for the user
|
7
6
|
desc "Setup development environment specify the config_file"
|
@@ -56,18 +55,6 @@ To work on this cloud, source the file like:
|
|
56
55
|
end
|
57
56
|
desc "initialize setup"
|
58
57
|
task :init => [:setup_pemkeys]
|
59
|
-
|
60
|
-
desc "Just an argv test"
|
61
|
-
task :test => :initialize do
|
62
|
-
puts "---- Testing ----"
|
63
|
-
puts PoolParty.options(ARGV.dup)
|
64
|
-
puts "Using keypair at: #{Base.keypair_path}"
|
65
|
-
end
|
66
|
-
desc "Installation listing"
|
67
|
-
task :list_install => :initialize do
|
68
|
-
puts "-- packages to install --"
|
69
|
-
Provider.install_PoolParty(true)
|
70
|
-
end
|
71
58
|
desc "Authorize base ports for application"
|
72
59
|
task :authorize_ports => :initialize do
|
73
60
|
run <<-EOR
|
@@ -75,4 +62,14 @@ To work on this cloud, source the file like:
|
|
75
62
|
ec2-authorize -p 80 default
|
76
63
|
EOR
|
77
64
|
end
|
65
|
+
desc "Turn the gemspec into a yaml file"
|
66
|
+
task :gemspec_to_yaml => [:initialize, :gemspec] do
|
67
|
+
filepath = ::File.join(::File.dirname(__FILE__), "..", "poolparty.gemspec")
|
68
|
+
data = open(filepath).read
|
69
|
+
spec = eval("$SAFE = 3\n#{data}")
|
70
|
+
yml = YAML.dump spec
|
71
|
+
File.open(filepath, "w+") do |f|
|
72
|
+
f << yml
|
73
|
+
end
|
74
|
+
end
|
78
75
|
end
|
data/tasks/ec2.rake
CHANGED
@@ -1,20 +1,13 @@
|
|
1
|
-
namespace(:ec2) do
|
1
|
+
namespace(:ec2) do
|
2
|
+
desc "Prepare your cloud for poolparty"
|
2
3
|
task :init do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
desc "Stop all running instances"
|
12
|
-
task :stop_running_instances => [:init] do
|
13
|
-
Thread.new {`ec2-describe-instances | grep INSTANCE | grep running | awk '{print $2}' | xargs ec2-terminate-instances`}
|
14
|
-
end
|
15
|
-
# Reboot the instances via commandline
|
16
|
-
desc "Restart all running instances"
|
17
|
-
task :restart_running_instances => [:init] do
|
18
|
-
Thread.new {`ec2-describe-instances | grep INSTANCE | grep running | awk '{print $2}' | xargs ec2-reboot-instances`}
|
4
|
+
cmd =<<-EOE
|
5
|
+
ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0
|
6
|
+
ec2-authorize -p 7000-7050 default
|
7
|
+
ec2-authorize -p 8140 default
|
8
|
+
ec2-authorize -p 4369 default
|
9
|
+
EOE
|
10
|
+
|
11
|
+
Kernel.system cmd.split(/\n/).join(" && ")
|
19
12
|
end
|
20
13
|
end
|
data/tasks/instance.rake
CHANGED
@@ -1,63 +1,2 @@
|
|
1
1
|
namespace(:instance) do
|
2
|
-
# Find the instance we want to deal with
|
3
|
-
# interface can be: num=0, i=0, inst=0, 0
|
4
|
-
# defaults to the master instance (0)
|
5
|
-
task :init do
|
6
|
-
num = (ENV['num'] || ENV["i"] || ENV["inst"] || ARGV.shift || 0).to_i
|
7
|
-
raise Exception.new("Please set the number of the instance (i.e. num=1, i=1, or as an argument)") unless num
|
8
|
-
@node = PoolParty::Master.new.get_node(num)
|
9
|
-
end
|
10
|
-
# Ssh into the node
|
11
|
-
desc "Remotely login to the remote instance"
|
12
|
-
task :ssh => [:init] do
|
13
|
-
@node.ssh
|
14
|
-
end
|
15
|
-
desc "Send a file to the remote instance"
|
16
|
-
task :exec => :init do
|
17
|
-
@node.ssh ENV['cmd']
|
18
|
-
end
|
19
|
-
# Send a file to the remote instance
|
20
|
-
# as designated by src='' and dest=''
|
21
|
-
desc "Send a file to the remote instance"
|
22
|
-
task :scp => :init do
|
23
|
-
@node.scp ENV['src'], ENV['dest']
|
24
|
-
end
|
25
|
-
# Execute a command on the remote instance as designated
|
26
|
-
# by cmd=''
|
27
|
-
desc "Execute cmd on a remote instance"
|
28
|
-
task :exec => [:init] do
|
29
|
-
cmd = ENV['cmd'] || "ls -l"
|
30
|
-
puts @node.ssh(cmd.runnable)
|
31
|
-
end
|
32
|
-
# Restart all the services monitored by monit
|
33
|
-
desc "Restart all the services"
|
34
|
-
task :reload => [:init] do
|
35
|
-
@node.restart_with_monit
|
36
|
-
end
|
37
|
-
# Start all the services monitored by monit
|
38
|
-
desc "Start all services"
|
39
|
-
task :load => [:init] do
|
40
|
-
@node.start_with_monit
|
41
|
-
end
|
42
|
-
# Stop the services monitored by monit
|
43
|
-
desc "Stop all services"
|
44
|
-
task :stop => [:init] do
|
45
|
-
@node.stop_with_monit
|
46
|
-
end
|
47
|
-
# Install the required services on this node
|
48
|
-
desc "Install stack on this node"
|
49
|
-
task :install => :init do
|
50
|
-
@node.install
|
51
|
-
end
|
52
|
-
# Turnoff this instance
|
53
|
-
desc "Teardown instance"
|
54
|
-
task :shutdown => :init do
|
55
|
-
`ec2-terminate-instances #{@node.instance_id}`
|
56
|
-
end
|
57
|
-
# Configure this node and start the services
|
58
|
-
desc "Configure the stack on this node"
|
59
|
-
task :configure => :init do
|
60
|
-
@node.configure
|
61
|
-
@node.restart_with_monit
|
62
|
-
end
|
63
2
|
end
|
data/website/index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<h1>PoolParty</h1>
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/poolparty"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.
|
37
|
+
<a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.20</a>
|
38
38
|
</div>
|
39
39
|
<h1>‘Easy cloud computing’</h1>
|
40
40
|
<h2>What</h2>
|