fairchild-poolparty 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -3
- data/VERSION.yml +1 -1
- data/bin/cloud-configure +0 -2
- data/bin/cloud-show +2 -2
- data/lib/poolparty/base_packages/haproxy.rb +9 -4
- data/lib/poolparty/base_packages/poolparty.rb +2 -0
- data/lib/poolparty/base_packages/tokyo_tyrant.rb +23 -0
- data/lib/poolparty/core/string.rb +14 -0
- data/lib/poolparty/dependency_resolver/chef_resolver.rb +12 -5
- data/lib/poolparty/helpers/binary.rb +5 -2
- data/lib/poolparty/modules/cloud_dsl.rb +10 -0
- data/lib/poolparty/modules/definable_resource.rb +1 -4
- data/lib/poolparty/monitors/neighborhood_monitor.rb +3 -4
- data/lib/poolparty/net/remoter/interactive.rb +1 -0
- data/lib/poolparty/plugins/chef.rb +5 -0
- data/lib/poolparty/plugins/deploydirectory.rb +13 -22
- data/lib/poolparty/plugins/git.rb +8 -6
- data/lib/poolparty/plugins/svn.rb +56 -39
- data/lib/poolparty/poolparty/cloud.rb +23 -4
- data/lib/poolparty/poolparty/plugin_model.rb +1 -1
- data/lib/poolparty/poolparty/pool.rb +1 -1
- data/lib/poolparty/poolparty/poolparty_base_class.rb +2 -0
- data/lib/poolparty/provision/dr_configure.rb +6 -5
- data/test/poolparty/modules/cloud_dsl_test.rb +33 -0
- data/test/test_helper.rb +1 -1
- data/vendor/chef/apache2/README.rdoc +59 -0
- data/vendor/chef/apache2/attributes/apache.rb +72 -0
- data/vendor/chef/apache2/definitions/apache_module.rb +36 -0
- data/vendor/chef/apache2/definitions/apache_site.rb +36 -0
- data/vendor/chef/apache2/definitions/web_app.rb +45 -0
- data/vendor/chef/apache2/files/default/apache2_module_conf_generate.pl +41 -0
- data/vendor/chef/apache2/recipes/default.rb +132 -0
- data/vendor/chef/apache2/recipes/mod_alias.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_auth_basic.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_auth_digest.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authn_file.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authnz_ldap.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authz_default.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authz_groupfile.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authz_host.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_authz_user.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_autoindex.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_cgi.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_dav.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_dav_svn.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_deflate.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_dir.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_env.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_expires.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_fcgid.rb +35 -0
- data/vendor/chef/apache2/recipes/mod_headers.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_ldap.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_log_config.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_mime.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_negotiation.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_php5.rb +27 -0
- data/vendor/chef/apache2/recipes/mod_proxy.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_proxy_http.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_python.rb +22 -0
- data/vendor/chef/apache2/recipes/mod_rewrite.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_setenvif.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_ssl.rb +20 -0
- data/vendor/chef/apache2/recipes/mod_status.rb +20 -0
- data/vendor/chef/apache2/templates/default/a2dismod.erb +22 -0
- data/vendor/chef/apache2/templates/default/a2dissite.erb +29 -0
- data/vendor/chef/apache2/templates/default/a2enmod.erb +37 -0
- data/vendor/chef/apache2/templates/default/a2ensite.erb +38 -0
- data/vendor/chef/apache2/templates/default/apache2.conf.erb +630 -0
- data/vendor/chef/apache2/templates/default/default-site.erb +45 -0
- data/vendor/chef/apache2/templates/default/port_apache.erb +2 -0
- data/vendor/chef/apache2/templates/default/ports.conf.erb +6 -0
- data/vendor/chef/apache2/templates/default/web_app.conf.erb +43 -0
- data/vendor/gems/dslify/dslify.gemspec +2 -2
- data/vendor/gems/dslify/lib/dslify/version.rb +1 -1
- data/vendor/gems/suitcase/VERSION.yml +1 -1
- data/vendor/gems/suitcase/lib/suitcase/zipper.rb +23 -7
- data/vendor/gems/suitcase/suitcase.gemspec +5 -25
- data/vendor/gems/suitcase/test/suitcase_test.rb +13 -0
- metadata +61 -2
data/README.txt
CHANGED
data/VERSION.yml
CHANGED
data/bin/cloud-configure
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
3
|
require "poolparty"
|
4
|
-
# require "poolpartycl"
|
5
|
-
|
6
4
|
|
7
5
|
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
8
6
|
opts.on('-n cloudname', '--name name', 'Start cloud by this name') { |c| optioner.cloudname c }
|
data/bin/cloud-show
CHANGED
@@ -7,11 +7,11 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
o.loaded_clouds.each do |cld|
|
10
|
-
|
10
|
+
puts "\nFrom #{$pool_specfile}\n"
|
11
11
|
print_with_nice_printer "Cloud: #{cld.name}", [
|
12
12
|
"instances #{cld.minimum_instances}..#{cld.maximum_instances}",
|
13
13
|
"keypair #{cld.keypair}"
|
14
|
-
] do |printer|
|
14
|
+
] do |printer|
|
15
15
|
if cld.list_of_running_instances.size > 0
|
16
16
|
printer.empty
|
17
17
|
printer.center("Active instances")
|
@@ -4,13 +4,17 @@ module PoolParty
|
|
4
4
|
|
5
5
|
def enable
|
6
6
|
# We need the haproxy package
|
7
|
-
|
7
|
+
::Suitcase::Zipper.add("#{::File.dirname(__FILE__)}/../../../vendor/chef/apache2", "chef/recipes")
|
8
|
+
|
9
|
+
has_chef_recipe 'apache2'
|
8
10
|
has_service "apache2"
|
9
|
-
|
11
|
+
|
12
|
+
has_package({:name => "haproxy"}) do
|
13
|
+
stops get_service("apache2")
|
14
|
+
end
|
10
15
|
|
11
16
|
# Restart sysklogd after we update the haproxy.log
|
12
|
-
has_service(:name => "sysklogd")
|
13
|
-
|
17
|
+
has_service(:name => "sysklogd")
|
14
18
|
# Template variables
|
15
19
|
has_variable("haproxy_name", :value => "#{cloud.name}")
|
16
20
|
has_variable("listen_ports", :value => [ "8080" ], :namespace => "apache")
|
@@ -40,6 +44,7 @@ module PoolParty
|
|
40
44
|
template "#{::File.dirname(__FILE__)}/../templates/haproxy.conf"
|
41
45
|
calls get_exec("reloadhaproxy")
|
42
46
|
end
|
47
|
+
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PoolParty
|
2
|
+
class Base
|
3
|
+
plugin :poolparty_base_tokyo_tyrant do
|
4
|
+
|
5
|
+
def enable
|
6
|
+
has_package "build-essential"
|
7
|
+
has_package "zlib1g-dev"
|
8
|
+
has_package "libbz2-dev"
|
9
|
+
has_gem_package "rufus-tokyo"
|
10
|
+
|
11
|
+
has_exec "install tokyo-cabinet" do
|
12
|
+
command "cd ~ && git clone git://github.com/etrepum/tokyo-cabinet.git && cd tokyo-cabinet/ && ./configure && make && make install && cd ~"
|
13
|
+
not_if "which tcrtest"
|
14
|
+
end
|
15
|
+
has_exec "install tokyo-tyrant" do
|
16
|
+
command "cd ~ && git clone git://github.com/etrepum/tokyo-tyrant.git && cd tokyo-tyrant/ && ./configure && make && make install && cd ~"
|
17
|
+
not_if "which ttserver"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -67,6 +67,20 @@ class String
|
|
67
67
|
klass
|
68
68
|
end
|
69
69
|
|
70
|
+
def new_resource_class(superclass=nil, opts={}, &block)
|
71
|
+
symc = "::PoolParty::Resources::#{self.camelcase}"
|
72
|
+
kla=<<-EOE
|
73
|
+
class #{symc} < ::PoolParty::Resources::Resource
|
74
|
+
end
|
75
|
+
EOE
|
76
|
+
|
77
|
+
Kernel.module_eval kla
|
78
|
+
klass = symc.constantize
|
79
|
+
klass.module_eval &block if block
|
80
|
+
|
81
|
+
klass
|
82
|
+
end
|
83
|
+
|
70
84
|
def camelcase
|
71
85
|
gsub(/(^|_|-)(.)/) { $2.upcase }
|
72
86
|
end
|
@@ -33,12 +33,7 @@ module PoolParty
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def options_to_string(opts,tabs=0)
|
36
|
-
# opts.map do |k,v|
|
37
|
-
# res = to_option_string(v)
|
38
|
-
# next unless res && !res.empty?
|
39
|
-
# # "#{tf(tabs)}$#{k} = #{res}"
|
40
36
|
handle_print_variables(opts) if opts
|
41
|
-
# end.join("\n") if opts
|
42
37
|
end
|
43
38
|
|
44
39
|
def resources_to_string(opts,tabs=0)
|
@@ -50,6 +45,12 @@ module PoolParty
|
|
50
45
|
handle_print_variables(vars)
|
51
46
|
end
|
52
47
|
|
48
|
+
if opts[:chef_recipe]
|
49
|
+
opts.delete(:chef_recipe).each do |rcp|
|
50
|
+
out << "include_recipe #{to_option_string(rcp.name)}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
53
54
|
if opts.has_key?(:line_in_file)
|
54
55
|
lines = opts.delete(:line_in_file).inject([]) do |sum, l|
|
55
56
|
sum << PoolParty::Resources::Exec.new(:name => l[:name], :command => PoolParty::Resources::LineInFile.command(l[:line], l[:file]) ).to_properties_hash
|
@@ -115,6 +116,8 @@ module PoolParty
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
119
|
+
# TODO: This is brittle, need to find a way to make them reactive, rather than
|
120
|
+
# separate (the key/value pairs)
|
118
121
|
def hash_flush_out(hash, pre="", post="")
|
119
122
|
hash.map do |k,v|
|
120
123
|
key = to_chef_key(k)
|
@@ -184,6 +187,10 @@ module PoolParty
|
|
184
187
|
"notifies :start,"
|
185
188
|
when :enable
|
186
189
|
nil
|
190
|
+
when :if_not
|
191
|
+
"not_if"
|
192
|
+
when :notif
|
193
|
+
"not_if"
|
187
194
|
when :onlyif
|
188
195
|
"only_if"
|
189
196
|
else
|
@@ -15,6 +15,7 @@ module PoolParty
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
# Helper to print with the nice printer
|
18
19
|
def print_with_nice_printer(header=nil, strs=[], &block)
|
19
20
|
printer = NicePrinter.new
|
20
21
|
printer.header
|
@@ -25,6 +26,7 @@ module PoolParty
|
|
25
26
|
printer.print
|
26
27
|
end
|
27
28
|
|
29
|
+
# Keep the pool_specfile
|
28
30
|
def pool_specfile
|
29
31
|
$pool_specfile
|
30
32
|
end
|
@@ -45,8 +47,9 @@ module PoolParty
|
|
45
47
|
# These are the locations the spec file can be before the cloud
|
46
48
|
# aborts because it cannot load the cloud
|
47
49
|
def get_existing_spec_location
|
48
|
-
[
|
49
|
-
|
50
|
+
[
|
51
|
+
"#{Dir.pwd}/#{Default.default_specfile_name}",
|
52
|
+
Dir["#{Dir.pwd}/*/#{Default.default_specfile_name}"],
|
50
53
|
"#{Default.remote_storage_path}/#{Default.default_specfile_name}",
|
51
54
|
"#{Default.default_specfile_name}",
|
52
55
|
"#{Default.base_config_directory}/#{Default.default_specfile_name}",
|
@@ -16,5 +16,15 @@ module PoolParty
|
|
16
16
|
dsl_options[:dependency_resolver] = klass unless dsl_options[:dependency_resolver]
|
17
17
|
end
|
18
18
|
|
19
|
+
# Enable a service package
|
20
|
+
def enable(service);dsl_options[service] = :enabled;end
|
21
|
+
# Disable a service package
|
22
|
+
def disable(service);dsl_options[service] = :disabled;end
|
23
|
+
|
24
|
+
# Check to see if the package has been enabled
|
25
|
+
def enabled?(srv)
|
26
|
+
dsl_options.has_key?(srv) && dsl_options[srv] == :enabled
|
27
|
+
end
|
28
|
+
|
19
29
|
end
|
20
30
|
end
|
@@ -16,10 +16,7 @@ module PoolParty
|
|
16
16
|
#
|
17
17
|
# For example usage, see lib/poolparty/plugins/line.rb
|
18
18
|
def define_resource(name, &block)
|
19
|
-
|
20
|
-
klass = symc.class_constant(PoolParty::Resources::CustomResource, {:preserve => true}, &block)
|
21
|
-
PoolParty::Resources.module_eval &block
|
22
|
-
klass
|
19
|
+
name.to_s.new_resource_class(PoolParty::Resources::Resource, &block)
|
23
20
|
end
|
24
21
|
|
25
22
|
# Allow us to create virtual resources
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require ::File.dirname(__FILE__)+"/monitor_rack.rb"
|
2
2
|
require ::File.dirname(__FILE__)+"/../lite.rb"
|
3
3
|
require ::File.dirname(__FILE__)+"/../core/hash.rb"
|
4
|
+
require "#{::File.dirname(__FILE__)}/../poolparty/neighborhoods"
|
4
5
|
|
5
6
|
module Monitors
|
6
7
|
|
@@ -12,13 +13,11 @@ module Monitors
|
|
12
13
|
@env = env
|
13
14
|
@request = Rack::Request.new env
|
14
15
|
@response = Rack::Response.new
|
15
|
-
@
|
16
|
-
@opts = @cloud["options"]
|
17
|
-
@remoter_base = PoolParty::Remote.const_get(@opts.remote_base.split("::")[-1].camelcase)
|
16
|
+
@neighboorhoods = ::PoolParty::Neighborhoods.load_default
|
18
17
|
end
|
19
18
|
|
20
19
|
def default
|
21
|
-
@
|
20
|
+
@neighboorhoods.to_json
|
22
21
|
end
|
23
22
|
|
24
23
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
=begin rdoc
|
2
2
|
DeployDirectory
|
3
|
+
|
4
|
+
Deploy directory will rsync a local directory to
|
5
|
+
each instance of your cloud.
|
3
6
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
+
example:
|
8
|
+
has_directory 'name', :from => '/local/path', :to => '/path/on/server/'
|
9
|
+
|
10
|
+
The above example will place the contents of '/local/path' at '/path/on/server/name'
|
7
11
|
=end
|
8
12
|
module PoolParty
|
9
13
|
class Deploydirectory
|
@@ -11,35 +15,22 @@ module PoolParty
|
|
11
15
|
virtual_resource(:deploy_directory) do
|
12
16
|
|
13
17
|
def loaded(opts={}, &block)
|
14
|
-
# raise(Exception.new("You must include a directory for the git repos set by :at")) if at?.nil?
|
15
|
-
# opts.has_key?(:at) ? at(opts.delete(:at)) : raise(Exception.new("You must include a directory for the git repos set by :at"))
|
16
|
-
|
17
18
|
package_deploy_directory
|
18
19
|
add_unpack_directory
|
19
20
|
end
|
20
21
|
|
21
22
|
def package_deploy_directory
|
22
|
-
::Suitcase::Zipper.add(
|
23
|
+
::Suitcase::Zipper.add("#{from}", "user_directory/")
|
23
24
|
end
|
24
25
|
|
25
26
|
def add_unpack_directory
|
26
|
-
has_directory("#{::File.dirname(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
onlyif "test -f #{basedir}/#{sync_dir}"
|
32
|
-
command "cd #{cwd}; cp -R /var/poolparty/dr_configure/user_directory/#{sync_dir}; rm -rf /var/poolparty/dr_configure/#{name}"
|
27
|
+
has_directory("#{::File.dirname(to)}")
|
28
|
+
has_exec("unpack-#{::File.basename(to)}-deploy-directory") do
|
29
|
+
requires get_directory("#{::File.dirname(to)}")
|
30
|
+
not_if "test -f #{to}"
|
31
|
+
command "cp -R /var/poolparty/dr_configure/user_directory/#{name}/* #{to}"
|
33
32
|
end
|
34
33
|
end
|
35
|
-
|
36
|
-
def from(dir)
|
37
|
-
sync_dir dir
|
38
|
-
end
|
39
|
-
|
40
|
-
def to(dir)
|
41
|
-
basedir dir
|
42
|
-
end
|
43
34
|
|
44
35
|
end
|
45
36
|
|
@@ -31,11 +31,19 @@ module PoolParty
|
|
31
31
|
has_exec(:name => "update-#{name}", :cwd => ::File.dirname( creates_dir )) do
|
32
32
|
command "git pull"
|
33
33
|
end
|
34
|
+
|
34
35
|
if owner?
|
35
36
|
has_exec(:name => "chown-#{name}", :cwd => ::File.dirname( creates_dir )) do
|
36
37
|
command "chown #{owner} * -R"
|
37
38
|
end
|
38
39
|
end
|
40
|
+
|
41
|
+
if deploy_key?
|
42
|
+
raise Exception.new("Cannot find the git deploy key: #{deploy_key}") unless ::File.file?(::File.expand_path(deploy_key))
|
43
|
+
::Suitcase::Zipper.add(::File.expand_path(deploy_key), "keys")
|
44
|
+
PoolParty::Provision::DrConfigure.class_commands << "cp -f /var/poolparty/dr_configure/keys/* ~/.ssh"
|
45
|
+
end
|
46
|
+
|
39
47
|
end
|
40
48
|
|
41
49
|
def git_repos(src)
|
@@ -54,12 +62,6 @@ module PoolParty
|
|
54
62
|
"#{::File.join( working_dir, ::File.basename(source, ::File.extname(source)) )}/.git"
|
55
63
|
end
|
56
64
|
|
57
|
-
# Since git is not a native type, we have to say which core resource
|
58
|
-
# it is using to be able to require it
|
59
|
-
def class_type_name
|
60
|
-
"exec"
|
61
|
-
end
|
62
|
-
|
63
65
|
end
|
64
66
|
|
65
67
|
end
|
@@ -1,47 +1,64 @@
|
|
1
1
|
module PoolParty
|
2
|
-
class
|
2
|
+
class SvnResource
|
3
3
|
|
4
|
-
|
4
|
+
virtual_resource :svn do
|
5
|
+
def loaded(*args)
|
6
|
+
has_package :name => "subversion"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
virtual_resource :svn_repos do
|
11
|
+
|
12
|
+
def loaded(opts={}, &block)
|
13
|
+
has_package("subversion")
|
14
|
+
has_svn_repository
|
15
|
+
end
|
16
|
+
|
17
|
+
def has_svn_repository
|
18
|
+
puts "wd #{working_dir}"
|
19
|
+
puts "cd #{creates_dir}"
|
20
|
+
has_directory(::File.dirname(working_dir))
|
21
|
+
has_directory(:name => "#{working_dir}", :requires => get_directory("#{::File.dirname(working_dir)}"))
|
22
|
+
|
23
|
+
has_exec(:name => "svn-#{name}", :requires => [get_directory("#{working_dir}"), get_package("subversion")] ) do
|
24
|
+
cwd working_dir
|
25
|
+
svn_cmd = if parent.requires_user?
|
26
|
+
"svn co #{source} --username #{requires_user} --password #{requires_password}"
|
27
|
+
else
|
28
|
+
"svn co #{source}"
|
29
|
+
end
|
30
|
+
command svn_cmd
|
31
|
+
creates creates_dir
|
32
|
+
end
|
33
|
+
has_exec(:name => "update-#{name}", :cwd => ::File.dirname( creates_dir )) do
|
34
|
+
command "svn up"
|
35
|
+
# If the parent has after_update_svn set on it, then run it
|
36
|
+
runs parent.after_update_svn if parent.after_update_svn?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def svn_repos(src)
|
41
|
+
source src
|
42
|
+
end
|
43
|
+
|
44
|
+
def at(dir)
|
45
|
+
working_dir dir
|
46
|
+
end
|
47
|
+
|
48
|
+
def to(dir)
|
49
|
+
at(dir)
|
50
|
+
end
|
51
|
+
|
52
|
+
def creates_dir
|
53
|
+
"#{::File.join( working_dir, ::File.basename(source, ::File.extname(source)) )}/.svn"
|
54
|
+
end
|
5
55
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
path => "#{opts[:path]}",
|
11
|
-
user => "#{opts[:user] || false}",
|
12
|
-
password => "#{opts[:password] || ""}"
|
13
|
-
}
|
14
|
-
EOE
|
56
|
+
# Since svn is not a native type, we have to say which core resource
|
57
|
+
# it is using to be able to require it
|
58
|
+
def class_type_name
|
59
|
+
"exec"
|
15
60
|
end
|
16
61
|
|
17
|
-
custom_function <<-EOF
|
18
|
-
# Serve subversion-based code from a local location. The job of this
|
19
|
-
# module is to check the data out from subversion and keep it up to
|
20
|
-
# date, especially useful for providing data to your Puppet server.
|
21
|
-
define svnserve($source, $path, $user = false, $password = false) {
|
22
|
-
file { $path:
|
23
|
-
ensure => directory,
|
24
|
-
owner => root,
|
25
|
-
group => root
|
26
|
-
}
|
27
|
-
$svncmd = $user ? {
|
28
|
-
false => "/usr/bin/svn co --non-interactive $source/$name .",
|
29
|
-
default => "/usr/bin/svn co --non-interactive --username $user --password '$password' $source/$name ."
|
30
|
-
}
|
31
|
-
exec { "svnco-$name":
|
32
|
-
command => $svncmd,
|
33
|
-
cwd => $path,
|
34
|
-
require => File[$path],
|
35
|
-
creates => "$path/.svn"
|
36
|
-
}
|
37
|
-
exec { "svnupdate-$name":
|
38
|
-
command => "/usr/bin/svn update",
|
39
|
-
require => Exec["svnco-$name"],
|
40
|
-
onlyif => '/usr/bin/svn status -u --non-interactive | /bin/grep "\*"',
|
41
|
-
cwd => $path
|
42
|
-
}
|
43
|
-
}
|
44
|
-
EOF
|
45
62
|
end
|
46
63
|
|
47
64
|
end
|
@@ -3,14 +3,17 @@ require File.dirname(__FILE__) + "/resource"
|
|
3
3
|
|
4
4
|
module PoolParty
|
5
5
|
module Cloud
|
6
|
+
# Instantiate a new cloud
|
6
7
|
def cloud(name=:app, &block)
|
7
8
|
clouds[name] ||= Cloud.new(name, &block)
|
8
9
|
end
|
9
10
|
|
11
|
+
# Global hash of clouds
|
10
12
|
def clouds
|
11
13
|
$clouds ||= {}
|
12
14
|
end
|
13
15
|
|
16
|
+
# TODO: Deprecate
|
14
17
|
def with_cloud(cl, opts={}, &block)
|
15
18
|
raise CloudNotFoundException.new("Cloud not found") unless cl
|
16
19
|
cl.options.merge!(opts) if opts
|
@@ -39,6 +42,7 @@ module PoolParty
|
|
39
42
|
[:name]
|
40
43
|
end
|
41
44
|
|
45
|
+
# Redefining methods are not allowed
|
42
46
|
def self.method_added sym
|
43
47
|
raise "Exception: #{sym.to_s.capitalize} method has been redefined" if immutable_methods.include?(sym) && !respond_to?(sym)
|
44
48
|
end
|
@@ -51,7 +55,10 @@ module PoolParty
|
|
51
55
|
remote_base.respond_to?(m) ? remote_base.send(m, *args, &block) : super
|
52
56
|
end
|
53
57
|
|
58
|
+
# Default set of options. Most take the Default options from the default class
|
54
59
|
default_options(
|
60
|
+
:expand_when => Default.expand_when,
|
61
|
+
:contract_when => Default.contract_when,
|
55
62
|
:minimum_instances => 2,
|
56
63
|
:maximum_instances => 5,
|
57
64
|
:access_key => Default.access_key,
|
@@ -66,8 +73,9 @@ module PoolParty
|
|
66
73
|
def initialize(name, &block)
|
67
74
|
@cloud_name = name
|
68
75
|
@cloud_name.freeze
|
69
|
-
|
70
|
-
|
76
|
+
|
77
|
+
plugin_directory "#{pool_specfile ? ::File.dirname(pool_specfile) : Dir.pwd}/plugins"
|
78
|
+
super
|
71
79
|
|
72
80
|
after_create
|
73
81
|
end
|
@@ -100,6 +108,7 @@ module PoolParty
|
|
100
108
|
options[:keypair] ||= keypair.basename rescue nil
|
101
109
|
options[:rules] = {:expand => expand_when, :contract => contract_when}
|
102
110
|
dependency_resolver 'chef'
|
111
|
+
enable :haproxy unless dsl_options[:haproxy] == :disabled
|
103
112
|
end
|
104
113
|
|
105
114
|
# provide list of public ips to get into the cloud
|
@@ -156,12 +165,13 @@ module PoolParty
|
|
156
165
|
@build_manifest
|
157
166
|
end
|
158
167
|
|
168
|
+
# Force rebuilding of the manifest
|
159
169
|
def rebuild_manifest
|
160
170
|
@build_manifest = nil
|
161
171
|
build_manifest
|
162
172
|
end
|
163
173
|
|
164
|
-
# If the
|
174
|
+
# If the pp already exists, then let's not recreate it
|
165
175
|
def build_from_existing_file
|
166
176
|
::FileTest.file?("#{Default.base_config_directory}/poolparty.pp") ? open("#{Default.base_config_directory}/poolparty.pp").read : nil
|
167
177
|
end
|
@@ -193,12 +203,20 @@ module PoolParty
|
|
193
203
|
# all that is necessary in a method called enable
|
194
204
|
# which is called when there is no block
|
195
205
|
def add_poolparty_base_requirements
|
196
|
-
poolparty_base_haproxy
|
197
206
|
poolparty_base_heartbeat
|
198
207
|
poolparty_base_ruby
|
199
208
|
poolparty_base_packages
|
209
|
+
|
210
|
+
add_optional_base_packages
|
211
|
+
end
|
212
|
+
|
213
|
+
# Add optional base packages included with PP
|
214
|
+
def add_optional_base_packages
|
215
|
+
poolparty_base_haproxy if enabled? :haproxy
|
216
|
+
poolparty_base_tokyo_tyrant if enabled? :tokyo_tyrant
|
200
217
|
end
|
201
218
|
|
219
|
+
# TODO: Deprecate
|
202
220
|
def other_clouds
|
203
221
|
arr = []
|
204
222
|
clouds.each do |name, cl|
|
@@ -207,6 +225,7 @@ module PoolParty
|
|
207
225
|
arr
|
208
226
|
end
|
209
227
|
|
228
|
+
# Reset the entire cloud
|
210
229
|
def reset!
|
211
230
|
reset_remoter_base!
|
212
231
|
@build_manifest = @describe_instances = @remote_instances_list = nil
|
@@ -37,6 +37,7 @@ module PoolParty
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
# Add the parent's options to my own and add myself as a service if I am not a resource
|
40
41
|
def add_to_parent_if_parent_exists_and_is_a_service
|
41
42
|
if parent && !parent.is_a?(PoolParty::Resources::Resource)
|
42
43
|
dsl_options(parent.dsl_options) if parent.is_a?(PoolParty::Pool::Pool)
|
@@ -44,6 +45,7 @@ module PoolParty
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
48
|
+
# Try to extract the name from the options
|
47
49
|
def get_name_from_options_and_extra_options(opts={}, extra_opts={})
|
48
50
|
opts.is_a?(Hash) ? (opts.has_key?(:name) ? opts.delete(:name) : nil) : dsl_options[:name] = opts
|
49
51
|
end
|
@@ -35,13 +35,13 @@ module PoolParty
|
|
35
35
|
::File.open "#{Default.tmp_path}/dr_configure/clouds.json", "w" do |f|
|
36
36
|
f << cloud.to_properties_hash.to_json
|
37
37
|
end
|
38
|
-
|
39
|
-
pack_up_and_ship_off_suitcase
|
38
|
+
|
40
39
|
setup_configurator
|
41
40
|
write_erlang_cookie
|
42
41
|
@configurator.files_to_upload.each {|f| ::FileUtils.cp f, "#{Default.tmp_path}/dr_configure/#{::File.basename(f)}" if ::File.file?(f) }
|
43
|
-
|
44
|
-
|
42
|
+
|
43
|
+
pack_up_and_ship_off_suitcase
|
44
|
+
|
45
45
|
commands << [
|
46
46
|
'chmod 600 /var/poolparty/dr_configure/clouds.json',
|
47
47
|
'chmod 600 /var/poolparty/dr_configure/clouds.rb',
|
@@ -49,6 +49,7 @@ module PoolParty
|
|
49
49
|
'cp /var/poolparty/dr_configure/clouds.rb /etc/poolparty',
|
50
50
|
'cp /var/poolparty/dr_configure/erlang.cookie /root/.erlang.cookie',
|
51
51
|
'ruby /var/poolparty/dr_configure/erlang_cookie_maker',
|
52
|
+
"touch /var/poolparty/POOLPARTY.PROGRESS",
|
52
53
|
'echo "configure" >> /var/poolparty/POOLPARTY.PROGRESS'
|
53
54
|
]
|
54
55
|
commands << self.class.class_commands unless self.class.class_commands.empty?
|
@@ -58,7 +59,7 @@ module PoolParty
|
|
58
59
|
def pack_up_and_ship_off_suitcase
|
59
60
|
::Suitcase::Zipper.build_dir!("#{Default.tmp_path}/dr_configure")
|
60
61
|
|
61
|
-
rsync "#{Default.tmp_path}/dr_configure",
|
62
|
+
rsync "#{Default.tmp_path}/dr_configure/", "/var/poolparty/dr_configure/"
|
62
63
|
end
|
63
64
|
|
64
65
|
def setup_configurator
|