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
data/bin/pool-provision
ADDED
@@ -0,0 +1,34 @@
|
|
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('-t', '--type [master|slave|all]', 'Provision these instances (default: all)') { |o| optioner.class_type o }
|
8
|
+
# opts.on('-a', '--all', 'Provision all the instances') { |o| optioner.all true }
|
9
|
+
# opts.on('-n [name]', '--name [name]', 'Pool to provision (required)') {|o| optioner.cloud_name o }
|
10
|
+
# end
|
11
|
+
# load_pool(o.spec || Binary.get_existing_spec_location)
|
12
|
+
#
|
13
|
+
# if o.cloud_name
|
14
|
+
# @c = cloud(o.cloud_name.downcase.to_sym)
|
15
|
+
# else
|
16
|
+
# puts "Cloud name required. Please specify it with -c [name]"
|
17
|
+
# exit(0)
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# if o.class_type && o.class_type != "all" && !o.all
|
21
|
+
# case o.class_type
|
22
|
+
# when "master","m"
|
23
|
+
# puts header("Provisioning the master instances")
|
24
|
+
# when "slave", "s"
|
25
|
+
# puts header("Provisioning the slave instances")
|
26
|
+
# end
|
27
|
+
# else
|
28
|
+
# # Provision all the instances
|
29
|
+
# puts header("Provisioning all the instances")
|
30
|
+
# provisioner_file = ::File.join(Base.storage_directory, "install.sh")
|
31
|
+
# File.open(provisioner_file, "w+") do |file|
|
32
|
+
# file << Provisioner::Master.install(@c)
|
33
|
+
# end
|
34
|
+
# end
|
data/bin/pool-spec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'poolspec/version'
|
8
|
+
puts "#{File.basename($0)} #{Poolspec::VERSION::STRING}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application,
|
14
|
+
File.join(File.dirname(__FILE__), "../generators"))
|
15
|
+
RubiGen::Base.reset_sources
|
16
|
+
RubiGen::Base.append_sources source
|
17
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'poolspec')
|
data/bin/pool-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('-p poolname', '--pool name', 'Start pool by this name') { |p| optioner.poolname p }
|
7
|
+
end
|
8
|
+
|
9
|
+
load_pool(o.spec || Binary.get_existing_spec_location)
|
10
|
+
|
11
|
+
@testing = o.testing
|
12
|
+
|
13
|
+
include Remote
|
14
|
+
|
15
|
+
@pools = o.poolname ? [pool(o.poolname.downcase.to_sym)] : pools
|
16
|
+
|
17
|
+
@pools.each do |name, pl|
|
18
|
+
|
19
|
+
with_pool(pl, {:testing => @testing}) do
|
20
|
+
|
21
|
+
puts header("Starting pool")
|
22
|
+
clouds.each do |name, cloud|
|
23
|
+
puts subheader("Cloud: #{name}")
|
24
|
+
puts "#{cloud.list_of_running_instances.size} running instances (#{cloud.minimum_instances} - #{cloud.maximum_instances})"
|
25
|
+
if (cloud.minimum_instances - cloud.list_of_running_instances.size) > 0
|
26
|
+
puts "Starting #{cloud.minimum_instances - cloud.list_of_running_instances.size} instances (from #{cloud.keypair})"
|
27
|
+
testing ? puts("\tNot launching while in testing mode") : cloud.launch_minimum_number_of_instances
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'PoolParty/version'
|
2
|
+
|
3
|
+
AUTHOR = 'Ari Lerner' # can also be an array of Authors
|
4
|
+
EMAIL = "ari.lerner@citrusbyte.com"
|
5
|
+
DESCRIPTION =<<-EOM
|
6
|
+
Self-healing, auto-scaling cloud computing tool
|
7
|
+
EOM
|
8
|
+
GEM_NAME = 'poolparty' # what ppl will type to install your gem
|
9
|
+
RUBYFORGE_PROJECT = 'poolparty' # The unix name for your project
|
10
|
+
HOMEPAGE = "http://poolpartyrb.com"
|
11
|
+
HOMEPATH = "http://#{GEM_NAME}.rubyforge.org"
|
12
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
13
|
+
EXTRA_DEPENDENCIES = [
|
14
|
+
['activesupport'],
|
15
|
+
['open4'],
|
16
|
+
['logging'],
|
17
|
+
["ruby2ruby"]
|
18
|
+
] # An array of rubygem dependencies [name, version]
|
19
|
+
|
20
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
21
|
+
@config = nil
|
22
|
+
RUBYFORGE_USERNAME = "unknown"
|
23
|
+
def rubyforge_username
|
24
|
+
unless @config
|
25
|
+
begin
|
26
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
27
|
+
rescue
|
28
|
+
puts <<-EOS
|
29
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
30
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
31
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
32
|
+
EOS
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
REV = nil
|
41
|
+
# UNCOMMENT IF REQUIRED:
|
42
|
+
# REV = YAML.load(`svn info`)['Revision']
|
43
|
+
VERS = PoolParty::VERSION::STRING + (REV ? ".#{REV}" : "")
|
44
|
+
RDOC_OPTS = ['--quiet', '--title', 'PoolParty documentation',
|
45
|
+
"--opname", "index.html",
|
46
|
+
"--line-numbers",
|
47
|
+
"--main", "README",
|
48
|
+
"--inline-source"]
|
49
|
+
|
50
|
+
class Hoe
|
51
|
+
def extra_deps
|
52
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
53
|
+
@extra_deps
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Generate all the Rake tasks
|
58
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
59
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
60
|
+
p.developer(AUTHOR, EMAIL)
|
61
|
+
p.description = DESCRIPTION
|
62
|
+
p.summary = DESCRIPTION
|
63
|
+
p.url = HOMEPATH
|
64
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
65
|
+
p.test_globs = ["test/**/test_*.rb"]
|
66
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
67
|
+
|
68
|
+
# == Optional
|
69
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
70
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
71
|
+
|
72
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
73
|
+
end
|
74
|
+
|
75
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
76
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
77
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
78
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
79
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
80
|
+
|
81
|
+
# # Gemspec creator
|
82
|
+
# spec = Gem::Specification.new do |s|
|
83
|
+
# s.name = GEM_NAME
|
84
|
+
# s.version = VERS
|
85
|
+
# s.platform = Gem::Platform::RUBY
|
86
|
+
# s.has_rdoc = true
|
87
|
+
# s.extra_rdoc_files = ["README.txt", "License.txt", 'History.txt']
|
88
|
+
# s.summary = DESCRIPTION
|
89
|
+
# s.description = s.summary
|
90
|
+
# s.author = AUTHOR
|
91
|
+
# s.email = EMAIL
|
92
|
+
# s.homepage = HOMEPATH
|
93
|
+
#
|
94
|
+
# # Uncomment this to add a dependency
|
95
|
+
# EXTRA_DEPENDENCIES.each do |arr|
|
96
|
+
# s.add_runtime_dependency arr
|
97
|
+
# end
|
98
|
+
# # s.extra_deps = EXTRA_DEPENDENCIES
|
99
|
+
#
|
100
|
+
# s.require_path = 'lib'
|
101
|
+
# s.autorequire = GEM_NAME
|
102
|
+
# s.files = %w(Rakefile History.txt README.txt) + Dir.glob("{examples,lib,specs,tasks,script,generators,bin}/**/*")
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
# Rake::GemPackageTask.new(spec) do |pkg|
|
106
|
+
# pkg.gem_spec = spec
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# desc "create a gemspec file"
|
110
|
+
# task :make_spec do
|
111
|
+
# ::File.unlink "#{GEM_NAME.downcase}.gemspec" if ::File.exists?("#{GEM_NAME.downcase}.gemspec")
|
112
|
+
# ::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |file|
|
113
|
+
# file.puts spec.to_ruby
|
114
|
+
# end
|
115
|
+
# end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen ruby2ruby].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/examples/basic.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Basic pool spec
|
2
|
+
# Shows global settings for the clouds
|
3
|
+
|
4
|
+
pool :application do
|
5
|
+
|
6
|
+
instances 3..5
|
7
|
+
keypair "auser"
|
8
|
+
|
9
|
+
cloud :app do
|
10
|
+
minimum_instances 2
|
11
|
+
ami "ami-abc123"
|
12
|
+
end
|
13
|
+
|
14
|
+
cloud :db do
|
15
|
+
keypair "hotstuff_database"
|
16
|
+
maximum_instances 20
|
17
|
+
ami "ami-1234bc"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
pool :app do
|
4
|
+
|
5
|
+
plugin_directory File.join(File.dirname(__FILE__), "pool", "test_plugins")
|
6
|
+
instances 2..10
|
7
|
+
|
8
|
+
cloud :app do
|
9
|
+
# minimum 2 instances
|
10
|
+
# maximum 10 instances
|
11
|
+
apache do
|
12
|
+
enable_php
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
cloud :db do
|
17
|
+
# minimum 2 instances
|
18
|
+
# maximum 10 instances
|
19
|
+
mysql # default mysql setup
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class PoolspecGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
# Ensure appropriate folder(s) exists
|
21
|
+
m.directory ''
|
22
|
+
BASEDIRS.each { |path| m.directory path }
|
23
|
+
|
24
|
+
m.template "pool_spec_template.erb", "#{@name}.rb"
|
25
|
+
# Create stubs
|
26
|
+
# m.template "template.rb", "some_file_after_erb.rb"
|
27
|
+
# m.template_copy_each ["template.rb", "template2.rb"]
|
28
|
+
# m.file "file", "some_file_copied"
|
29
|
+
# m.file_copy_each ["path/to/file", "path/to/file2"]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
def banner
|
35
|
+
<<-EOS
|
36
|
+
Creates a basic poolparty spec tempalte
|
37
|
+
|
38
|
+
USAGE: #{spec.name} name
|
39
|
+
EOS
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_options!(opts)
|
43
|
+
opts.separator ''
|
44
|
+
opts.separator 'Options:'
|
45
|
+
# For each option below, place the default
|
46
|
+
# at the top of the file next to "default_options"
|
47
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
48
|
+
# "Some comment about this option",
|
49
|
+
# "Default: none") { |options[:author]| }
|
50
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
51
|
+
end
|
52
|
+
|
53
|
+
def extract_options
|
54
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
55
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
56
|
+
# raw instance variable value.
|
57
|
+
# @author = options[:author]
|
58
|
+
@pool_name = ARGV.pop
|
59
|
+
end
|
60
|
+
|
61
|
+
# Installation skeleton. Intermediate directories are automatically
|
62
|
+
# created so don't sweat their absence here.
|
63
|
+
BASEDIRS = %w(
|
64
|
+
)
|
65
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
%%%***************************************
|
2
|
+
%%%
|
3
|
+
%%% PoolParty node-server
|
4
|
+
%%% Author: Ari Lerner <ari.the.lerner@gmail.com>
|
5
|
+
%%%
|
6
|
+
%%% Description: This server runs on the poolparty nodes
|
7
|
+
%%%
|
8
|
+
%%%***************************************
|
9
|
+
|
10
|
+
% The name of our module
|
11
|
+
-module (eb_server).
|
12
|
+
% We are using the gen_server behaviour
|
13
|
+
-behaviour (gen_server).
|
14
|
+
|
15
|
+
% API methods
|
16
|
+
-export ([start_link/0]).
|
17
|
+
|
18
|
+
% gen_server callbacks
|
19
|
+
-export ([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
|
20
|
+
|
21
|
+
% Define the structure of the tuple state
|
22
|
+
-record (state, {}).
|
23
|
+
-define (SERVER, ?MODULE).
|
24
|
+
|
25
|
+
% API Methods
|
26
|
+
start_link() ->
|
27
|
+
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
|
data/lib/poolparty.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Load required gems
|
4
|
+
require 'active_support'
|
5
|
+
require 'open4'
|
6
|
+
require "ftools"
|
7
|
+
require "logging"
|
8
|
+
require "ruby2ruby"
|
9
|
+
|
10
|
+
# Use active supports auto load mechanism
|
11
|
+
ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__)
|
12
|
+
|
13
|
+
## Load PoolParty
|
14
|
+
require "#{File.dirname(__FILE__)}/poolparty/version"
|
15
|
+
|
16
|
+
%w(core modules exceptions net).each do |dir|
|
17
|
+
Dir[File.dirname(__FILE__) + "/poolparty/#{dir}/**.rb"].each do |file|
|
18
|
+
require file
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Kernel.load_p File.dirname(__FILE__) + "/poolparty/pool"
|
23
|
+
|
24
|
+
module PoolParty
|
25
|
+
include FileWriter
|
26
|
+
|
27
|
+
def logger
|
28
|
+
@pool_logger ||= make_new_logger
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
#:nodoc:#
|
33
|
+
def make_new_logger
|
34
|
+
FileUtils.mkdir_p Base.pool_logger_location unless ::File.directory?(Base.pool_logger_location)
|
35
|
+
Loggable.new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Object
|
40
|
+
include PoolParty
|
41
|
+
include PoolParty::Pool
|
42
|
+
include PoolParty::Cloud
|
43
|
+
|
44
|
+
include PoolParty::DefinableResource
|
45
|
+
end
|
46
|
+
|
47
|
+
class Class
|
48
|
+
include PoolParty::PluginModel
|
49
|
+
end
|
50
|
+
|
51
|
+
## Load PoolParty Plugins and package
|
52
|
+
%w(plugins base_packages).each do |dir|
|
53
|
+
Dir[File.dirname(__FILE__) + "/poolparty/#{dir}/**.rb"].each do |file|
|
54
|
+
require file
|
55
|
+
end
|
56
|
+
end
|