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,64 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
# Wrap all the resources into a class package from
|
5
|
+
def classpackage_with_self(parent=self, &block)
|
6
|
+
@cp = PoolParty::Resources::Classpackage.new(parent.options, parent, &block)
|
7
|
+
@cp.instance_eval {@resources = parent.resources}
|
8
|
+
parent.instance_eval {@resources = nil}
|
9
|
+
@cp
|
10
|
+
end
|
11
|
+
|
12
|
+
class Classpackage < Resource
|
13
|
+
|
14
|
+
default_options({
|
15
|
+
:name => nil
|
16
|
+
})
|
17
|
+
|
18
|
+
def initialize(opts={}, parent=self, &block)
|
19
|
+
# Take the options of the parents
|
20
|
+
set_parent(parent, false) if parent
|
21
|
+
set_vars_from_options(opts) unless opts.empty?
|
22
|
+
self.instance_eval &block if block
|
23
|
+
# store_block(&block)
|
24
|
+
loaded
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_string
|
28
|
+
returning String.new do |output|
|
29
|
+
output << "# #{name.sanitize}"
|
30
|
+
output << "\nclass #{name.sanitize} {\n"
|
31
|
+
output << resources_string_from_resources(resources)
|
32
|
+
output << "\n}\n"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def include_string
|
37
|
+
"include #{name.sanitize}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def name(*args)
|
41
|
+
args.empty? ? (@name || parent.name) : @name ||= args.first
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def resources_string_from_resources(resources, prev="\t")
|
47
|
+
@variables = resources.extract! {|name,resource| name == :variable}
|
48
|
+
returning Array.new do |str|
|
49
|
+
unless @variables.empty?
|
50
|
+
str << "\n# Variables \n"
|
51
|
+
@variables.each do |name, variable|
|
52
|
+
str << variable.to_string("#{prev}")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
resources.each do |type, resource|
|
57
|
+
str << "\n#{prev*2}# #{type}\n"
|
58
|
+
str << resource.to_string("#{prev*2}")
|
59
|
+
end
|
60
|
+
end.join("\n")
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
def execute_if(attr_s="$hostname", str="", parent=self, &block)
|
5
|
+
parent = parent.is_a?(PoolParty::Cloud::Cloud) ? parent : parent.parent
|
6
|
+
opts = {:attribute => attr_s, :equal => str}
|
7
|
+
options = parent.respond_to?(:options) ? parent.options.merge!(opts) : opts
|
8
|
+
@c = PoolParty::Resources::Conditional.new(options, parent, &block)
|
9
|
+
parent.instance_eval {add_resource(:conditional, options, parent, &block) }
|
10
|
+
@c
|
11
|
+
end
|
12
|
+
|
13
|
+
class Conditional < Resource
|
14
|
+
|
15
|
+
def initialize(opts={}, parent=self, &block)
|
16
|
+
name "#{opts[:attribute]} == #{opts[:equal]}"
|
17
|
+
attribute opts[:attribute]
|
18
|
+
equal opts[:equal]
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
# This way, we only get other resources, and not the conditional
|
23
|
+
# itself as a resource
|
24
|
+
def virtual_resource?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_string(prev="")
|
29
|
+
returning Array.new do |output|
|
30
|
+
output << "# #{name.sanitize}"
|
31
|
+
output << "case #{attribute} {"
|
32
|
+
output << "#{equal} : { #{resources_string_from_resources(resources)} }"
|
33
|
+
output << "default : {}"
|
34
|
+
output << "}"
|
35
|
+
end.join("\n")
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Directory < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:ensure => "directory",
|
8
|
+
:mode => 644,
|
9
|
+
:owner => "#{Base.user}"
|
10
|
+
})
|
11
|
+
|
12
|
+
def class_type_name
|
13
|
+
"file"
|
14
|
+
end
|
15
|
+
|
16
|
+
def present
|
17
|
+
'directory'
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Exec < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:path => "/usr/bin:/bin:/usr/local/bin:$PATH"
|
8
|
+
})
|
9
|
+
|
10
|
+
|
11
|
+
def disallowed_options
|
12
|
+
[:ensure, :name]
|
13
|
+
end
|
14
|
+
|
15
|
+
def key
|
16
|
+
name || command
|
17
|
+
end
|
18
|
+
|
19
|
+
def present
|
20
|
+
"running"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class File < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:ensure => "file",
|
8
|
+
:mode => 644,
|
9
|
+
:owner => "#{Base.user}"
|
10
|
+
})
|
11
|
+
|
12
|
+
def disallowed_options
|
13
|
+
[:name, :template]
|
14
|
+
end
|
15
|
+
|
16
|
+
def source(arg=nil)
|
17
|
+
arg ? options[:source] = arg : "#{Base.fileserver_base}/#{::File.basename(name)}"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
def gem(opts={}, parent=self, &block)
|
5
|
+
add_resource(:package, opts.merge({
|
6
|
+
:provider => "gem",
|
7
|
+
:requires => "Package[rubygems]"
|
8
|
+
}), parent, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
add_has_and_does_not_have_methods_for(:gem)
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Remotefile < File
|
5
|
+
# Not really my favorite of lines
|
6
|
+
include PoolParty::Configurable
|
7
|
+
|
8
|
+
default_options({
|
9
|
+
:ensure => "present",
|
10
|
+
:mode => 644,
|
11
|
+
:owner => "#{Base.user}",
|
12
|
+
:source => nil
|
13
|
+
})
|
14
|
+
|
15
|
+
def class_type_name
|
16
|
+
"file"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Service < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:ensure => "running",
|
8
|
+
:name => nil,
|
9
|
+
:enable => true
|
10
|
+
})
|
11
|
+
|
12
|
+
def present
|
13
|
+
"running"
|
14
|
+
end
|
15
|
+
def absent
|
16
|
+
"stopping"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Sshkey < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:command => nil,
|
8
|
+
:key => "ALONGSTRINGOFDIGITS",
|
9
|
+
:target => "~/.ssh/poolparty_id_rsa"
|
10
|
+
})
|
11
|
+
|
12
|
+
def keyfile=(file)
|
13
|
+
keyfile open(file).read
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Resources
|
3
|
+
|
4
|
+
class Variable < Resource
|
5
|
+
|
6
|
+
default_options({
|
7
|
+
:name => "var",
|
8
|
+
:value => ""
|
9
|
+
})
|
10
|
+
|
11
|
+
def to_string(prev="\t")
|
12
|
+
"$#{name} = #{value_string}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def value_string
|
16
|
+
case value.class.to_s
|
17
|
+
when "Array"
|
18
|
+
"[ #{value.map{|a| "'#{a}'"}.join(", ")} ]"
|
19
|
+
else
|
20
|
+
"'#{value}'"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module PoolParty
|
2
|
+
|
3
|
+
class Script
|
4
|
+
|
5
|
+
def self.inflate_file(file)
|
6
|
+
inflate open(file).read
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.inflate(script, file="__SCRIPT__")
|
10
|
+
apool = new
|
11
|
+
apool.instance_eval script, file
|
12
|
+
apool.inflate
|
13
|
+
end
|
14
|
+
|
15
|
+
def inflate
|
16
|
+
pools.map {|name,pool| pool.inflate } unless pools.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.to_ruby(opts={},&blk)
|
20
|
+
blk.to_ruby(opts)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.for_save_string
|
24
|
+
returning Array.new do |out|
|
25
|
+
clouds.each do |name, cl|
|
26
|
+
with_cloud(cl) do
|
27
|
+
out << <<-EOE
|
28
|
+
cloud :#{name} do
|
29
|
+
#{cl.minimum_runnable_options.map {|o| "\t#{o} \"#{cl.send o}\""}.join("\n")}
|
30
|
+
end
|
31
|
+
EOE
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end.join("\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.save!(to_file=true)
|
38
|
+
write_to_file_in_storage_directory(Base.default_specfile_name, for_save_string) if to_file
|
39
|
+
for_save_string
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#! /usr/bin/ruby1.8
|
2
|
+
#--
|
3
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE.txt for permissions.
|
6
|
+
# /usr/bin/gem is broken, so... have to use this until it is fixed
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require "rubygems"
|
11
|
+
require "rubygems/gem_runner"
|
12
|
+
Gem.manage_gems
|
13
|
+
|
14
|
+
required_version = Gem::Version::Requirement.new(">= 1.8.0")
|
15
|
+
unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
16
|
+
puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
|
17
|
+
exit(1)
|
18
|
+
end
|
19
|
+
|
20
|
+
# We need to preserve the original ARGV to use for passing gem options
|
21
|
+
# to source gems. If there is a -- in the line, strip all options after
|
22
|
+
# it...its for the source building process.
|
23
|
+
args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")]
|
24
|
+
|
25
|
+
Gem::GemRunner.new.run(args)
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# Haproxy conf
|
1
2
|
keepalive 2 # Time inbetween heartbeats
|
2
3
|
deadtime 32 # wait 32 seconds before declaring dead
|
3
4
|
warntime 16 # issue a warning halfway through
|
4
5
|
initdead 60 # Don't boot instances between 60 seconds of each other
|
5
|
-
baud 19200 #
|
6
6
|
auto_failback on
|
7
7
|
use_logd yes
|
8
|
+
crm on
|
8
9
|
|
9
|
-
|
10
|
+
node <%= ha_nodenames.join(" ") %>
|
@@ -3,7 +3,8 @@ global
|
|
3
3
|
maxconn 4096 # total max connections (dependent on ulimit)
|
4
4
|
nbproc 1 # number of processing cores
|
5
5
|
user haproxy
|
6
|
-
|
6
|
+
group haproxy
|
7
|
+
chroot /var/run/haproxy
|
7
8
|
log 127.0.0.1 local0 debug
|
8
9
|
pidfile /var/run/haproxy.pid
|
9
10
|
|
@@ -17,13 +18,19 @@ defaults
|
|
17
18
|
option httplog
|
18
19
|
option httpclose # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)
|
19
20
|
option forwardfor # enable insert of X-Forwarded-For headers
|
20
|
-
retries 3
|
21
|
+
retries 3
|
22
|
+
option redispatch
|
21
23
|
|
22
24
|
balance roundrobin # each server is used in turns, according to assigned weight
|
23
25
|
|
24
|
-
|
25
|
-
stats
|
26
|
+
# Stats
|
27
|
+
stats enable
|
28
|
+
stats uri /poolparty
|
26
29
|
stats realm Statistics\ for\ PoolParty
|
27
30
|
|
28
|
-
listen
|
29
|
-
|
31
|
+
listen <%= name_haproxy %>
|
32
|
+
bind 0.0.0.0:<%= ports_haproxy.join(",0.0.0.0:") %>
|
33
|
+
<% node_ips_haproxy.each_with_index do |ip, index| -%>
|
34
|
+
cookie POOLPARTYPARTY
|
35
|
+
server node<%= index %> <%= ip %>:<%= forwarding_port %> weight 1 check cookie
|
36
|
+
<% end -%>
|