auser-poolparty 0.1.2 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. data/History.txt +22 -0
  2. data/License.txt +20 -0
  3. data/README.txt +52 -0
  4. data/Rakefile +4 -109
  5. data/bin/cloud +31 -0
  6. data/bin/cloud-add-keypair +23 -0
  7. data/bin/cloud-configure +35 -0
  8. data/bin/cloud-contract +27 -0
  9. data/bin/cloud-expand +27 -0
  10. data/bin/cloud-list +32 -0
  11. data/bin/cloud-maintain +36 -0
  12. data/bin/cloud-provision +30 -0
  13. data/bin/cloud-reconfigure +24 -0
  14. data/bin/cloud-ssh +18 -0
  15. data/bin/cloud-start +29 -0
  16. data/bin/pool +23 -75
  17. data/bin/pool-console +12 -0
  18. data/bin/pool-describe +9 -0
  19. data/bin/pool-list +28 -0
  20. data/bin/pool-provision +34 -0
  21. data/bin/pool-spec +17 -0
  22. data/bin/pool-start +32 -0
  23. data/examples/basic.rb +20 -0
  24. data/examples/plugin_without_plugin_directory.rb +13 -0
  25. data/examples/poolparty.rb +12 -0
  26. data/examples/with_apache_plugin.rb +22 -0
  27. data/generators/poolspec/USAGE +5 -0
  28. data/generators/poolspec/poolspec_generator.rb +65 -0
  29. data/generators/poolspec/templates/pool_spec_template.erb +9 -0
  30. data/lib/erlang/eb_server.erl +27 -0
  31. data/lib/poolparty.rb +40 -116
  32. data/lib/poolparty/base_packages/haproxy.rb +41 -0
  33. data/lib/poolparty/base_packages/heartbeat.rb +43 -0
  34. data/lib/poolparty/base_packages/poolparty.rb +18 -0
  35. data/lib/poolparty/base_packages/ruby.rb +27 -0
  36. data/lib/poolparty/core/array.rb +24 -0
  37. data/lib/{core → poolparty/core}/exception.rb +0 -0
  38. data/lib/{core → poolparty/core}/float.rb +0 -0
  39. data/lib/poolparty/core/hash.rb +29 -0
  40. data/lib/poolparty/core/kernel.rb +34 -0
  41. data/lib/{core → poolparty/core}/module.rb +18 -0
  42. data/lib/poolparty/core/my_open_struct.rb +18 -0
  43. data/lib/poolparty/core/object.rb +54 -0
  44. data/lib/poolparty/core/proc.rb +2 -0
  45. data/lib/poolparty/core/string.rb +72 -0
  46. data/lib/poolparty/core/symbol.rb +8 -0
  47. data/lib/{core → poolparty/core}/time.rb +15 -0
  48. data/lib/poolparty/exceptions/RemoteException.rb +12 -0
  49. data/lib/poolparty/exceptions/ResourceException.rb +7 -0
  50. data/lib/poolparty/exceptions/RuntimeException.rb +7 -0
  51. data/lib/poolparty/exceptions/SpecException.rb +7 -0
  52. data/lib/poolparty/exceptions/TemplateNotFound.rb +7 -0
  53. data/lib/poolparty/helpers/binary.rb +30 -0
  54. data/lib/poolparty/helpers/console.rb +30 -0
  55. data/lib/poolparty/helpers/display.rb +25 -0
  56. data/lib/poolparty/helpers/optioner.rb +61 -0
  57. data/lib/poolparty/helpers/provisioner_base.rb +226 -0
  58. data/lib/poolparty/helpers/provisioners/master.rb +120 -0
  59. data/lib/poolparty/helpers/provisioners/slave.rb +52 -0
  60. data/lib/poolparty/modules/cloud_resourcer.rb +72 -0
  61. data/lib/poolparty/modules/configurable.rb +34 -0
  62. data/lib/poolparty/modules/definable_resource.rb +59 -0
  63. data/lib/poolparty/modules/file_writer.rb +55 -0
  64. data/lib/poolparty/modules/method_missing_sugar.rb +17 -0
  65. data/lib/poolparty/modules/output.rb +13 -0
  66. data/lib/poolparty/modules/pretty_printer.rb +38 -0
  67. data/lib/{core/string.rb → poolparty/modules/s3_string.rb} +5 -29
  68. data/lib/{modules → poolparty/modules}/safe_instance.rb +0 -0
  69. data/lib/poolparty/monitors/base_monitor.rb +16 -0
  70. data/lib/poolparty/net/remote.rb +35 -0
  71. data/lib/poolparty/net/remote_bases/ec2.rb +145 -0
  72. data/lib/poolparty/net/remote_instance.rb +68 -0
  73. data/lib/poolparty/net/remoter.rb +209 -0
  74. data/lib/poolparty/net/remoter_base.rb +117 -0
  75. data/lib/poolparty/plugins/gem_package.rb +39 -0
  76. data/lib/poolparty/plugins/line.rb +76 -0
  77. data/lib/poolparty/plugins/svn.rb +48 -0
  78. data/lib/poolparty/pool/base.rb +74 -0
  79. data/lib/poolparty/pool/cloud.rb +132 -0
  80. data/lib/poolparty/pool/custom_resource.rb +61 -0
  81. data/lib/poolparty/pool/loggable.rb +29 -0
  82. data/lib/poolparty/pool/plugin.rb +42 -0
  83. data/lib/poolparty/pool/plugin_model.rb +48 -0
  84. data/lib/poolparty/pool/pool.rb +55 -0
  85. data/lib/poolparty/pool/resource.rb +235 -0
  86. data/lib/poolparty/pool/resources/class_package.rb +60 -0
  87. data/lib/poolparty/pool/resources/cron.rb +14 -0
  88. data/lib/poolparty/pool/resources/directory.rb +23 -0
  89. data/lib/poolparty/pool/resources/exec.rb +26 -0
  90. data/lib/poolparty/pool/resources/file.rb +23 -0
  91. data/lib/poolparty/pool/resources/gem.rb +14 -0
  92. data/lib/poolparty/pool/resources/host.rb +14 -0
  93. data/lib/poolparty/pool/resources/package.rb +14 -0
  94. data/lib/poolparty/pool/resources/remote_file.rb +20 -0
  95. data/lib/poolparty/pool/resources/service.rb +21 -0
  96. data/lib/poolparty/pool/resources/sshkey.rb +19 -0
  97. data/lib/poolparty/pool/resources/variable.rb +27 -0
  98. data/lib/poolparty/pool/script.rb +21 -0
  99. data/{config/heartbeat_authkeys.conf → lib/poolparty/templates/authkeys} +0 -0
  100. data/lib/poolparty/templates/cib.xml +1 -0
  101. data/lib/poolparty/templates/fileserver.conf +4 -0
  102. data/{config/heartbeat.conf → lib/poolparty/templates/ha.cf} +3 -1
  103. data/{config → lib/poolparty/templates}/haproxy.conf +13 -6
  104. data/lib/poolparty/templates/namespaceauth.conf +19 -0
  105. data/lib/poolparty/templates/puppet.conf +13 -0
  106. data/lib/poolparty/version.rb +9 -0
  107. data/lib/poolpartycl.rb +3 -0
  108. data/script/destroy +14 -0
  109. data/script/generate +14 -0
  110. data/script/txt2html +82 -0
  111. data/{lib/poolparty/tasks → tasks}/cloud.rake +1 -1
  112. data/tasks/deployment.rake +34 -0
  113. data/tasks/development.rake +78 -0
  114. data/{lib/poolparty/tasks → tasks}/ec2.rake +1 -1
  115. data/tasks/environment.rake +7 -0
  116. data/{lib/poolparty/tasks → tasks}/instance.rake +0 -0
  117. data/{lib/poolparty/tasks → tasks}/server.rake +0 -0
  118. data/tasks/spec.rake +17 -0
  119. data/tasks/website.rake +17 -0
  120. metadata +154 -249
  121. data/CHANGELOG +0 -23
  122. data/LICENSE +0 -22
  123. data/README +0 -139
  124. data/assets/clouds.png +0 -0
  125. data/bin/instance +0 -68
  126. data/bin/poolnotify +0 -34
  127. data/config/cloud_master_takeover +0 -17
  128. data/config/create_proxy_ami.sh +0 -582
  129. data/config/installers/ubuntu_install.sh +0 -77
  130. data/config/monit.conf +0 -9
  131. data/config/monit/haproxy.monit.conf +0 -8
  132. data/config/monit/nginx.monit.conf +0 -0
  133. data/config/nginx.conf +0 -24
  134. data/config/reconfigure_instances_script.sh +0 -37
  135. data/config/sample-config.yml +0 -23
  136. data/config/scp_instances_script.sh +0 -12
  137. data/lib/core/array.rb +0 -16
  138. data/lib/core/hash.rb +0 -11
  139. data/lib/core/kernel.rb +0 -12
  140. data/lib/core/object.rb +0 -21
  141. data/lib/core/proc.rb +0 -15
  142. data/lib/helpers/plugin_spec_helper.rb +0 -58
  143. data/lib/modules/callback.rb +0 -133
  144. data/lib/modules/ec2_wrapper.rb +0 -108
  145. data/lib/modules/file_writer.rb +0 -38
  146. data/lib/modules/sprinkle_overrides.rb +0 -27
  147. data/lib/modules/vlad_override.rb +0 -83
  148. data/lib/poolparty/application.rb +0 -199
  149. data/lib/poolparty/init.rb +0 -6
  150. data/lib/poolparty/master.rb +0 -492
  151. data/lib/poolparty/monitors.rb +0 -11
  152. data/lib/poolparty/monitors/cpu.rb +0 -23
  153. data/lib/poolparty/monitors/memory.rb +0 -33
  154. data/lib/poolparty/monitors/web.rb +0 -29
  155. data/lib/poolparty/optioner.rb +0 -20
  156. data/lib/poolparty/plugin.rb +0 -78
  157. data/lib/poolparty/provider.rb +0 -104
  158. data/lib/poolparty/provider/essential.rb +0 -6
  159. data/lib/poolparty/provider/git.rb +0 -8
  160. data/lib/poolparty/provider/haproxy.rb +0 -9
  161. data/lib/poolparty/provider/heartbeat.rb +0 -6
  162. data/lib/poolparty/provider/rsync.rb +0 -8
  163. data/lib/poolparty/provider/ruby.rb +0 -65
  164. data/lib/poolparty/provider/s3fuse.rb +0 -22
  165. data/lib/poolparty/remote_instance.rb +0 -250
  166. data/lib/poolparty/remoter.rb +0 -171
  167. data/lib/poolparty/remoting.rb +0 -137
  168. data/lib/poolparty/scheduler.rb +0 -93
  169. data/lib/poolparty/tasks.rb +0 -47
  170. data/lib/poolparty/tasks/development.rake +0 -78
  171. data/lib/poolparty/tasks/plugins.rake +0 -30
  172. data/lib/poolparty/thread_pool.rb +0 -94
  173. data/lib/s3/s3_object_store_folders.rb +0 -44
  174. data/poolparty.gemspec +0 -71
  175. data/spec/files/describe_response +0 -37
  176. data/spec/files/multi_describe_response +0 -69
  177. data/spec/files/remote_desc_response +0 -37
  178. data/spec/helpers/ec2_mock.rb +0 -57
  179. data/spec/lib/core/core_spec.rb +0 -26
  180. data/spec/lib/core/kernel_spec.rb +0 -24
  181. data/spec/lib/core/string_spec.rb +0 -28
  182. data/spec/lib/modules/callback_spec.rb +0 -213
  183. data/spec/lib/modules/file_writer_spec.rb +0 -74
  184. data/spec/lib/poolparty/application_spec.rb +0 -135
  185. data/spec/lib/poolparty/ec2_wrapper_spec.rb +0 -110
  186. data/spec/lib/poolparty/master_spec.rb +0 -479
  187. data/spec/lib/poolparty/optioner_spec.rb +0 -34
  188. data/spec/lib/poolparty/plugin_spec.rb +0 -115
  189. data/spec/lib/poolparty/poolparty_spec.rb +0 -60
  190. data/spec/lib/poolparty/provider_spec.rb +0 -74
  191. data/spec/lib/poolparty/remote_instance_spec.rb +0 -178
  192. data/spec/lib/poolparty/remoter_spec.rb +0 -72
  193. data/spec/lib/poolparty/remoting_spec.rb +0 -148
  194. data/spec/lib/poolparty/scheduler_spec.rb +0 -70
  195. data/spec/monitors/cpu_monitor_spec.rb +0 -39
  196. data/spec/monitors/memory_spec.rb +0 -51
  197. data/spec/monitors/misc_monitor_spec.rb +0 -51
  198. data/spec/monitors/web_spec.rb +0 -40
  199. data/spec/spec_helper.rb +0 -53
