poolparty 0.0.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +25 -0
- data/License.txt +20 -0
- data/Manifest.txt +203 -0
- data/PostInstall.txt +18 -0
- data/README.txt +21 -82
- data/Rakefile +25 -18
- data/bin/cloud +31 -0
- data/bin/cloud-add-keypair +23 -0
- data/bin/cloud-configure +31 -0
- data/bin/cloud-contract +27 -0
- data/bin/cloud-expand +27 -0
- data/bin/cloud-list +32 -0
- data/bin/cloud-maintain +36 -0
- data/bin/cloud-osxcopy +22 -0
- data/bin/cloud-provision +31 -0
- data/bin/cloud-refresh +26 -0
- data/bin/cloud-ssh +18 -0
- data/bin/cloud-start +32 -0
- data/bin/cloud-terminate +23 -0
- data/bin/pool +25 -27
- data/bin/pool-console +12 -0
- data/bin/pool-describe +9 -0
- data/bin/pool-list +28 -0
- data/bin/pool-provision +34 -0
- data/bin/pool-spec +17 -0
- data/bin/pool-start +32 -0
- data/bin/pool-start-monitor +1 -0
- data/config/hoe.rb +115 -0
- data/config/requirements.rb +15 -0
- data/examples/basic.rb +20 -0
- data/examples/plugin_without_plugin_directory.rb +13 -0
- data/examples/poolparty.rb +12 -0
- data/examples/with_apache_plugin.rb +22 -0
- data/generators/poolspec/USAGE +5 -0
- data/generators/poolspec/poolspec_generator.rb +65 -0
- data/generators/poolspec/templates/pool_spec_template.erb +9 -0
- data/lib/erlang/eb_server.erl +27 -0
- data/lib/poolparty.rb +56 -0
- data/lib/poolparty/base_packages/haproxy.rb +42 -0
- data/lib/poolparty/base_packages/heartbeat.rb +45 -0
- data/lib/poolparty/base_packages/poolparty.rb +36 -0
- data/lib/poolparty/base_packages/ruby.rb +43 -0
- data/lib/poolparty/core/array.rb +24 -0
- data/lib/{core → poolparty/core}/exception.rb +0 -0
- data/lib/poolparty/core/float.rb +13 -0
- data/lib/poolparty/core/hash.rb +29 -0
- data/lib/poolparty/core/kernel.rb +37 -0
- data/lib/{core → poolparty/core}/module.rb +18 -0
- data/lib/poolparty/core/my_open_struct.rb +18 -0
- data/lib/poolparty/core/object.rb +54 -0
- data/lib/poolparty/core/proc.rb +7 -0
- data/lib/poolparty/core/string.rb +72 -0
- data/lib/poolparty/core/symbol.rb +8 -0
- data/lib/{core → poolparty/core}/time.rb +15 -0
- data/lib/poolparty/exceptions/RemoteException.rb +12 -0
- data/lib/poolparty/exceptions/ResourceException.rb +7 -0
- data/lib/poolparty/exceptions/RuntimeException.rb +7 -0
- data/lib/poolparty/exceptions/SpecException.rb +7 -0
- data/lib/poolparty/exceptions/TemplateNotFound.rb +7 -0
- data/lib/poolparty/helpers/binary.rb +31 -0
- data/lib/poolparty/helpers/console.rb +30 -0
- data/lib/poolparty/helpers/display.rb +34 -0
- data/lib/poolparty/helpers/optioner.rb +64 -0
- data/lib/poolparty/helpers/provisioner_base.rb +250 -0
- data/lib/poolparty/helpers/provisioners/master.rb +136 -0
- data/lib/poolparty/helpers/provisioners/slave.rb +44 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +89 -0
- data/lib/poolparty/modules/configurable.rb +34 -0
- data/lib/poolparty/modules/definable_resource.rb +59 -0
- data/lib/poolparty/modules/file_writer.rb +55 -0
- data/lib/poolparty/modules/method_missing_sugar.rb +53 -0
- data/lib/poolparty/modules/output.rb +13 -0
- data/lib/poolparty/modules/pretty_printer.rb +39 -0
- data/lib/{core/string.rb → poolparty/modules/s3_string.rb} +5 -22
- data/lib/{modules → poolparty/modules}/safe_instance.rb +0 -0
- data/lib/poolparty/monitors/base_monitor.rb +16 -0
- data/lib/poolparty/net/remote.rb +35 -0
- data/lib/poolparty/net/remote_bases/ec2.rb +148 -0
- data/lib/poolparty/net/remote_instance.rb +69 -0
- data/lib/poolparty/net/remoter.rb +224 -0
- data/lib/poolparty/net/remoter_base.rb +117 -0
- data/lib/poolparty/plugins/gem_package.rb +17 -0
- data/lib/poolparty/plugins/git.rb +41 -0
- data/lib/poolparty/plugins/line.rb +76 -0
- data/lib/poolparty/plugins/svn.rb +48 -0
- data/lib/poolparty/pool/base.rb +75 -0
- data/lib/poolparty/pool/cloud.rb +164 -0
- data/lib/poolparty/pool/custom_resource.rb +61 -0
- data/lib/poolparty/pool/loggable.rb +29 -0
- data/lib/poolparty/pool/plugin.rb +41 -0
- data/lib/poolparty/pool/plugin_model.rb +48 -0
- data/lib/poolparty/pool/pool.rb +55 -0
- data/lib/poolparty/pool/resource.rb +248 -0
- data/lib/poolparty/pool/resources/class_package.rb +64 -0
- data/lib/poolparty/pool/resources/conditional.rb +41 -0
- data/lib/poolparty/pool/resources/cron.rb +14 -0
- data/lib/poolparty/pool/resources/directory.rb +23 -0
- data/lib/poolparty/pool/resources/exec.rb +26 -0
- data/lib/poolparty/pool/resources/file.rb +23 -0
- data/lib/poolparty/pool/resources/gem.rb +14 -0
- data/lib/poolparty/pool/resources/host.rb +14 -0
- data/lib/poolparty/pool/resources/package.rb +14 -0
- data/lib/poolparty/pool/resources/remote_file.rb +22 -0
- data/lib/poolparty/pool/resources/service.rb +21 -0
- data/lib/poolparty/pool/resources/sshkey.rb +19 -0
- data/lib/poolparty/pool/resources/variable.rb +27 -0
- data/lib/poolparty/pool/script.rb +44 -0
- data/lib/poolparty/templates/authkeys +2 -0
- data/{config/monit/nginx.monit.conf → lib/poolparty/templates/cib.xml} +0 -0
- data/lib/poolparty/templates/fileserver.conf +4 -0
- data/lib/poolparty/templates/gem +25 -0
- data/{config/heartbeat.conf → lib/poolparty/templates/ha.cf} +3 -2
- data/{config → lib/poolparty/templates}/haproxy.conf +13 -6
- data/lib/poolparty/templates/namespaceauth.conf +19 -0
- data/lib/poolparty/templates/puppet.conf +17 -0
- data/lib/poolparty/version.rb +9 -0
- data/lib/poolpartycl.rb +3 -0
- data/poolparty.gemspec +56 -47
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/poolparty/base_packages/haproxy_spec.rb +13 -0
- data/spec/poolparty/base_packages/heartbeat_spec.rb +30 -0
- data/spec/poolparty/bin/console_spec.rb +80 -0
- data/spec/poolparty/core/array_spec.rb +26 -0
- data/spec/poolparty/core/float.rb +13 -0
- data/spec/poolparty/core/hash_spec.rb +63 -0
- data/spec/poolparty/core/kernel_spec.rb +24 -0
- data/spec/poolparty/core/module_spec.rb +15 -0
- data/spec/poolparty/core/object_spec.rb +40 -0
- data/spec/poolparty/core/string_spec.rb +152 -0
- data/spec/poolparty/core/time_spec.rb +52 -0
- data/spec/poolparty/helpers/binary_spec.rb +26 -0
- data/spec/poolparty/helpers/display_spec.rb +13 -0
- data/spec/poolparty/helpers/optioner_spec.rb +39 -0
- data/spec/poolparty/helpers/provisioner_base_spec.rb +121 -0
- data/spec/poolparty/helpers/provisioners/master_spec.rb +54 -0
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +28 -0
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +135 -0
- data/spec/poolparty/modules/configurable_spec.rb +26 -0
- data/spec/poolparty/modules/definable_resource.rb +9 -0
- data/spec/poolparty/modules/file_writer_spec.rb +49 -0
- data/spec/poolparty/modules/s3_string_spec.rb +15 -0
- data/spec/poolparty/modules/tmp/willy/nilly.rb +1 -0
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +92 -0
- data/spec/poolparty/net/remote_instance_spec.rb +70 -0
- data/spec/poolparty/net/remote_spec.rb +286 -0
- data/spec/poolparty/net/remoter_base_spec.rb +80 -0
- data/spec/poolparty/net/remoter_spec.rb +191 -0
- data/spec/poolparty/plugins/git_spec.rb +33 -0
- data/spec/poolparty/plugins/line_spec.rb +16 -0
- data/spec/poolparty/plugins/svn_spec.rb +16 -0
- data/spec/poolparty/pool/base_spec.rb +108 -0
- data/spec/poolparty/pool/cloud_spec.rb +299 -0
- data/spec/poolparty/pool/configurers/files/ruby_basic.rb +17 -0
- data/spec/poolparty/pool/configurers/files/ruby_plugins.rb +16 -0
- data/spec/poolparty/pool/configurers/ruby_spec.rb +58 -0
- data/spec/poolparty/pool/custom_resource_spec.rb +115 -0
- data/spec/poolparty/pool/example_spec.rb +112 -0
- data/spec/poolparty/pool/plugin_model_spec.rb +63 -0
- data/spec/poolparty/pool/plugin_spec.rb +85 -0
- data/spec/poolparty/pool/pool_spec.rb +83 -0
- data/spec/poolparty/pool/resource_spec.rb +224 -0
- data/spec/poolparty/pool/resources/class_package_spec.rb +84 -0
- data/spec/poolparty/pool/resources/conditional_spec.rb +38 -0
- data/spec/poolparty/pool/resources/cron_spec.rb +49 -0
- data/spec/poolparty/pool/resources/directory_spec.rb +40 -0
- data/spec/poolparty/pool/resources/exec_spec.rb +37 -0
- data/spec/poolparty/pool/resources/file_spec.rb +40 -0
- data/spec/poolparty/pool/resources/gem_spec.rb +16 -0
- data/spec/poolparty/pool/resources/host_spec.rb +28 -0
- data/spec/poolparty/pool/resources/package_spec.rb +44 -0
- data/spec/poolparty/pool/resources/remote_file_spec.rb +40 -0
- data/spec/poolparty/pool/resources/service_spec.rb +45 -0
- data/spec/poolparty/pool/resources/sshkey_spec.rb +48 -0
- data/spec/poolparty/pool/resources/variable_spec.rb +20 -0
- data/spec/poolparty/pool/script_spec.rb +51 -0
- data/spec/poolparty/pool/test_plugins/sshkey_test +2 -0
- data/{test/test_pool_party.rb → spec/poolparty/pool/test_plugins/virtual_host_template.erb} +0 -0
- data/spec/poolparty/pool/test_plugins/webserver.rb +46 -0
- data/spec/poolparty/poolparty_spec.rb +33 -0
- data/spec/poolparty/spec_helper.rb +120 -0
- data/tasks/cloud.rake +57 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/development.rake +78 -0
- data/tasks/ec2.rake +20 -0
- data/tasks/environment.rake +7 -0
- data/tasks/instance.rake +63 -0
- data/tasks/server.rake +42 -0
- data/tasks/spec.rake +17 -0
- data/tasks/website.rake +17 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_helper.rb +2 -0
- data/test/test_pool_spec_generator.rb +47 -0
- data/test/test_poolparty.rb +11 -0
- data/test_manifest.pp +538 -0
- data/website/index.html +107 -0
- data/website/index.txt +95 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/code.css +29 -0
- data/website/stylesheets/screen.css +147 -0
- data/website/template.html.erb +49 -0
- metadata +282 -101
- data/CHANGELOG +0 -4
- data/Manifest +0 -55
- data/bin/instance +0 -54
- data/config/config.yml +0 -23
- data/config/create_proxy_ami.sh +0 -582
- data/config/heartbeat_authkeys.conf +0 -2
- data/config/monit.conf +0 -8
- data/config/monit/haproxy.monit.conf +0 -7
- data/config/nginx.conf +0 -24
- data/lib/core/array.rb +0 -10
- data/lib/core/kernel.rb +0 -9
- data/lib/core/object.rb +0 -14
- data/lib/modules/callback.rb +0 -55
- data/lib/modules/ec2_wrapper.rb +0 -74
- data/lib/pool_party.rb +0 -69
- data/lib/pool_party/application.rb +0 -133
- data/lib/pool_party/init.rb +0 -4
- data/lib/pool_party/master.rb +0 -189
- data/lib/pool_party/monitors.rb +0 -13
- data/lib/pool_party/monitors/cpu.rb +0 -18
- data/lib/pool_party/monitors/memory.rb +0 -21
- data/lib/pool_party/monitors/web.rb +0 -18
- data/lib/pool_party/optioner.rb +0 -16
- data/lib/pool_party/os.rb +0 -11
- data/lib/pool_party/os/ubuntu.rb +0 -78
- data/lib/pool_party/remote_instance.rb +0 -180
- data/lib/pool_party/remoting.rb +0 -112
- data/lib/pool_party/scheduler.rb +0 -93
- data/lib/pool_party/tasks.rb +0 -220
- data/lib/s3/s3_object_store_folders.rb +0 -44
- data/spec/application_spec.rb +0 -32
- data/spec/callback_spec.rb +0 -65
- data/spec/helpers/ec2_mock.rb +0 -56
- data/spec/helpers/remote_instance_mock.rb +0 -11
- data/spec/kernel_spec.rb +0 -11
- data/spec/master_spec.rb +0 -147
- data/spec/monitor_spec.rb +0 -16
- data/spec/optioner_spec.rb +0 -22
- data/spec/poolparty_spec.rb +0 -8
- data/spec/remote_instance_spec.rb +0 -29
- data/spec/remoting_spec.rb +0 -75
- data/spec/spec_helper.rb +0 -38
- data/spec/string_spec.rb +0 -28
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
7
|
+
end
|
8
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
9
|
+
|
10
|
+
@location = o.location ? o.location : "remote"
|
11
|
+
|
12
|
+
include Remote
|
13
|
+
|
14
|
+
@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
|
15
|
+
|
16
|
+
@clouds.each do |name, cloud|
|
17
|
+
|
18
|
+
with_cloud(cloud, {:location => @location}) do
|
19
|
+
logger.info header("Creating keypair for #{name}")
|
20
|
+
create_keypair unless testing
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/bin/cloud-configure
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-c [master|slaves|all]', '--class [master|slaves|all]', 'Provision class (default: all)') { |c| optioner.provision_class c }
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@provision_class = o.provision_class || "all"
|
12
|
+
|
13
|
+
include Remote
|
14
|
+
|
15
|
+
@clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
|
16
|
+
|
17
|
+
@clouds.each do |name, cloud|
|
18
|
+
|
19
|
+
with_cloud(cloud, {:testing => o.testing, :location => @location, :provision_class => @provision_class}) do
|
20
|
+
|
21
|
+
hide_output do
|
22
|
+
if provision_class == "master" || provision_class == "all"
|
23
|
+
Provisioner.configure_master(self, testing)
|
24
|
+
end
|
25
|
+
if provision_class == "slave" || provision_class == "all"
|
26
|
+
Provisioner.configure_slaves(self, testing)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
clear_base_directory unless testing
|
30
|
+
end
|
31
|
+
end
|
data/bin/cloud-contract
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
|
6
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@testing = o.testing
|
12
|
+
|
13
|
+
include Remote
|
14
|
+
|
15
|
+
begin
|
16
|
+
@cloud = cloud(o.cloudname.downcase.to_sym)
|
17
|
+
rescue
|
18
|
+
puts "Cloud name required. Please specify it with -n name"
|
19
|
+
exit(0)
|
20
|
+
end
|
21
|
+
|
22
|
+
with_cloud(@cloud, {:testing => @testing}) do
|
23
|
+
puts header("Contracting cloud #{name}")
|
24
|
+
puts "#{list_of_running_instances.size} running instances (#{minimum_instances} minimum instances)"
|
25
|
+
puts testing ? "Not contracting (test mode)" : "Contracting the cloud if possible"
|
26
|
+
contract_cloud_if_necessary( !testing )
|
27
|
+
end
|
data/bin/cloud-expand
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
|
6
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@testing = o.testing
|
12
|
+
|
13
|
+
include Remote
|
14
|
+
|
15
|
+
begin
|
16
|
+
@cloud = cloud(o.cloudname.downcase.to_sym)
|
17
|
+
rescue
|
18
|
+
puts "Cloud name required. Please specify it with -n name"
|
19
|
+
exit(0)
|
20
|
+
end
|
21
|
+
|
22
|
+
with_cloud(@cloud, {:testing => @testing}) do
|
23
|
+
puts header("Expanding cloud #{name}")
|
24
|
+
puts "#{list_of_running_instances.size} running instances of #{maximum_instances} possible instances"
|
25
|
+
puts testing ? "Not expanding (test mode)" : "Expanding the cloud"
|
26
|
+
expand_cloud_if_necessary( !testing )
|
27
|
+
end
|
data/bin/cloud-list
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)') { |o| optioner.location o }
|
7
|
+
opts.on('-r', '--remote', 'Remote listing') { optioner.location "remote" }
|
8
|
+
opts.on('-l', '--local', 'Local listing') { optioner.location "local" }
|
9
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
10
|
+
end
|
11
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
12
|
+
|
13
|
+
@location = o.location ? o.location : "remote"
|
14
|
+
|
15
|
+
include Remote
|
16
|
+
|
17
|
+
@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
|
18
|
+
|
19
|
+
@clouds.each do |name, cloud|
|
20
|
+
|
21
|
+
with_cloud(cloud, {:location => @location}) do
|
22
|
+
puts header("Listing cloud #{name}")
|
23
|
+
puts subheader("Active instances")
|
24
|
+
puts list_of_running_instances.map{|a| a.to_s}.join("\n")
|
25
|
+
puts ""
|
26
|
+
if list_of_pending_instances.size > 0
|
27
|
+
puts subheader("Pending instances")
|
28
|
+
puts list_of_pending_instances.map{|a| a.to_s}.join("\n")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/bin/cloud-maintain
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)') { |o| optioner.location o }
|
7
|
+
opts.on('-r', '--remote', 'Remote listing') { optioner.location "remote" }
|
8
|
+
opts.on('-l', '--local', 'Local listing') { optioner.location "local" }
|
9
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
10
|
+
end
|
11
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
12
|
+
|
13
|
+
@location = o.location ? o.location : "remote"
|
14
|
+
|
15
|
+
include Remote
|
16
|
+
|
17
|
+
@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
|
18
|
+
|
19
|
+
@clouds.each do |name, cloud|
|
20
|
+
|
21
|
+
with_cloud(cloud, {:location => @location, :testing => o.testing}) do
|
22
|
+
logger.info header("Maintaining cloud #{name}")
|
23
|
+
if !minimum_number_of_instances_are_running?
|
24
|
+
logger.warn "#{list_of_running_instances.size} running instances of between #{minimum_instances} and #{maximum_instances}"
|
25
|
+
logger.warn "Launching new instance"
|
26
|
+
expand_cloud_if_necessary( !testing )
|
27
|
+
elsif !maximum_number_of_instances_are_not_running?
|
28
|
+
logger.warn "#{list_of_running_instances.size} running instances of between #{minimum_instances} and #{maximum_instances}"
|
29
|
+
logger.warn "Shutting down non-master instance"
|
30
|
+
contract_cloud_if_necessary( !testing )
|
31
|
+
else
|
32
|
+
logger.info "Cloud is maintained"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/bin/cloud-osxcopy
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
7
|
+
end
|
8
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
9
|
+
|
10
|
+
@location = o.location ? o.location : "remote"
|
11
|
+
|
12
|
+
include Remote
|
13
|
+
|
14
|
+
@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
|
15
|
+
|
16
|
+
@clouds.each do |name, cloud|
|
17
|
+
|
18
|
+
with_cloud(cloud, {:location => @location}) do
|
19
|
+
Kernel.system "echo #{master.ip.chomp} | pbcopy"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/bin/cloud-provision
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-c [master|slaves|all]', '--class [master|slaves|all]', 'Provision class (default: all)') { |c| optioner.provision_class c }
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
|
10
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
11
|
+
|
12
|
+
@provision_class = o.provision_class || "all"
|
13
|
+
|
14
|
+
include Remote
|
15
|
+
|
16
|
+
@clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
|
17
|
+
|
18
|
+
@clouds.each do |name, cloud|
|
19
|
+
|
20
|
+
with_cloud(cloud, {:testing => o.testing, :location => @location, :provision_class => @provision_class}) do
|
21
|
+
|
22
|
+
if provision_class == "master" || provision_class == "all"
|
23
|
+
Provisioner.provision_master(self, testing)
|
24
|
+
end
|
25
|
+
if provision_class == "slave" || provision_class == "all"
|
26
|
+
Provisioner.provision_slaves(self, testing)
|
27
|
+
end
|
28
|
+
|
29
|
+
clear_base_directory unless testing
|
30
|
+
end
|
31
|
+
end
|
data/bin/cloud-refresh
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
|
6
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@provision_class = o.provision_class || "all"
|
12
|
+
|
13
|
+
include Remote
|
14
|
+
|
15
|
+
@clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
|
16
|
+
|
17
|
+
@clouds.each do |name, cloud|
|
18
|
+
|
19
|
+
with_cloud(cloud, {:testing => o.testing}) do
|
20
|
+
cmd = <<-EOE
|
21
|
+
puppetrun --host #{list_of_node_names.join(", --host ")}
|
22
|
+
EOE
|
23
|
+
run_command_on(cmd.runnable, master)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/bin/cloud-ssh
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
7
|
+
opts.on('-i num', '--id num', 'Instance num to ssh (default: 0)') { |i| optioner.num i }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
unless o.cloudname && clouds.keys.size > 1
|
12
|
+
@cloud = cloud(o.cloudname.downcase.to_sym)
|
13
|
+
else
|
14
|
+
puts "Error: You must indicate a cloud from which your instance is from"
|
15
|
+
exit(0)
|
16
|
+
end
|
17
|
+
|
18
|
+
instance = @cloud.ssh_into_instance_number( o.num.to_i || 0 )
|
data/bin/cloud-start
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-c cloudname', '--cloud name', 'Start cloud by this name') { |c| optioner.cloudname c }
|
7
|
+
end
|
8
|
+
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@testing = o.testing
|
12
|
+
|
13
|
+
@clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
|
14
|
+
|
15
|
+
@clouds.each do |name, cloud|
|
16
|
+
|
17
|
+
with_cloud(cloud, {:testing => @testing}) do
|
18
|
+
puts header("Starting cloud")
|
19
|
+
puts "#{list_of_running_instances.size} running instances (#{minimum_instances} - #{maximum_instances})"
|
20
|
+
if (minimum_instances - list_of_running_instances.size) > 0
|
21
|
+
puts "Starting the master instance"
|
22
|
+
if testing
|
23
|
+
puts("\tNot launching while in testing mode")
|
24
|
+
else
|
25
|
+
launch_and_configure_master!
|
26
|
+
# run_command_on("puppetd --test", master)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
clear_base_directory unless testing
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/bin/cloud-terminate
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-c [master|slaves|all]', '--class [master|slaves|all]', 'Provision class (default: all)') { |c| optioner.provision_class c }
|
7
|
+
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
|
8
|
+
end
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@clouds = o.cloudname ? {:cloud => cloud(o.cloudname.downcase.to_sym)} : clouds
|
12
|
+
|
13
|
+
@clouds.each do |name, cloud|
|
14
|
+
|
15
|
+
with_cloud(cloud, {:testing => o.testing, :location => @location, :provision_class => @provision_class}) do
|
16
|
+
|
17
|
+
list_of_running_instances.each do |inst|
|
18
|
+
puts "Shutting down #{inst.instance_id}"
|
19
|
+
terminate_instance!(inst.instance_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/bin/pool
CHANGED
@@ -1,33 +1,31 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
require
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
4
5
|
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
master = PoolParty::Master.new
|
9
|
-
|
10
|
-
# if list.empty?
|
11
|
-
# puts "Usage: pool [options] {start|stop|list|maintain}"
|
12
|
-
# exit
|
6
|
+
# Get the git-style program action
|
7
|
+
# o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
8
|
+
# opts.on('-n [name]','--name [name]', 'Binary to run') { |o| optioner.name o }
|
13
9
|
# end
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
11
|
+
name = ARGV.shift
|
12
|
+
|
13
|
+
# If there was no program action given
|
14
|
+
if !name || name == "-h" || name == "--help"
|
15
|
+
puts "Usage: pool <specfile> <action> <options>"
|
16
|
+
puts "Pool actions:"
|
17
|
+
puts Binary.list_binaries_for("pool")
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
program_name = "#{File.basename($0)}-#{name}"
|
22
|
+
program_location = File.join(Binary.binary_directory, program_name)
|
23
|
+
|
24
|
+
command_line = "#{program_location} #{ARGV.join(" ")}"
|
25
|
+
|
26
|
+
# Run it from the command-line first
|
27
|
+
if Binary.available_binaries_for("pool").include?(name)
|
28
|
+
Kernel.exec "#{command_line}"
|
31
29
|
else
|
32
|
-
puts
|
30
|
+
puts "Unknown poolparty binary: #{program_name}"
|
33
31
|
end
|
data/bin/pool-console
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/poolparty.rb'}"
|
9
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/poolpartycl.rb'}"
|
10
|
+
puts "Loading PoolParty console..."
|
11
|
+
|
12
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/bin/pool-describe
ADDED
data/bin/pool-list
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require "poolparty"
|
4
|
+
require "poolpartycl"
|
5
|
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
6
|
+
opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)') { |o| optioner.location o }
|
7
|
+
opts.on('-r', '--remote', 'Remote listing') { optioner.location "remote" }
|
8
|
+
opts.on('-l', '--local', 'Local listing') { optioner.location "local" }
|
9
|
+
opts.on('-n name', '--name name', 'Listing for pool name') { |p| optioner.poolname p }
|
10
|
+
end
|
11
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
12
|
+
|
13
|
+
@location = o.location ? o.location : "remote"
|
14
|
+
|
15
|
+
include Remote
|
16
|
+
|
17
|
+
@pools = o.poolname ? [pool(o.poolname.downcase.to_sym)] : pools
|
18
|
+
|
19
|
+
@pools.each do |name, pool|
|
20
|
+
with_pool(pool, {:location => @location}) do
|
21
|
+
puts header("Listing pool #{name}")
|
22
|
+
clouds.each do |name, cloud|
|
23
|
+
puts subheader("Cloud: #{name}")
|
24
|
+
out = location == "remote" ? cloud.list_from_remote({:cache => true}).map{|a| a.to_s} : cloud.list_from_local.map{|a| a.to_s}
|
25
|
+
puts out
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|