data/History.txt ADDED
@@ -0,0 +1,22 @@
1
+ == 0.2 2008-09-02
2
+ * Finished new syntax rewrite
3
+
4
+ == 0.1.2 2008-08-05
5
+ * Added development tasks for easy setup
6
+ * Updated Scheduler to include ThreadPool for threaded safety
7
+ * Added poolnotify
8
+ * Updating gem on github
9
+ * Changed configuration style to rsync all files across every instance
10
+ * Moved configuration back to a configure scrip
11
+ * Added in vlad configuration
12
+ * Added plugin ability to install custom software
13
+ * Updated configuration style
14
+ * Added cloud_list to pool
15
+ * Changed listing of the clouds through pool
16
+ * Added plugin_manager
17
+ * Moved remoting to rake remote task (from vlad)
18
+ * Changed configuration from instance-based to cloud-based
19
+ * Updated source
20
+ * Plugin support
21
+ * Cleaned up base
22
+ * Extensible monitoring
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Ari Lerner
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.txt ADDED
@@ -0,0 +1,52 @@
1
+ = PoolParty
2
+
3
+ http://poolpartyrb.com
4
+
5
+ == DESCRIPTION:
6
+
7
+ COMING SOON
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ COMING SOON
12
+
13
+ == SYNOPSIS:
14
+
15
+ poolparty is written with the intention of being as application-agnostic as possible. It installs only the basic
16
+ required software to glue the cloud together on the instances as listed below.
17
+
18
+ poolparty is easily configuration. In fact, it makes little assumptions about your development environment and allows
19
+ several options on how to begin configuring the cloud.
20
+
21
+ == REQUIREMENTS:
22
+
23
+ COMING SOON
24
+
25
+ == INSTALL:
26
+
27
+ sudo gem install auser-poolparty
28
+
29
+ == LICENSE:
30
+
31
+ (The MIT License)
32
+
33
+ Copyright (c) 2008 Ari Lerner
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining
36
+ a copy of this software and associated documentation files (the
37
+ 'Software'), to deal in the Software without restriction, including
38
+ without limitation the rights to use, copy, modify, merge, publish,
39
+ distribute, sublicense, and/or sell copies of the Software, and to
40
+ permit persons to whom the Software is furnished to do so, subject to
41
+ the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be
44
+ included in all copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,109 +1,4 @@
1
- require 'rubygems'
2
- require "./lib/poolparty"
3
-
4
- begin
5
- require 'echoe'
6
-
7
- Echoe.new("poolparty") do |s|
8
- s.author = ["Ari Lerner"]
9
- s.rubyforge_name = "poolparty"
10
- s.email = "ari.lerner@citrusbyte.com"
11
- s.summary = "Run your entire application off EC2, managed and auto-scaling"
12
- s.url = "http://poolpartyrb.com"
13
- s.dependencies = ["aws-s3", "amazon-ec2", "auser-aska", "git", "sprinkle", "SystemTimer", "open4"]
14
- s.install_message = %q{
15
-
16
- Get ready to jump in the pool, you just installed PoolParty!
17
-
18
- Please check out the documentation for any questions or check out the google groups at
19
- http://groups.google.com/group/poolpartyrb
20
-
21
- Don't forget to check out the plugin tutorial @ http://poolpartyrb.com for extending PoolParty!
22
-
23
- For more information, check http://poolpartyrb.com
24
- On IRC:
25
- irc.freenode.net
26
- #poolpartyrb
27
-
28
- *** Ari Lerner @ <ari.lerner@citrusbyte.com> ***
29
- }
30
- end
31
- rescue LoadError => boom
32
- puts "You are missing a dependency required for meta-operations on this gem."
33
- end
34
-
35
- PoolParty.include_tasks
36
-
37
- # add spec tasks, if you have rspec installed
38
- begin
39
- require 'spec/rake/spectask'
40
-
41
- Spec::Rake::SpecTask.new("spec") do |t|
42
- t.spec_files = FileList['spec/**/*_spec.rb']
43
- t.spec_opts = ['--color']
44
- end
45
-
46
- Spec::Rake::SpecTask.new("rcov_spec") do |t|
47
- t.spec_files = FileList['spec/**/*_spec.rb']
48
- t.spec_opts = ['--color']
49
- t.rcov = true
50
- t.rcov_opts = ['--exclude', '^spec,/gems/']
51
- end
52
- end
53
-
54
- namespace(:pkg) do
55
- ## Rake task to create/update a .manifest file in your project, as well as update *.gemspec
56
- desc %{Update ".manifest" with the latest list of project filenames. Respect\
57
- .gitignore by excluding everything that git ignores. Update `files` and\
58
- `test_files` arrays in "*.gemspec" file if it's present.}
59
- task :manifest do
60
- list = Dir['**/*'].sort
61
- spec_file = Dir['*.gemspec'].first
62
- list -= [spec_file] if spec_file
63
-
64
- File.read('.gitignore').each_line do |glob|
65
- glob = glob.chomp.sub(/^\//, '')
66
- list -= Dir[glob]
67
- list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
68
- puts "excluding #{glob}"
69
- end
70
-
71
- if spec_file
72
- spec = File.read spec_file
73
- spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
74
- assignment = $1
75
- bunch = $2 ? list.grep(/^test\//) : list
76
- '%s%%w(%s)' % [assignment, bunch.join(' ')]
77
- end
78
-
79
- File.open(spec_file, 'w') {|f| f << spec }
80
- end
81
- File.open('Manifest', 'w') {|f| f << list.join("\n") }
82
- end
83
- desc "Build gemspec for github"
84
- task :gemspec => [:manifest, :gem] do
85
- require "yaml"
86
- data = YAML.load(open("poolparty.gemspec").read).to_ruby
87
- File.open("poolparty.gemspec", "w+") {|f| f << data }
88
- end
89
- desc "Update gemspec with the time"
90
- task :gemspec_update => :gemspec do
91
- data = open("poolparty.gemspec").read
92
- str = "Updated at #{Time.now.strftime("%I:%M%p, %D")}"
93
-
94
- if data.scan(/Updated at/).empty?
95
- data = data.gsub(/you just installed PoolParty\!/, '\0'+" (#{str})")
96
- end
97
-
98
- File.open("poolparty.gemspec", "w+") {|f| f << data }
99
- end
100
- desc "Get ready to release the gem"
101
- task :prerelease => [:gemspec_update] do
102
- `git add .`
103
- `git ci -a -m "Updated gemspec for github"`
104
- end
105
- desc "Release them gem to the gem server"
106
- task :release => [:prerelease] do
107
- `git push origin master`
108
- end
109
- end
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/cloud ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/ruby
2
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+ require "poolparty"
4
+ require "poolpartycl"
5
+
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 }
9
+ # end
10
+
11
+ name = ARGV.shift
12
+
13
+ # If there was no program action given
14
+ if !name || name == "-h" || name == "--help"
15
+ puts "Usage: cloud <specfile> <action> <options>"
16
+ puts "Cloud actions:"
17
+ puts Binary.list_binaries_for("cloud")
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("cloud").include?(name)
28
+ exec "#{command_line}"
29
+ else
30
+ puts "Unknown poolparty binary: #{program_name}"
31
+ end
@@ -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
@@ -0,0 +1,35 @@
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, :provision_class => @provision_class}) do
20
+ logger.info header("Provisioning cloud #{name}")
21
+ prepare_to_configuration
22
+
23
+ logger.info subheader("Building configuration file")
24
+ build_and_store_new_config_file
25
+
26
+ if provision_class == "master" || provision_class == "all"
27
+ Provisioner.configure_master(self, testing)
28
+ end
29
+ if provision_class == "slave" || provision_class == "all"
30
+ Provisioner.configure_slaves(self, testing)
31
+ end
32
+
33
+ clear_base_directory unless testing
34
+ end
35
+ end
@@ -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
@@ -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}) 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
@@ -0,0 +1,30 @@
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
+ if provision_class == "master" || provision_class == "all"
22
+ Provisioner.provision_master(self, testing)
23
+ end
24
+ if provision_class == "slave" || provision_class == "all"
25
+ Provisioner.provision_slaves(self, testing)
26
+ end
27
+
28
+ clear_base_directory unless testing
29
+ end
30
+ end