Skip to content
Browse files

merge deps_remoter_merge branch.

This brings in the several core changes:
# Provides a properties_hash which represents the defined state of our pool.
# First phase of chef support
# New, simpler bootstrapping and provisioning system
# Redesigned remoter_bases to more easily add alternate remoter bases thru subclassing of the base RemoterBase class.
# break out specific functionality into gems where possible
## dslify
## parenting
## Suitcase, a new gem for packaging up dependencies to a directory or tarball
  • Loading branch information...
1 parent c56fac3 commit 18ba929f769d7b5ace2da030c6a1c8caf70cdf3b @fairchild fairchild committed with Apr 1, 2009
Showing with 3,894 additions and 3,960 deletions.
  1. +8 −2 .gitignore
  2. +9 −0 .gitmodules
  3. +1 −1 License.txt
  4. +0 −404 Manifest.txt
  5. +1 −1 README.txt
  6. +13 −37 Rakefile
  7. +6 −0 TODO.textile
  8. +4 −0 VERSION.yml
  9. +21 −0 bin/cloud-bootstrap
  10. +11 −6 bin/cloud-configure
  11. 0 bin/{pool-console → cloud-console}
  12. +9 −12 bin/cloud-list
  13. +13 −23 bin/cloud-provision
  14. +2 −1 bin/cloud-spec
  15. +11 −3 bin/cloud-ssh
  16. +26 −22 bin/cloud-start
  17. +1 −1 bin/cloud-terminate
  18. +23 −0 bin/ec2-list-active
  19. +1 −1 bin/server-become-master
  20. +1 −1 bin/server-clean-cert-for
  21. +1 −2 bin/server-ensure-provisioning
  22. +9 −12 bin/server-get-load
  23. +9 −13 bin/server-list-active
  24. +0 −24 bin/server-list-responding
  25. +1 −1 bin/server-query-agent
  26. +1 −1 bin/server-rerun
  27. +1 −1 bin/server-update-hosts
  28. +1 −1 bin/server-write-new-nodes
  29. +0 −116 config/hoe.rb
  30. +40 −0 config/jeweler.rb
  31. +1 −9 config/requirements.rb
  32. +9 −6 examples/basic.rb
  33. +22 −0 examples/default.rb
  34. +56 −0 examples/fairchild.rb
  35. +34 −0 examples/suspenders.conf.erb
  36. +1 −9 generators/poolspec/poolspec_generator.rb
  37. +1 −1 lib/erlang/messenger/Rakefile
  38. +1 −1 lib/erlang/messenger/src/pm_node.erl
  39. +0 −1 lib/erlang/messenger/src/utils.erl
  40. +69 −17 lib/poolparty.rb
  41. +32 −29 lib/poolparty/base_packages/haproxy.rb
  42. +45 −62 lib/poolparty/base_packages/heartbeat.rb
  43. +76 −86 lib/poolparty/base_packages/poolparty.rb
  44. +4 −4 lib/poolparty/base_packages/ruby.rb
  45. +1 −1 lib/poolparty/base_packages/runit.rb
  46. +2 −1 lib/poolparty/capistrano.rb
  47. +9 −3 lib/poolparty/core/array.rb
  48. +16 −12 lib/poolparty/core/hash.rb
  49. +12 −8 lib/poolparty/core/kernel.rb
  50. +20 −21 lib/poolparty/core/object.rb
  51. +39 −13 lib/poolparty/core/string.rb
  52. +49 −0 lib/poolparty/dependencies.rb
  53. +0 −12 lib/poolparty/dependency_resolutions/base.rb
  54. +37 −0 lib/poolparty/dependency_resolver/dependency_resolver.rb
  55. +28 −0 lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb
  56. +29 −28 lib/poolparty/{dependency_resolutions → dependency_resolver}/puppet.rb
  57. +162 −0 lib/poolparty/dependency_resolver/puppet_resolver.rb
  58. +5 −0 lib/poolparty/exceptions/dependency_resolver_exception.rb
  59. +7 −0 lib/poolparty/exceptions/package_exception.rb
  60. +7 −7 lib/poolparty/extra/deployments.rb
  61. +6 −7 lib/poolparty/helpers/binary.rb
  62. +1 −5 lib/poolparty/helpers/display.rb
  63. +44 −0 lib/poolparty/helpers/hash_printer.rb
  64. +26 −19 lib/poolparty/helpers/optioner.rb
  65. +13 −0 lib/poolparty/lite.rb
  66. +6 −0 lib/poolparty/modules/cloud_dsl.rb
  67. +48 −112 lib/poolparty/modules/cloud_resourcer.rb
  68. +0 −36 lib/poolparty/modules/configurable.rb
  69. +1 −1 lib/poolparty/modules/daemonizable.rb
  70. +7 −10 lib/poolparty/modules/definable_resource.rb
  71. +13 −13 lib/poolparty/modules/file_writer.rb
  72. +0 −58 lib/poolparty/modules/method_missing_sugar.rb
  73. +1 −1 lib/poolparty/modules/pretty_printer.rb
  74. +25 −44 lib/poolparty/modules/resourcing_dsl.rb
  75. +2 −10 lib/poolparty/monitors/base_monitor.rb
  76. +11 −0 lib/poolparty/net/init.rb
  77. +1 −18 lib/poolparty/net/messenger.rb
  78. +0 −38 lib/poolparty/net/remote.rb
  79. +21 −0 lib/poolparty/net/remote_bases.rb
  80. +35 −27 lib/poolparty/net/remote_instance.rb
  81. +0 −313 lib/poolparty/net/remoter.rb
  82. +233 −0 lib/poolparty/net/remoter/cloud_control.rb
  83. +164 −0 lib/poolparty/net/remoter/connections.rb
  84. +121 −0 lib/poolparty/net/remoter/interactive.rb
  85. +12 −0 lib/poolparty/net/remoter/lists.rb
  86. +41 −124 lib/poolparty/net/remoter_base.rb
  87. +67 −43 lib/poolparty/net/{remote_bases → remoter_bases/ec2}/ec2.rb
  88. +53 −0 lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb
  89. 0 lib/poolparty/net/{remote_bases → remoter_bases}/ec2/ec2_response_object.rb
  90. +119 −0 lib/poolparty/plugins/chef.rb
  91. +12 −11 lib/poolparty/plugins/deploydirectory.rb
  92. +17 −16 lib/poolparty/plugins/git.rb
  93. +0 −77 lib/poolparty/plugins/line.rb
  94. +2 −3 lib/poolparty/plugins/rsyncmirror.rb
  95. +141 −97 lib/poolparty/poolparty/cloud.rb
  96. +2 −2 lib/poolparty/poolparty/custom_resource.rb
  97. +41 −16 lib/poolparty/poolparty/{base.rb → default.rb}
  98. +48 −0 lib/poolparty/poolparty/key.rb
  99. +28 −27 lib/poolparty/poolparty/loggable.rb
  100. +69 −0 lib/poolparty/poolparty/neighborhoods.rb
  101. +39 −19 lib/poolparty/poolparty/plugin.rb
  102. +18 −21 lib/poolparty/poolparty/plugin_model.rb
  103. +23 −24 lib/poolparty/poolparty/pool.rb
  104. +185 −0 lib/poolparty/poolparty/poolparty_base_class.rb
  105. +74 −176 lib/poolparty/poolparty/resource.rb
  106. +0 −112 lib/poolparty/poolparty/resources/class_package.rb
  107. +0 −67 lib/poolparty/poolparty/resources/conditional.rb
  108. +0 −23 lib/poolparty/poolparty/resources/file.rb
  109. +0 −24 lib/poolparty/poolparty/resources/package.rb
  110. +0 −26 lib/poolparty/poolparty/resources/remote_file.rb
  111. +0 −23 lib/poolparty/poolparty/resources/sshkey.rb
  112. +0 −31 lib/poolparty/poolparty/resources/symlink.rb
  113. +0 −32 lib/poolparty/poolparty/resources/variable.rb
  114. +17 −9 lib/poolparty/poolparty/script.rb
  115. +34 −0 lib/poolparty/poolparty/service.rb
  116. +18 −0 lib/poolparty/poolparty/template.rb
  117. +100 −0 lib/poolparty/provision/boot_strapper.rb
  118. +17 −0 lib/poolparty/provision/configurations/chef.rb
  119. +28 −0 lib/poolparty/provision/configurations/puppet.rb
  120. +71 −0 lib/poolparty/provision/dr_configure.rb
  121. +20 −19 lib/poolparty/provisioners/capistrano/capistrano.rb
  122. +20 −13 lib/poolparty/provisioners/capistrano/capistrano_configurer.rb
  123. +21 −0 lib/poolparty/provisioners/capistrano/recipes/aws.rb
  124. +69 −56 lib/poolparty/provisioners/capistrano/{recipies → recipes}/base.rb
  125. +66 −0 lib/poolparty/provisioners/capistrano/recipes/master.rb
  126. +101 −0 lib/poolparty/provisioners/capistrano/recipes/puppet.rb
  127. +5 −9 lib/poolparty/provisioners/capistrano/{recipies → recipes}/slave.rb
  128. +0 −112 lib/poolparty/provisioners/capistrano/recipies/master.rb
  129. +50 −44 lib/poolparty/provisioners/provisioner_base.rb
  130. 0 lib/poolparty/{poolparty → }/resources/cron.rb
  131. +1 −1 lib/poolparty/{poolparty → }/resources/custom_service.rb
  132. +1 −10 lib/poolparty/{poolparty → }/resources/directory.rb
  133. +6 −9 lib/poolparty/{poolparty → }/resources/exec.rb
  134. +25 −0 lib/poolparty/resources/file.rb
  135. +4 −2 lib/poolparty/{poolparty → }/resources/host.rb
  136. +17 −0 lib/poolparty/resources/line.rb
  137. +5 −6 lib/poolparty/{poolparty → }/resources/mount.rb
  138. +12 −0 lib/poolparty/resources/package.rb
  139. +20 −0 lib/poolparty/resources/remote_file.rb
  140. +1 −2 lib/poolparty/{poolparty → }/resources/service.rb
  141. +27 −0 lib/poolparty/resources/sshkey.rb
  142. +21 −0 lib/poolparty/resources/symlink.rb
  143. +1 −5 lib/poolparty/{poolparty/resources/remote_user.rb → resources/user.rb}
  144. +13 −0 lib/poolparty/resources/variable.rb
  145. +64 −0 lib/poolparty/schema.rb
  146. +0 −59 lib/poolparty/server/agent.rb
  147. +46 −0 lib/poolparty/services/conditional.rb
  148. +12 −10 lib/poolparty/{poolparty/resources → services}/gem_package.rb
  149. +2 −5 lib/poolparty/spec.rb
  150. +6 −0 lib/poolparty/templates/erlang_cookie_maker
  151. +11 −0 lib/poolparty/templates/gemrc
  152. +1 −1 lib/poolparty/templates/ha.cf
  153. +0 −28 lib/poolparty/templates/puppet.conf
  154. +6 −0 lib/poolparty/templates/puppet/add_puppet_to_hosts
  155. +2 −0 lib/poolparty/templates/puppet/puppet.conf
  156. +14 −0 lib/poolparty/templates/puppet/puppetrunner
  157. +4 −0 lib/poolparty/templates/puppet/site.pp
  158. +0 −12 lib/poolparty/templates/puppetcleaner
  159. +0 −22 lib/poolparty/templates/puppetrerun
  160. +0 −11 lib/poolparty/templates/puppetrunner
  161. BIN pkg/poolparty-1.0.1.gem
  162. BIN pkg/poolparty.gem
  163. +45 −572 poolparty.gemspec
  164. +1 −1 script/destroy
  165. +1 −1 script/generate
  166. +0 −82 script/txt2html
  167. +7 −0 spec/bin/bin_spec_helper.rb
  168. +19 −0 spec/bin/fixtures/bin_cloud_for_test.rb
  169. +22 −0 spec/bin/server-list-active_spec.rb
  170. +5 −5 spec/poolparty/aska/aska_spec.rb
  171. +2 −8 spec/poolparty/base_packages/haproxy_spec.rb
  172. +3 −26 spec/poolparty/base_packages/heartbeat_spec.rb
  173. +6 −23 spec/poolparty/bin/console_spec.rb
  174. +18 −3 spec/poolparty/core/array_spec.rb
  175. +24 −30 spec/poolparty/core/hash_spec.rb
  176. +2 −3 spec/poolparty/core/object_spec.rb
  177. +1 −27 spec/poolparty/core/string_spec.rb
  178. +11 −0 spec/poolparty/dependencies_spec.rb
  179. +0 −11 spec/poolparty/dependency_resolutions/base_spec.rb
Sorry, we could not display the entire diff because it was too big.
View
10 .gitignore
@@ -1,4 +1,5 @@
-tmp/*
+.com.apple.timemachine.supported
+.DS_Store
*tmp*
pkg/*.tgz
pkg/poolparty*/*
@@ -10,4 +11,9 @@ test_manifest.pp
# erl_crash.dump
*erl_crash.dump*
log
-*.beam
+*.beam
+ri/
+doc/
+config/manifest.pp
+vendor/dependencies/cache
+vendor/dependencies/packages
View
9 .gitmodules
@@ -0,0 +1,9 @@
+[submodule "vendor/gems/parenting"]
+ path = vendor/gems/parenting
+ url = git://github.com/auser/parenting.git
+[submodule "vendor/gems/dslify"]
+ path = vendor/gems/dslify
+ url = git://github.com/auser/dslify.git
+[submodule "vendor/gems/suitcase"]
+ path = vendor/gems/suitcase
+ url = git://github.com/auser/suitcase.git
View
2 License.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2008 Ari Lerner
+Copyright (c) 2009 Ari Lerner
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
404 Manifest.txt
@@ -1,404 +0,0 @@
-Capfile
-History.txt
-License.txt
-Manifest.txt
-PostInstall.txt
-README.txt
-Rakefile
-bin/cloud
-bin/cloud-add-access
-bin/cloud-add-keypair
-bin/cloud-configure
-bin/cloud-contract
-bin/cloud-expand
-bin/cloud-handle-load
-bin/cloud-list
-bin/cloud-maintain
-bin/cloud-osxcopy
-bin/cloud-provision
-bin/cloud-refresh
-bin/cloud-rsync
-bin/cloud-run
-bin/cloud-setup-dev
-bin/cloud-spec
-bin/cloud-ssh
-bin/cloud-start
-bin/cloud-stats
-bin/cloud-terminate
-bin/messenger-get-current-nodes
-bin/pool
-bin/pool-console
-bin/pool-describe
-bin/pool-generate
-bin/pool-init
-bin/pool-list
-bin/pool-start
-bin/server-become-master
-bin/server-build-messenger
-bin/server-clean-cert-for
-bin/server-ensure-provisioning
-bin/server-fire-cmd
-bin/server-get-load
-bin/server-list-active
-bin/server-list-responding
-bin/server-provision
-bin/server-query-agent
-bin/server-rerun
-bin/server-send-command
-bin/server-show-stats
-bin/server-start-agent
-bin/server-start-client
-bin/server-start-master
-bin/server-start-node
-bin/server-stop-client
-bin/server-stop-master
-bin/server-stop-node
-bin/server-update-hosts
-bin/server-write-new-nodes
-config/hoe.rb
-config/requirements.rb
-examples/basic.rb
-examples/deploy.rb
-examples/plugin_without_plugin_directory.rb
-examples/poolparty.rb
-generators/poolspec/USAGE
-generators/poolspec/poolspec_generator.rb
-generators/poolspec/templates/pool_spec_template.erb
-lib/erlang/messenger/Emakefile
-lib/erlang/messenger/Makefile
-lib/erlang/messenger/README
-lib/erlang/messenger/Rakefile
-lib/erlang/messenger/control
-lib/erlang/messenger/ebin/client.app
-lib/erlang/messenger/ebin/master.app
-lib/erlang/messenger/ebin/node.app
-lib/erlang/messenger/ebin/packager.app
-lib/erlang/messenger/ebin/pm_client_rel-0.1.rel
-lib/erlang/messenger/ebin/pm_master_rel-0.1.rel
-lib/erlang/messenger/ebin/pm_node_rel-0.1.rel
-lib/erlang/messenger/include/defines.hrl
-lib/erlang/messenger/lib/eunit/AUTHORS
-lib/erlang/messenger/lib/eunit/CHANGELOG
-lib/erlang/messenger/lib/eunit/COPYING
-lib/erlang/messenger/lib/eunit/Makefile
-lib/erlang/messenger/lib/eunit/NOTES
-lib/erlang/messenger/lib/eunit/README
-lib/erlang/messenger/lib/eunit/doc/edoc-info
-lib/erlang/messenger/lib/eunit/doc/erlang.png
-lib/erlang/messenger/lib/eunit/doc/eunit.html
-lib/erlang/messenger/lib/eunit/doc/index.html
-lib/erlang/messenger/lib/eunit/doc/modules-frame.html
-lib/erlang/messenger/lib/eunit/doc/overview-summary.html
-lib/erlang/messenger/lib/eunit/doc/overview.edoc
-lib/erlang/messenger/lib/eunit/doc/packages-frame.html
-lib/erlang/messenger/lib/eunit/doc/stylesheet.css
-lib/erlang/messenger/lib/eunit/ebin/autoload.beam
-lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit.app
-lib/erlang/messenger/lib/eunit/ebin/eunit.appup
-lib/erlang/messenger/lib/eunit/ebin/eunit.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam
-lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam
-lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam
-lib/erlang/messenger/lib/eunit/examples/eunit_examples.erl
-lib/erlang/messenger/lib/eunit/examples/fib.erl
-lib/erlang/messenger/lib/eunit/examples/tests.txt
-lib/erlang/messenger/lib/eunit/include/eunit.hrl
-lib/erlang/messenger/lib/eunit/src/Makefile
-lib/erlang/messenger/lib/eunit/src/autoload.erl
-lib/erlang/messenger/lib/eunit/src/code_monitor.erl
-lib/erlang/messenger/lib/eunit/src/eunit.app.src
-lib/erlang/messenger/lib/eunit/src/eunit.appup.src
-lib/erlang/messenger/lib/eunit/src/eunit.erl
-lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl
-lib/erlang/messenger/lib/eunit/src/eunit_data.erl
-lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl
-lib/erlang/messenger/lib/eunit/src/eunit_lib.erl
-lib/erlang/messenger/lib/eunit/src/eunit_proc.erl
-lib/erlang/messenger/lib/eunit/src/eunit_serial.erl
-lib/erlang/messenger/lib/eunit/src/eunit_server.erl
-lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl
-lib/erlang/messenger/lib/eunit/src/eunit_test.erl
-lib/erlang/messenger/lib/eunit/src/eunit_tests.erl
-lib/erlang/messenger/lib/eunit/src/eunit_tty.erl
-lib/erlang/messenger/lib/eunit/src/file_monitor.erl
-lib/erlang/messenger/lib/eunit/sys.config
-lib/erlang/messenger/lib/eunit/vsn.mk
-lib/erlang/messenger/pm_client_rel-0.1.boot
-lib/erlang/messenger/pm_client_rel-0.1.script
-lib/erlang/messenger/pm_master_rel-0.1.boot
-lib/erlang/messenger/pm_master_rel-0.1.script
-lib/erlang/messenger/pm_node_rel-0.1.boot
-lib/erlang/messenger/pm_node_rel-0.1.script
-lib/erlang/messenger/src/client_app.erl
-lib/erlang/messenger/src/client_server.erl
-lib/erlang/messenger/src/master_app.erl
-lib/erlang/messenger/src/node_app.erl
-lib/erlang/messenger/src/pm_client.erl
-lib/erlang/messenger/src/pm_client_supervisor.erl
-lib/erlang/messenger/src/pm_cluster.erl
-lib/erlang/messenger/src/pm_event_manager.erl
-lib/erlang/messenger/src/pm_master.erl
-lib/erlang/messenger/src/pm_master_event_handler.erl
-lib/erlang/messenger/src/pm_master_supervisor.erl
-lib/erlang/messenger/src/pm_node.erl
-lib/erlang/messenger/src/pm_node_supervisor.erl
-lib/erlang/messenger/src/pm_packager.erl
-lib/erlang/messenger/src/pm_spawner.erl
-lib/erlang/messenger/src/pm_strings.erl
-lib/erlang/messenger/src/utils.erl
-lib/erlang/messenger/useful_snippets
-lib/poolparty.rb
-lib/poolparty/aska/aska.rb
-lib/poolparty/base_packages/haproxy.rb
-lib/poolparty/base_packages/heartbeat.rb
-lib/poolparty/base_packages/poolparty.rb
-lib/poolparty/base_packages/ruby.rb
-lib/poolparty/base_packages/runit.rb
-lib/poolparty/capistrano.rb
-lib/poolparty/capistrano/cloud_tasks.rb
-lib/poolparty/config/postlaunchmessage.txt
-lib/poolparty/core/array.rb
-lib/poolparty/core/class.rb
-lib/poolparty/core/exception.rb
-lib/poolparty/core/float.rb
-lib/poolparty/core/hash.rb
-lib/poolparty/core/kernel.rb
-lib/poolparty/core/metaid.rb
-lib/poolparty/core/module.rb
-lib/poolparty/core/my_open_struct.rb
-lib/poolparty/core/object.rb
-lib/poolparty/core/proc.rb
-lib/poolparty/core/string.rb
-lib/poolparty/core/symbol.rb
-lib/poolparty/core/time.rb
-lib/poolparty/dependency_resolutions/base.rb
-lib/poolparty/dependency_resolutions/puppet.rb
-lib/poolparty/exceptions/CloudNotFoundException.rb
-lib/poolparty/exceptions/LoadRulesException.rb
-lib/poolparty/exceptions/MasterException.rb
-lib/poolparty/exceptions/ProvisionerException.rb
-lib/poolparty/exceptions/RemoteException.rb
-lib/poolparty/exceptions/ResourceException.rb
-lib/poolparty/exceptions/RuntimeException.rb
-lib/poolparty/exceptions/SpecException.rb
-lib/poolparty/exceptions/TemplateNotFound.rb
-lib/poolparty/exceptions/UnacceptableCommand.rb
-lib/poolparty/extra/deployments.rb
-lib/poolparty/helpers/binary.rb
-lib/poolparty/helpers/console.rb
-lib/poolparty/helpers/display.rb
-lib/poolparty/helpers/loading.rb
-lib/poolparty/helpers/nice_printer.rb
-lib/poolparty/helpers/optioner.rb
-lib/poolparty/helpers/ruberl.rb
-lib/poolparty/modules/cloud_dsl.rb
-lib/poolparty/modules/cloud_resourcer.rb
-lib/poolparty/modules/configurable.rb
-lib/poolparty/modules/daemonizable.rb
-lib/poolparty/modules/definable_resource.rb
-lib/poolparty/modules/file_writer.rb
-lib/poolparty/modules/method_missing_sugar.rb
-lib/poolparty/modules/output.rb
-lib/poolparty/modules/pretty_printer.rb
-lib/poolparty/modules/resourcing_dsl.rb
-lib/poolparty/modules/s3_string.rb
-lib/poolparty/modules/safe_instance.rb
-lib/poolparty/modules/thread_pool.rb
-lib/poolparty/monitors/base_monitor.rb
-lib/poolparty/monitors/monitors/cpu_monitor.rb
-lib/poolparty/monitors/monitors/memory_monitor.rb
-lib/poolparty/monitors/monitors/web_monitor.rb
-lib/poolparty/net/messenger.rb
-lib/poolparty/net/remote.rb
-lib/poolparty/net/remote_bases/ec2.rb
-lib/poolparty/net/remote_bases/ec2/ec2_response_object.rb
-lib/poolparty/net/remote_instance.rb
-lib/poolparty/net/remoter.rb
-lib/poolparty/net/remoter_base.rb
-lib/poolparty/plugins/deploydirectory.rb
-lib/poolparty/plugins/git.rb
-lib/poolparty/plugins/line.rb
-lib/poolparty/plugins/rsyncmirror.rb
-lib/poolparty/plugins/runit.rb
-lib/poolparty/plugins/svn.rb
-lib/poolparty/poolparty/base.rb
-lib/poolparty/poolparty/cloud.rb
-lib/poolparty/poolparty/custom_resource.rb
-lib/poolparty/poolparty/loggable.rb
-lib/poolparty/poolparty/plugin.rb
-lib/poolparty/poolparty/plugin_model.rb
-lib/poolparty/poolparty/pool.rb
-lib/poolparty/poolparty/resource.rb
-lib/poolparty/poolparty/resources/class_package.rb
-lib/poolparty/poolparty/resources/conditional.rb
-lib/poolparty/poolparty/resources/cron.rb
-lib/poolparty/poolparty/resources/custom_service.rb
-lib/poolparty/poolparty/resources/directory.rb
-lib/poolparty/poolparty/resources/exec.rb
-lib/poolparty/poolparty/resources/file.rb
-lib/poolparty/poolparty/resources/gem_package.rb
-lib/poolparty/poolparty/resources/host.rb
-lib/poolparty/poolparty/resources/mount.rb
-lib/poolparty/poolparty/resources/package.rb
-lib/poolparty/poolparty/resources/remote_file.rb
-lib/poolparty/poolparty/resources/remote_user.rb
-lib/poolparty/poolparty/resources/service.rb
-lib/poolparty/poolparty/resources/sshkey.rb
-lib/poolparty/poolparty/resources/symlink.rb
-lib/poolparty/poolparty/resources/variable.rb
-lib/poolparty/poolparty/script.rb
-lib/poolparty/provisioners/capistrano/capistrano.rb
-lib/poolparty/provisioners/capistrano/capistrano_configurer.rb
-lib/poolparty/provisioners/capistrano/recipies/base.rb
-lib/poolparty/provisioners/capistrano/recipies/master.rb
-lib/poolparty/provisioners/capistrano/recipies/slave.rb
-lib/poolparty/provisioners/provisioner_base.rb
-lib/poolparty/server/agent.rb
-lib/poolparty/spec.rb
-lib/poolparty/spec/core/string.rb
-lib/poolparty/spec/matchers/a_spec_extensions_base.rb
-lib/poolparty/spec/matchers/have_cron.rb
-lib/poolparty/spec/matchers/have_deploydirectory.rb
-lib/poolparty/spec/matchers/have_directory.rb
-lib/poolparty/spec/matchers/have_exec.rb
-lib/poolparty/spec/matchers/have_file.rb
-lib/poolparty/spec/matchers/have_gempackage.rb
-lib/poolparty/spec/matchers/have_git.rb
-lib/poolparty/spec/matchers/have_host.rb
-lib/poolparty/spec/matchers/have_mount.rb
-lib/poolparty/spec/matchers/have_package.rb
-lib/poolparty/spec/matchers/have_remotefile.rb
-lib/poolparty/spec/matchers/have_rsyncmirror.rb
-lib/poolparty/spec/matchers/have_service.rb
-lib/poolparty/spec/matchers/have_sshkey.rb
-lib/poolparty/spec/matchers/have_symlink.rb
-lib/poolparty/spec/matchers/have_variable.rb
-lib/poolparty/spec/spec/dynamic_matchers.rb
-lib/poolparty/spec/spec/ensure_matchers_exist.rb
-lib/poolparty/spec/templates/have_base.rb
-lib/poolparty/templates/authkeys
-lib/poolparty/templates/cib.xml
-lib/poolparty/templates/gem
-lib/poolparty/templates/ha.cf
-lib/poolparty/templates/haproxy.conf
-lib/poolparty/templates/haresources
-lib/poolparty/templates/logd.cf
-lib/poolparty/templates/messenger/client/log-run.erb
-lib/poolparty/templates/messenger/client/run.erb
-lib/poolparty/templates/messenger/master/log-run.erb
-lib/poolparty/templates/messenger/master/run.erb
-lib/poolparty/templates/messenger/node/log-run.erb
-lib/poolparty/templates/messenger/node/run.erb
-lib/poolparty/templates/namespaceauth.conf
-lib/poolparty/templates/poolparty.monitor
-lib/poolparty/templates/puppet.conf
-lib/poolparty/templates/puppetcleaner
-lib/poolparty/templates/puppetrerun
-lib/poolparty/templates/puppetrunner
-lib/poolparty/templates/yaws.conf
-lib/poolparty/version.rb
-lib/poolpartycl.rb
-log/pool.log
-poolparty.gemspec
-script/destroy
-script/generate
-script/txt2html
-setup.rb
-spec/poolparty/aska/aska_spec.rb
-spec/poolparty/base_packages/haproxy_spec.rb
-spec/poolparty/base_packages/heartbeat_spec.rb
-spec/poolparty/bin/console_spec.rb
-spec/poolparty/core/array_spec.rb
-spec/poolparty/core/float.rb
-spec/poolparty/core/hash_spec.rb
-spec/poolparty/core/kernel_spec.rb
-spec/poolparty/core/module_spec.rb
-spec/poolparty/core/object_spec.rb
-spec/poolparty/core/string_spec.rb
-spec/poolparty/core/time_spec.rb
-spec/poolparty/dependency_resolutions/base_spec.rb
-spec/poolparty/extra/deployments_spec.rb
-spec/poolparty/helpers/binary_spec.rb
-spec/poolparty/helpers/display_spec.rb
-spec/poolparty/helpers/optioner_spec.rb
-spec/poolparty/modules/cloud_resourcer_spec.rb
-spec/poolparty/modules/configurable_spec.rb
-spec/poolparty/modules/definable_resource.rb
-spec/poolparty/modules/file_writer_spec.rb
-spec/poolparty/modules/s3_string_spec.rb
-spec/poolparty/monitors/base_monitor_spec.rb
-spec/poolparty/monitors/monitors/cpu_monitor_spec.rb
-spec/poolparty/monitors/monitors/memory_monitor_spec.rb
-spec/poolparty/net/messenger_spec.rb
-spec/poolparty/net/remote_bases/ec2_spec.rb
-spec/poolparty/net/remote_instance_spec.rb
-spec/poolparty/net/remote_spec.rb
-spec/poolparty/net/remoter_base_spec.rb
-spec/poolparty/net/remoter_spec.rb
-spec/poolparty/plugins/deploydirectory_spec.rb
-spec/poolparty/plugins/git_spec.rb
-spec/poolparty/plugins/line_spec.rb
-spec/poolparty/plugins/svn_spec.rb
-spec/poolparty/poolparty/base_spec.rb
-spec/poolparty/poolparty/cloud_spec.rb
-spec/poolparty/poolparty/configurers/files/ruby_basic.rb
-spec/poolparty/poolparty/configurers/files/ruby_plugins.rb
-spec/poolparty/poolparty/configurers/ruby_spec.rb
-spec/poolparty/poolparty/custom_resource_spec.rb
-spec/poolparty/poolparty/example_spec.rb
-spec/poolparty/poolparty/plugin_model_spec.rb
-spec/poolparty/poolparty/plugin_spec.rb
-spec/poolparty/poolparty/pool_spec.rb
-spec/poolparty/poolparty/resource_spec.rb
-spec/poolparty/poolparty/resources/class_package_spec.rb
-spec/poolparty/poolparty/resources/conditional_spec.rb
-spec/poolparty/poolparty/resources/cron_spec.rb
-spec/poolparty/poolparty/resources/directory_spec.rb
-spec/poolparty/poolparty/resources/exec_spec.rb
-spec/poolparty/poolparty/resources/file_spec.rb
-spec/poolparty/poolparty/resources/gem_spec.rb
-spec/poolparty/poolparty/resources/host_spec.rb
-spec/poolparty/poolparty/resources/package_spec.rb
-spec/poolparty/poolparty/resources/remote_file_spec.rb
-spec/poolparty/poolparty/resources/service_spec.rb
-spec/poolparty/poolparty/resources/sshkey_spec.rb
-spec/poolparty/poolparty/resources/symlink_spec.rb
-spec/poolparty/poolparty/resources/user_spec.rb
-spec/poolparty/poolparty/resources/variable_spec.rb
-spec/poolparty/poolparty/script_spec.rb
-spec/poolparty/poolparty/test_plugins/sshkey_test
-spec/poolparty/poolparty/test_plugins/virtual_host_template.erb
-spec/poolparty/poolparty/test_plugins/webserver.rb
-spec/poolparty/poolparty_spec.rb
-spec/poolparty/provisioners/capistrano/capistrano_spec.rb
-spec/poolparty/provisioners/provisioner_base_spec.rb
-spec/poolparty/spec/core/string_spec.rb
-spec/poolparty/spec_helper.rb
-tasks/cloud.rake
-tasks/deployment.rake
-tasks/development.rake
-tasks/ec2.rake
-tasks/environment.rake
-tasks/instance.rake
-tasks/server.rake
-tasks/spec.rake
-tasks/website.rake
-test/test_generator_helper.rb
-test/test_helper.rb
-test/test_pool_spec_generator.rb
-test/test_poolparty.rb
-website/index.html
-website/index.txt
-website/javascripts/rounded_corners_lite.inc.js
-website/stylesheets/code.css
-website/stylesheets/screen.css
-website/template.html.erb
View
2 README.txt
@@ -49,7 +49,7 @@ sudo gem install auser-poolparty
* Add queuing of tasks on the messenger
* Add syntax checker on the manifests
* Move in collectd support
-* Add master query
+* Remove master-slave protocol
== LICENSE:
View
50 Rakefile
@@ -1,25 +1,24 @@
require 'config/requirements'
-require 'config/hoe' # setup Hoe + all gem configuration
+require 'config/jeweler' # setup gem configuration
Dir['tasks/**/*.rake'].each { |rake| load rake }
desc "Clean tmp directory"
task :clean_tmp do |t|
- %x[rm #{File.dirname(__FILE__)}/Manifest.txt; touch #{File.dirname(__FILE__)}/Manifest.txt]
+ FileUtils.rm_rf("#{File.dirname(__FILE__)}/Manifest.txt") if ::File.exists?("#{File.dirname(__FILE__)}/Manifest.txt")
+ FileUtils.touch("#{File.dirname(__FILE__)}/Manifest.txt")
%w(logs tmp).each do |dir|
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
end
end
+
desc "Remove the pkg directory"
task :clean_pkg do |t|
%w(pkg).each do |dir|
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
end
end
-desc "Generate a new manifest and a new gem"
-task :build_local_gem => [:clean_tmp, :spec, :clean_pkg, :"manifest:refresh", :package]
-
desc "Packge with timestamp"
task :update_timestamp do
data = open("PostInstall.txt").read
@@ -33,37 +32,14 @@ task :update_timestamp do
::File.open("PostInstall.txt", "w+") {|f| f << data }
end
-desc "Release to github"
-task :github_release => [:clean_tmp, :spec, :clean_pkg, :"manifest:refresh", :update_timestamp, :package] do
- res = %x[rake debug_gem]
- res = res.split("\n")[1..-1].join("\n")
- ::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
- f << res
- end
- `mv #{::File.expand_path(::File.dirname(__FILE__))}/pkg/*.gem #{::File.expand_path(::File.dirname(__FILE__))}/pkg/poolparty.gem`
-end
-
-desc "Generate gemspec"
-task :gemspec => [:spec, :clean_tmp, :"manifest:refresh", :build_local_gem] do |t|
- res = %x[rake debug_gem]
- res = res.split("\n")[1..-1].join("\n")
- ::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
- f << res
- end
-end
-
-desc "Generate gemspec for github"
-task :gh => [:github_release, :package] do
- filepath = ::File.join(::File.dirname(__FILE__), "poolparty.gemspec")
- data = open(filepath).read
- spec = eval("$SAFE = 3\n#{data}")
- yml = YAML.dump spec
- File.open(filepath, "w+") do |f|
- f << yml
- end
+namespace :gem do
+ task(:build).prerequisites.unshift :gemspec # Prepend the gemspec generation
+
+ desc "Build the gem only if the specs pass"
+ task :test_then_build => [:spec, :build]
+
+ desc "Build and install the gem only if the specs pass"
+ task :test_then_install => [:spec, :install]
end
-desc "Generate github gemspec and latest gem"
-task :ghgem => [:gh] do
- %x[sudo gem install pkg/poolparty.gem]
-end
+task :release => [:update_timestamp]
View
6 TODO.textile
@@ -0,0 +1,6 @@
+# Remove Monitors from cloud.rb
+# Remove Ruby2Ruby dependency
+# Move server binaries to use props_hash
+# Reduce dependencies
+# task for "rake clean_pkg && rake gemspec && rake build && rm -rf /tmp/poolparty/ && rm -rf vendor/dependencies/"
+# Add Ohai plugin to expose poolparty data
View
4 VERSION.yml
@@ -0,0 +1,4 @@
+---
+:major: 1
+:minor: 1
+:patch: 0
View
21 bin/cloud-bootstrap
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
+require "poolparty"
+require "poolparty/provision/boot_strapper"
+
+o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
+ opts.on('-n cloudname', '--name name', 'Start cloud by this name') { |c| optioner.cloudname c }
+end
+
+o.loaded_clouds.each do |cld|
+ # If an IP or DNS name is given, bootstrap that node, otherwise, bootstrap all running nodes.
+ nodes = !o.unflagged_args.empty? ? o.unflagged_args : cld.running_instance_ips
+ if nodes.empty?
+ puts "No nodes to bootstrap"
+ else
+ nodes.each do |address|
+ puts "\nBootStrapping: #{address}\n--------------------"
+ ::PoolParty::Provision::BootStrapper.new address, {:full_keypair_path => cld.keypair.full_filepath, :cloud => cld}
+ end
+ end
+end
View
17 bin/cloud-configure
@@ -1,17 +1,22 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
-require "poolpartycl"
+# require "poolpartycl"
+
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
optioner.cloudnames
# optioner.daemonizeable
end
-o.loaded_clouds.each do |cloud|
+o.loaded_clouds.each do |cld|
- with_cloud(cloud) do
- verbose ? provisioner_for(master).configure(testing) : hide_output { provisioner_for(master).configure(testing) }
- cleanup_storage_directory unless testing
- end
+ # If an IP or DNS name is given, configure that node, otherwise, configure all running nodes.
+ nodes = !o.unflagged_args.empty? ? o.unflagged_args : cld.remote_instances_list.collect {|inst| inst.ip if inst.running? }.compact
+ nodes.each do |address|
+ puts "configuring: #{address}"
+ ::PoolParty::Provision::DrConfigure.new( address,
+ :full_keypair_path => cld.keypair.full_filepath,
+ :cloud => cld )
+ end
end
View
0 bin/pool-console → bin/cloud-console
File renamed without changes.
View
21 bin/cloud-list
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
-require "poolpartycl"
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)') { |o| optioner.location o }
@@ -10,17 +9,15 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
end
-o.loaded_clouds.each do |cloud|
+o.loaded_clouds.each do |cld|
- with_cloud(cloud) do
- puts header("Listing cloud #{name}")
- puts subheader("Active instances")
- puts list_of_running_instances.map{|a| a.to_s}.join("\n")
- puts ""
- if list_of_pending_instances.size > 0
- puts subheader("Pending instances")
- puts list_of_pending_instances.map{|a| a.to_s}.join("\n")
- end
- end
+ puts header("Listing cloud #{cld.name}")
+ puts subheader("Active instances")
+ puts cld.list_of_running_instances.map{|a| a.to_s}.join("\n")
+
+ if cld.list_of_pending_instances.size > 0
+ puts subheader("Pending instances")
+ puts cld.list_of_pending_instances.map{|a| a.to_s}.join("\n")
+ end
end
View
36 bin/cloud-provision
@@ -1,34 +1,24 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
-require "poolpartycl"
+require "poolparty/provision/boot_strapper"
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
opts.on('-n cloudname', '--name name', 'Start cloud by this name') { |c| optioner.cloudname c }
- opts.on('-p', '--slave', 'Provision slave (default: false)') { optioner.provision_slave true }
- opts.on('-i num', '--id num', 'Instance num to provision') { |i| optioner.instance_number i }
end
-o.loaded_clouds.each do |cloud|
-
- with_cloud(cloud) do
- setup_dev
- instance_num = instance_number.to_i if instance_number
-
- if instance_num
- @instance = get_instance_by_number( instance_num )
- instance_num == 0 ? provisioner_for(master).install(testing) : provisioner_for(@instance).install(testing)
- else
- if provision_slave
- vputs "Provisioning slaves"
- verbose ? provisioner_for(nil).install(testing) : hide_output { provisioner_for(nil).install(testing) }
- else
- vputs "Provisioning master"
- verbose ? provisioner_for(master).install(testing) : hide_output { provisioner_for(master).install(testing) }
- end
+o.loaded_clouds.each do |cld|
+ # If an IP or DNS name is given, bootstrap that node, otherwise, bootstrap all running nodes.
+ nodes = !o.unflagged_args.empty? ? o.unflagged_args : cld.remote_instances_list.collect {|inst| inst.ip if inst.running? }.compact
+ if nodes.empty?
+ puts "No nodes to bootstrap"
+ else
+ nodes.each do |address|
+ puts "bootstrapping: #{address}"
+ ::PoolParty::Provision::BootStrapper.new( address, {:full_keypair_path => cld.keypair.full_filepath, :cloud => cld} )
+ ::PoolParty::Provision::DrConfigure.new( address, :full_keypair_path => cld.keypair.full_filepath,
+ :cloud => cld )
end
-
- cleanup_storage_directory unless testing
end
+end
-end
View
3 bin/cloud-spec
@@ -29,7 +29,8 @@ o.loaded_clouds.each do |cloud|
case testtype
when "launch"
when nil
- print_with_nice_printer("Starting live specing cloud #{name}")
+ print_with_nice_printer("Starting live specing cloud #{name}")
+ puts "TODO: this isn't implented yet."
# hide_output {launch_and_configure_master!}
print_with_nice_printer("Waiting for cloud to provision")
View
14 bin/cloud-ssh
@@ -4,11 +4,19 @@ require "poolparty"
require "poolpartycl"
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
+ optioner.options( :num => 0 )
opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
- opts.on('-i num', '--id num', 'Instance num to ssh (default: 0)') { |i| optioner.num i }
+ # opts.on('-i num', '--id num', 'Instance num to ssh (default: 0)') { |i| optioner.num i.to_i }
end
-load_pool(o.spec || Binary.get_existing_spec_location)
+load_pool(o.spec? ? o.spec : Binary.get_existing_spec_location)
@cloud = o.loaded_clouds.first
+nodes = @cloud.list_of_running_instances
-@cloud.ssh_into_instance_number( o.num.to_i || 0 ) if @cloud
+puts nodes.map {|a| a.to_s}.join("\n")
+
+if !nodes.empty?
+ @cloud.ssh_into( nodes.first ) if @cloud
+else
+ puts "No running instances can be found"
+end
View
48 bin/cloud-start
@@ -1,32 +1,36 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
-require "poolpartycl"
-o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
- optioner.cloudnames
- optioner.daemonizeable
+o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
+ opts.on('-n cloudname', '--name name', 'Start cloud by this name') { |c| optioner.cloudname c }
end
-o.loaded_clouds.each do |cloud|
- with_cloud(cloud) do
- setup_dev
- vputs header("Starting cloud #{name}")
- vputs "#{list_of_running_instances.size} running instances (#{minimum_instances} - #{maximum_instances})"
- # if list_of_running_instances.size <= 1
- puts "Starting the master instance"
- # if testing
- # puts("\tNot launching while in testing mode")
- # else
- vputs "Launching and configuring the master"
- @cl = self
- daemon ? daemonize {@cl.launch_and_configure_master!} : launch_and_configure_master!
- # end
+o.loaded_clouds.each do |cld|
+ if cld.list_of_running_instances.size.zero?
+ puts header("Starting cloud #{cld.name}")
+ puts "#{cld.list_of_running_instances.size} running instances (#{cld.minimum_instances} - #{cld.maximum_instances})"
+
+ inst = cld.launch_instance!
+ # unil inst.ip do
+ # sleep 2
+ # node = cld.remote_instances_list.select {|i| i.running? }
# end
- when_no_pending_instances do
- puts open(::File.join(File.dirname(__FILE__), "..", "lib", "poolparty", "config", "postlaunchmessage.txt")).read ^ {:master_ip => master.ip.chomp}
- clear_base_directory unless testing
+
+ cld.when_no_pending_instances do
+ cld.remote_instances_list.select {|i| i.running? }.each do |node|
+ ::PoolParty::Provision::BootStrapper.new(node.ip, :full_keypair_path => cld.keypair.full_filepath, :cloud => cld)
+ ::PoolParty::Provision::DrConfigure.new(node.ip, :full_keypair_path => cld.keypair.full_filepath, :cloud => cld)
+ end
+
+ first_inst = cld.remote_instances_list.select {|i| i.running? }.first
+ puts <<-EOM
+ Your cloud has started. Your ip is #{first_inst.ip}
+ EOM
end
+ else
+ puts <<-EOE
+ Your cloud is already running.
+ EOE
end
-
end
View
2 bin/cloud-terminate
@@ -13,7 +13,7 @@ o.loaded_clouds.each do |cloud|
list_of_running_instances.each do |inst|
puts "Shutting down #{inst.instance_id}"
- terminate_instance!(inst.instance_id)
+ terminate_instance!(:instance_id => inst.instance_id)
end
end
View
23 bin/ec2-list-active
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require 'EC2' #rescue `gem install -y grempe-amazon-ec2`
+aws_keys = {}
+aws_keys = YAML::load( File.open('/etc/poolparty/aws_keys.yml') ) rescue 'No aws_keys.yml file. Will try to use enviornment variables'
+
+ACCESS_KEY_ID = aws_keys[:access_key] || ENV['AMAZON_ACCESS_KEY_ID'] || ENV['AWS_ACCESS_KEY']
+SECRET_ACCESS_KEY = aws_keys[:secret_access_key] || ENV['AMAZON_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_ACCESS_KEY']
+
+if ENV['EC2_URL']
+ ec2 = EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['EC2_URL']).host )
+else
+ # default server is US ec2.amazonaws.com
+ ec2 = EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY )
+end
+
+response = ec2.describe_instances
+
+public_dns_names = response.reservationSet.item.first.instancesSet.item.collect do |instance|
+ instance.dnsName if instance.instanceState.name == 'running'
+end.compact
+
+puts public_dns_names.join("\t")
View
2 bin/server-become-master
@@ -16,7 +16,7 @@ include Remote
@clouds.each do |cl|
with_cloud(cl, {:testing => o.testing}) do
- cmd = "hostname master && #{PoolParty::Remote::RemoteInstance.puppet_runner_command}"
+ cmd = "hostname master && #{PoolParty::Remote::RemoteInstance.dependency_resolver_comand}"
%x[#{cmd}] unless testing
after_launch_master
end
View
2 bin/server-clean-cert-for
@@ -11,5 +11,5 @@ end
o.loaded_clouds.each do |cloud|
# @nodes = cloud.messenger_send!("get_current_nodes")
# @nodes = @nodes.split(" ").map {|a| a.split(/@/)[-1] }
- PoolParty::Ruberl::Base.new(cloud.master, Base.messenger_client_port).messenger_send!("clear_cert_for #{cloud.for}")
+ PoolParty::Ruberl::Base.new(cloud.master, Default.messenger_client_port).messenger_send!("clear_cert_for #{cloud.for}")
end
View
3 bin/server-ensure-provisioning
@@ -20,8 +20,7 @@ o.loaded_clouds.each do |cloud|
next if node == "master"
# @tp.process do
str = returning Array.new do |s|
- s << "/usr/sbin/puppetca --clean #{node}.compute-1.internal"
- s << "/usr/sbin/puppetca --clean #{node}.ec2.internal"
+ s << cloud.dependency_resolver_command
end.join(";")
node_id = node.gsub(/node/, '')
View
21 bin/server-get-load
@@ -1,18 +1,15 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require "poolparty"
-require "poolpartycl"
+require "poolparty/lite"
+Dir["#{File.dirname(__FILE__)}/../lib/poolparty/monitors/base_monitor.rb"].each {|f| require f}
-available_monitors = PoolParty::Monitors.available_monitors
-o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
- # opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
- opts.on('-m name', '--monitor monitor_name', "Monitor name (default: cpu) (Available monitors: #{available_monitors.join(", ")})") {|c| optioner.monitorname c}
-end
+monitor = ARGV.pop || "cpu"
-@monitor = o.monitorname ? o.monitorname : "cpu"
+begin
+ Dir["#{File.dirname(__FILE__)}/../lib/poolparty/monitors/monitors/#{monitor}_monitor.rb"].each {|f| require f}
-if PoolParty::Monitors.available_monitors.include?(@monitor.downcase.to_sym)
- print "PoolParty::Monitors::#{@monitor.capitalize}Monitor".constantize.run.to_f
-else
- puts "Unknown monitor"
+ klass = eval("PoolParty::Monitors::#{monitor.capitalize}Monitor")
+ print (klass.send :run).to_f rescue -1.0
+rescue Exception => e
+ puts -1.0
end
View
22 bin/server-list-active
@@ -1,18 +1,14 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require "poolparty"
-require "poolpartycl"
+require "poolparty/lite"
-o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
- opts.on('-c name', '--class name', 'Listing for cloud class (valid args: [name|ip])') { |t| optioner.classname t }
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
-end
+list_type = ARGV.pop || "ip"
-@ctype = (o.classname || "name").downcase.to_sym
+json_file = ARGV[0] || PoolParty::Default.properties_hash_file
+raise "ERROR: no json_file given" if !json_file
+schema = PoolParty::Schema.new( ::File.read(json_file) )
-o.loaded_clouds.each do |cloud|
- with_cloud(cloud, {:ctype => @ctype}) do
- print "#{list_of_running_instances.collect{|a| "#{a.send ctype}" }.join("\t")}"
- end
-
-end
+remoter_base = schema.options.remote_base
+
+instances = PoolParty::Remote::Ec2.describe_instances(schema.options)
+print instances.map {|inst| inst.send list_type.to_sym }.join("\t")
View
24 bin/server-list-responding
@@ -1,24 +0,0 @@
-#!/usr/bin/env ruby
-$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require "poolparty"
-require "poolpartycl"
-
-o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
- opts.on('-n name', '--name name', 'Cloud name') { |c| optioner.cloudname c }
-end
-
-load_pool(o.spec || Binary.get_existing_spec_location)
-
-@ctype = (o.classname || "name").downcase.to_sym
-
-include Remote
-
-@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds
-
-@clouds.each do |name, cloud|
-
- with_cloud(cloud, {:location => @location, :ctype => @ctype}) do
- puts "#{list_of_running_instances.map{|a| "#{a.send ctype}" }.join("\t")}"
- end
-
-end
View
2 bin/server-query-agent
@@ -5,7 +5,7 @@ Dir["#{::File.dirname(__FILE__)}/../lib/poolparty/modules/*.rb"].each {|f| requi
require "poolparty/base"
def query(meth, *args)
- socket = TCPSocket.open("127.0.0.1", PoolParty::Base.agent_port)
+ socket = TCPSocket.open("127.0.0.1", PoolParty::Default.agent_port)
out = socket.send("#{meth} #{args}", 100)
socket.close
out
View
2 bin/server-rerun
@@ -16,7 +16,7 @@ include Remote
@clouds.each do |cl|
with_cloud(cl, {:testing => o.testing}) do
- cmd = PoolParty::Remote::RemoteInstance.puppet_runner_command
+ cmd = PoolParty::Remote::RemoteInstance.dependency_resolver_comand
%x[#{cmd}] unless testing
end
View
2 bin/server-update-hosts
@@ -30,7 +30,7 @@ o.loaded_clouds.each do |cloud|
if testing
puts new_hosts_listing
else
- new_hosts_file = "#{Base.manifest_path}/classes/hosts.pp"
+ new_hosts_file = "#{Default.manifest_path}/classes/hosts.pp"
arr = returning Array.new do |arr|
new_hosts_listing.split(/\n/).each do |line|
View
2 bin/server-write-new-nodes
@@ -11,7 +11,7 @@ end
o.loaded_clouds.each do |cloud|
with_cloud(cloud) do
- new_nodes_file = "#{Base.manifest_path}/nodes/nodes.pp"
+ new_nodes_file = "#{Default.manifest_path}/nodes/nodes.pp"
str = returning Array.new do |arr|
arr << "node default { include poolparty }"
View
116 config/hoe.rb
@@ -1,116 +0,0 @@
-require 'poolparty'
-
-AUTHOR = 'Ari Lerner' # can also be an array of Authors
-EMAIL = "ari.lerner@citrusbyte.com"
-DESCRIPTION =<<-EOM
- Self-healing, auto-scaling system administration, provisioning
- and maintaining tool that makes cloud computing fun and easy
-EOM
-GEM_NAME = 'poolparty' # what ppl will type to install your gem
-RUBYFORGE_PROJECT = 'poolparty' # The unix name for your project
-HOMEPAGE = "http://poolpartyrb.com"
-HOMEPATH = "http://#{GEM_NAME}.rubyforge.org"
-DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
-EXTRA_DEPENDENCIES = [
- ['activesupport'],
- ['logging'],
- ["ruby2ruby"]
-] # An array of rubygem dependencies [name, version]
-
-@config_file = "~/.rubyforge/user-config.yml"
-@config = nil
-RUBYFORGE_USERNAME = "unknown"
-def rubyforge_username
- unless @config
- begin
- @config = YAML.load(File.read(File.expand_path(@config_file)))
- rescue
- puts <<-EOS
-ERROR: No rubyforge config file found: #{@config_file}
-Run 'rubyforge setup' to prepare your env for access to Rubyforge
- - See http://newgem.rubyforge.org/rubyforge.html for more details
- EOS
- exit
- end
- end
- RUBYFORGE_USERNAME.replace @config["username"]
-end
-
-
-REV = nil
-# UNCOMMENT IF REQUIRED:
-# REV = YAML.load(`svn info`)['Revision']
-VERS = PoolParty::VERSION::STRING + (REV ? ".#{REV}" : "")
-RDOC_OPTS = ['--quiet', '--title', 'PoolParty documentation',
- "--opname", "index.html",
- "--line-numbers",
- "--main", "README",
- "--inline-source"]
-
-class Hoe
- def extra_deps
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
- @extra_deps
- end
-end
-
-# Generate all the Rake tasks
-# Run 'rake -T' to see list of generated tasks (from gem root directory)
-$hoe = Hoe.new(GEM_NAME, VERS) do |p|
- p.developer(AUTHOR, EMAIL)
- p.description = DESCRIPTION
- p.summary = DESCRIPTION
- p.url = HOMEPATH
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
- p.test_globs = ["test/**/test_*.rb"]
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
- # p.files = %w(Rakefile History.txt README.txt) + Dir.glob("{examples,lib,specs,tasks,script,generators,bin}/**/*")
-
- # == Optional
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
- p.extra_deps = EXTRA_DEPENDENCIES
-
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
- end
-
-CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
-PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
-$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
-$hoe.rsync_args = '-av --delete --ignore-errors'
-$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
-
-# # Gemspec creator
-# spec = Gem::Specification.new do |s|
-# s.name = GEM_NAME
-# s.version = VERS
-# s.platform = Gem::Platform::RUBY
-# s.has_rdoc = true
-# s.extra_rdoc_files = ["README.txt", "License.txt", 'History.txt']
-# s.summary = DESCRIPTION
-# s.description = s.summary
-# s.author = AUTHOR
-# s.email = EMAIL
-# s.homepage = HOMEPATH
-#
-# # Uncomment this to add a dependency
-# EXTRA_DEPENDENCIES.each do |arr|
-# s.add_runtime_dependency arr
-# end
-# # s.extra_deps = EXTRA_DEPENDENCIES
-#
-# s.require_path = 'lib'
-# s.autorequire = GEM_NAME
-# s.files = %w(Rakefile History.txt README.txt) + Dir.glob("{examples,lib,specs,tasks,script,generators,bin}/**/*")
-# end
-#
-# Rake::GemPackageTask.new(spec) do |pkg|
-# pkg.gem_spec = spec
-# end
-#
-# desc "create a gemspec file"
-# task :make_spec do
-# ::File.unlink "#{GEM_NAME.downcase}.gemspec" if ::File.exists?("#{GEM_NAME.downcase}.gemspec")
-# ::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |file|
-# file.puts spec.to_ruby
-# end
-# end
View
40 config/jeweler.rb
@@ -0,0 +1,40 @@
+# You also need to setup your name and email for git if you haven't already done so.
+# Info at http://github.com/guides/tell-git-your-user-name-and-email-address
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |s|
+ s.name = "poolparty"
+ s.summary = <<-EOM
+ Self-healing, auto-scaling system administration, provisioning
+ and maintaining tool that makes cloud computing fun and easy
+ EOM
+ s.description = s.summary
+
+ s.homepage = "http://poolpartyrb.com"
+ s.email = "ari.lerner@citrusbyte.com"
+ s.authors = ["Ari Lerner"]
+
+ s.test_files = Dir["test/**/test_*.rb"]
+ s.files = %w(Rakefile History.txt README.txt PostInstall.txt License.txt VERSION.yml) +
+ Dir["{config,examples,lib,spec,test,tasks,script,generators,bin,vendor}/**/*"]
+
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.txt", "License.txt", 'History.txt']
+ s.rdoc_options = ['--quiet', '--title', 'PoolParty documentation',
+ "--opname", "index.html",
+ "--line-numbers",
+ "--main", "README",
+ "--inline-source"]
+
+ s.add_dependency 'activesupport'
+ s.add_dependency 'logging'
+ s.add_dependency 'ruby2ruby'
+ s.add_dependency 'grempe-amazon-ec2'
+ s.add_dependency 'rubigen', ">=1.5.2"
+ # Certainly there should be more here
+
+ end
+rescue LoadError
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+end
View
10 config/requirements.rb
@@ -2,14 +2,6 @@
include FileUtils
require 'rubygems'
-%w[rake hoe newgem rubigen].each do |req_gem|
- begin
- require req_gem
- rescue LoadError
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
- puts "Installation: gem install #{req_gem} -y"
- exit
- end
-end
+require 'rake'
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
View
15 examples/basic.rb
@@ -1,20 +1,23 @@
# Basic pool spec
# Shows global settings for the clouds
-
pool :application do
-
- instances 3..5
+ instances 3..50
keypair "auser"
+ testing true
- cloud :app do
- minimum_instances 2
+ cloud :basic_app do
+ minimum_instances 12
ami "ami-abc123"
+ junk_yard_dogs "pains"
+ has_file :name => "/etc/init.d/motd", :content => "Welcome to your PoolParty instance"
end
- cloud :db do
+ cloud :basic_db do
+ minimum_instances 19
keypair "hotstuff_database"
maximum_instances 20
ami "ami-1234bc"
+ junk_yard_dogs "are bad"
end
end
View
22 examples/default.rb
@@ -0,0 +1,22 @@
+require "/etc/chef/cookbooks/chef-deploy/lib/chef-deploy.rb"
+include_recipe "apache2"
+include_recipe "passenger"
+include_recipe "rails"
+include_recipe "git"
+
+deploy "/var/www/bort" do
+ repo "git://github.com/fudgestudios/bort.git"
+ branch "HEAD"
+ enable_submodules true
+ shallow_clone true
+ action :manage
+end
+
+web_app "bort" do
+ docroot "/var/www/bort/current/public"
+ template "suspenders.conf.erb"
+ server_name node[:fqdn]
+ server_aliases [node[:hostname], "bort"]
+ passenger_version "2.1.3"
+ rails_env "production"
+end
View
56 examples/fairchild.rb
@@ -0,0 +1,56 @@
+# Basic pool spec
+# Shows global settings for the clouds
+pool :application do
+ instances 1..3
+ # keypair "#{ENV["HOME"]}/.ssh/r_and_d.pem"
+ keypair "auser-work"
+ verbose true
+ ami 'ami-7cfd1a15'
+ # testing false
+
+ cloud :pp1 do
+ # junk_yard_dogs "pains"
+ has_file :name => "/etc/motd", :content => "Welcome to your PoolParty instance"
+ does_not_have_directory :name => '/has_dir_test'
+ has_package :name => 'nmap'
+
+ has_git_repos(:name => "poolpartyrepos",
+ :source => "git://github.com/auser/poolparty-website.git",
+ :at => "/var/www/poolpartyrb.com")
+
+ chef do
+ include_recipes "~/.poolparty/chef/cookbooks/*"
+
+ recipe "#{::File.dirname(__FILE__)}/examples/default.rb",
+ :templates => ["#{::File.dirname(__FILE__)}/examples/suspenders.conf.erb"]
+
+ json do
+ user "ez"
+ apps "beast", "mephisto"
+ gems [
+ { "name" => "rake",
+ "version" => "0.8.3"
+ },
+ { "name" => "tmm1-amqp",
+ "source" => "http://gems.github.com",
+ "version" => "0.6.0"
+ }]
+ end
+ end
+
+ # apache do
+ # installed_as_worker
+ # has_virtualhost do
+ # name "poolpartyrb.com"
+ # listen("8080")
+ # # virtual_host_entry ::File.join(File.dirname(__FILE__), "virtual_host.conf.erb")
+ #
+ # # We are going to have a repository that is updated across the servers
+ # has_git(:name => "poolpartyrepos",
+ # :source => "git://github.com/auser/poolparty-website.git",
+ # :at => "/var/www/poolpartyrb.com")
+ # end
+ # end
+ end
+
+end
View
34 examples/suspenders.conf.erb
@@ -0,0 +1,34 @@
+<VirtualHost *:80>
+ ServerName <%= @params[:server_name] %>
+ ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>
+ DocumentRoot <%= @params[:docroot] %>
+
+ RailsBaseURI /
+ RailsEnv <%= @params[:rails_env] %>
+ RailsAllowModRewrite on
+ PassengerMaxPoolSize <%= @node[:rails][:max_pool_size] %>
+
+ <Directory <%= @params[:docroot] %>>
+ Options FollowSymLinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ LogLevel info
+ ErrorLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
+ CustomLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
+
+ RewriteEngine On
+ RewriteLog <%= @node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log
+ RewriteLogLevel 0
+ # Canonical host
+ RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC]
+ RewriteCond %{HTTP_HOST} !^$
+ RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301]
+
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
+ RewriteRule ^.*$ /system/maintenance.html [L]
+
+</VirtualHost>
View
10 generators/poolspec/poolspec_generator.rb
@@ -21,7 +21,7 @@ def manifest
m.directory ''
BASEDIRS.each { |path| m.directory path }
- m.template "pool_spec_template.erb", "clouds.pool"
+ m.template "pool_spec_template.erb", "clouds.rb"
# Create stubs
# m.template "template.rb", "some_file_after_erb.rb"
# m.template_copy_each ["template.rb", "template2.rb"]
@@ -31,14 +31,6 @@ def manifest
end
protected
- def banner
- <<-EOS
-Creates a basic poolparty spec tempalte
-
-USAGE: #{spec.name} name
-EOS
- end
-
def add_options!(opts)
opts.separator ''
opts.separator 'Options:'
View
2 lib/erlang/messenger/Rakefile
@@ -54,7 +54,7 @@ task :compile => ['ebin'] + OBJ
desc "Rebuild the boot scripts"
task :build_boot_scripts => [:recompile] do
puts "Rebuilding boot scripts"
- @version = "0.1"
+ @version = ENV["VERSION"] || ENV["V"] || 0.1
cmd = "erl -pa ./ebin/ -run pm_packager recompile_scripts #{@version} -run init stop -noshell"
Kernel.system cmd
end
View
2 lib/erlang/messenger/src/pm_node.erl
@@ -38,7 +38,7 @@
% Get the load for the type sent...
get_current_load_for_type(Type) ->
- String = string:concat(". /etc/profile && server-get-load -m ",Type),
+ String = string:concat(". /etc/profile && server-get-load ",Type),
LatestLoad = os:cmd(String),
Load = gen_server:call(server_location(), {update_load, Type, LatestLoad}),
{Load}.
View
1 lib/erlang/messenger/src/utils.erl
@@ -58,7 +58,6 @@ average_for_list(Num, L) ->
% Provisioning utils
distribute_modules_to(Modules, Nodes) ->
% transfer the modules to all the nodes
- io:format("Sending ~p to ~p~n", [Modules, Nodes]),
lists:foreach(fun(Node) ->
transfer_modules(Node, Modules)
end, Nodes).
View
86 lib/poolparty.rb
@@ -1,6 +1,8 @@
+$LOAD_PATH<< File.dirname(__FILE__)
# Load required gems
+#TODO: remove activesupport
@required_software = Array.new
-%w(rubygems activesupport ftools logging resolv ruby2ruby digest/sha2).each do |lib|
+%w(rubygems activesupport ftools logging resolv ruby2ruby digest/sha2 json pp).each do |lib|
begin
require lib
rescue Exception => e
@@ -30,28 +32,79 @@
exit(0)
end
-# Use active supports auto load mechanism
-ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__)
+Dir.glob(File.join(File.dirname(__FILE__),'..', 'vendor/gems/*/lib/*.rb')).each do |d|
+ require d
+end
+t=Time.now
## Load PoolParty
%w(version).each do |f|
require "#{File.dirname(__FILE__)}/poolparty/#{f}"
end
-%w(core modules exceptions dependency_resolutions aska monitors provisioners server extra net).each do |dir|
- Dir[File.dirname(__FILE__) + "/poolparty/#{dir}/**.rb"].each do |file|
- require file
+def PoolParty.require_directory(dir)
+ if ::File.file?(dir)
+ puts "#{::File.expand_path(dir)}" if $DEBUGGING || $GENERATING_MANIFEST
+ require dir
+ else
+ Dir["#{dir}/*.rb"].sort.each do |file|
+ puts "#{::File.expand_path(file)}" if $DEBUGGING || $GENERATING_MANIFEST
+ require "#{file}" if ::File.file?(file)
+ end
+ Dir["#{dir}/*"].sort.each do |dir|
+ require_directory(dir) if ::File.directory?(dir)
+ end
+ end
+end
+
+#load poolparty framework in specific order
+$_poolparty_load_directories = [
+ "core",
+ "dependencies.rb",
+ "dependency_resolver/dependency_resolver_cloud_extensions.rb",
+ "poolparty/poolparty_base_class.rb",
+ "modules",
+ "exceptions",
+ 'poolparty/key.rb',
+ "dependency_resolver",
+ "aska",
+ "config",
+ "monitors",
+ "capistrano.rb",
+ 'provisioners/provisioner_base.rb',
+ 'provisioners/capistrano/capistrano.rb',
+ 'provision',
+ "extra",
+ "net",
+ "helpers",
+ "poolparty/resource.rb",
+ "poolparty/service.rb",
+ "resources",
+ "services",
+ "poolparty/cloud.rb",
+ "poolparty",
+ "templates"
+ ]
+manifest_file_location = ::File.join(::File.dirname(__FILE__), '../config/manifest.pp')
+
+if ::File.file?(manifest_file_location)
+ ::File.readlines(manifest_file_location).each do |line|
+ puts "#{::File.expand_path(line)}" if $DEBUGGING
+ require "#{line.gsub(/\n/, '')}"
end
+else
+ $_poolparty_load_directories.each do |dir|
+ PoolParty.require_directory(::File.join(::File.dirname(__FILE__),'poolparty', dir))
+ end
end
-Kernel.load_p File.dirname(__FILE__) + "/poolparty/poolparty"
Logging.init :debug, :info, :warn, :error, :fatal
module PoolParty
include FileWriter
def log
- @logger ||= make_new_logger
+ @logger ||= STDOUT #make_new_logger
end
def reset!
$pools = $clouds = $plugins = @describe_instances = nil
@@ -65,10 +118,10 @@ def initialize(spec)
private
#:nodoc:#
- def make_new_logger
- FileUtils.mkdir_p ::File.dirname(Base.pool_logger_location) unless ::File.directory?(::File.dirname(Base.pool_logger_location))
- Loggable.new
- end
+ # def make_new_logger
+ # FileUtils.mkdir_p ::File.dirname(Default.pool_logger_location) unless ::File.directory?(::File.dirname(Default.pool_logger_location))
+ # Loggable.new
+ # end
end
class Object
@@ -80,16 +133,15 @@ class Object
end
class Class
- include PoolParty::PluginModel
+ include PoolParty::PluginModel
end
## Load PoolParty Plugins and package
module PoolParty
%w(plugins base_packages).each do |dir|
- Dir[::File.dirname(__FILE__) + "/poolparty/#{dir}/*.rb"].each do |file|
- require file
- end
+ require_directory(::File.join(::File.dirname(__FILE__), 'poolparty', dir))
end
end
-PoolParty.reset!
+PoolParty.reset!
+puts "duration = #{Time.now-t}" if $DEBUGGING
View
61 lib/poolparty/base_packages/haproxy.rb
@@ -1,40 +1,43 @@
module PoolParty
class Base
- plugin :haproxy do
+ plugin :poolparty_base_haproxy do
def enable
- execute_on_master do
- has_package({:name => "haproxy"})
+ case_of "hostname" do
+ when_is "master" do
+ has_package({:name => "haproxy"})
- # Restart sysklogd after we update the haproxy.log
- has_service(:name => "sysklogd")
+ # Restart sysklogd after we update the haproxy.log
+ has_service(:name => "sysklogd")
- # Template variables
- has_variable(:name => "name_haproxy", :value => "#{cloud.name}")
- has_variable(:name => "nodenames_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'name', '-n', '#{cloud.name}')")
- has_variable(:name => "node_ips_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'ip', '-n', '#{cloud.name}')")
+ # Template variables
+ has_variable("name_haproxy", :value => "#{cloud.name}")
+ has_variable("nodenames_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', 'name')")
+ has_variable("node_ips_haproxy", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', 'ip')")
+ #
+ has_variable("ports_haproxy", :value => ([(self.respond_to?(:port) ? port : Default.port)].flatten))
+ has_variable("forwarding_port", :value => (respond_to?(:forwarding_port) ? forwarding_port : Default.forwarding_port))
+ has_variable("proxy_mode", :value => (respond_to?(:proxy_mode) ? proxy_mode : Default.proxy_mode))
- has_variable(:name => "ports_haproxy", :value => ([(self.respond_to?(:port) ? port : Base.port)].flatten))
- has_variable(:name => "forwarding_port", :value => (respond_to?(:forwarding_port) ? forwarding_port : Base.forwarding_port))
- has_variable(:name => "proxy_mode", :value => (respond_to?(:proxy_mode) ? proxy_mode : Base.proxy_mode))
+ # Startup haproxy and enable it
+ has_line_in_file(:line => "ENABLED=1", :file => "/etc/default/haproxy")
+ has_line_in_file({:line => "SYSLOGD=\"-r\"", :file => "/etc/default/syslogd"})
+ has_line_in_file({:line => "local0.* /var/log/haproxy.log", :file => "/etc/syslog.conf"}, {:notify => get_service("sysklogd")})
+
+ has_exec(:name => "reloadhaproxy",
+ :command => "/etc/init.d/haproxy reload",
+ :requires => get_package("haproxy"))
+ # Service is required
+ has_service("haproxy", :ensures => "running", :hasrestart => true)
+ has_service(:name => "haproxy", :ensures => "running", :hasrestart => true, :notify => get_exec("reloadhaproxy"))
- # Startup haproxy and enable it
- has_line_in_file("ENABLED=1", "/etc/default/haproxy")
- has_line_in_file("SYSLOGD=\"-r\"", "/etc/default/syslogd")
- has_line_in_file("local0.* /var/log/haproxy.log", "/etc/syslog.conf", {:notify => get_service("sysklogd")})
-
- has_exec(:name => "reloadhaproxy",
- :command => "/etc/init.d/haproxy reload",
- :requires => get_package("haproxy"))
- # Service is required
- has_service(:name => "haproxy", :ensures => "running", :hasrestart => true, :notify => get_exec("reloadhaproxy"))
-
- # These can also be passed in via hash
- has_remotefile(:name => "/etc/haproxy.cfg") do
- mode 644
- requires get_package("haproxy")
- notify get_service("haproxy")
- template "haproxy.conf"
+ # These can also be passed in via hash
+ # has_remotefile(:name => "/etc/haproxy.cfg") do
+ # mode 644
+ # requires get_package("haproxy")
+ # notify get_service("haproxy")
+ # template "haproxy.conf"
+ # end
end
end
end
View
107 lib/poolparty/base_packages/heartbeat.rb
@@ -1,70 +1,53 @@
module PoolParty
class Base
- plugin :heartbeat do
+ plugin :poolparty_base_heartbeat do
- def enable
+ def enable
# execute_on_master do
- has_package(:name => "heartbeat") do
- has_service(:name => "heartbeat", :hasstatus => true, :hasrestart => true)
- has_directory(:name => "/etc/ha.d")
-
- has_remotefile(:name => "/etc/ha.d/ha.cf") do
- mode 444
- notify service(:name => "heartbeat")
- template "ha.cf"
- end
-
- has_remotefile(:name => "/etc/ha.d/logd.cf") do
- mode 600
- notify service(:name => "heartbeat")
- template File.join(File.dirname(__FILE__), "..", "templates/logd.cf")
- end
-
- has_exec(:name => "heartbeat-update-cib", :command => "/usr/sbin/cibadmin -R -x /etc/ha.d/cib.xml", :refreshonly => true)
-
- has_remotefile(:name => "/etc/ha.d/authkeys") do
- mode 600
- notify service(:name => "heartbeat")
- template File.join(File.dirname(__FILE__), "..", "templates/authkeys")
- end
-
- has_remotefile(:name => "/etc/ha.d/cib.xml") do
- mode 444
- notify exec(:name => "heartbeat-update-cib")
- template File.join(File.dirname(__FILE__), "..", "templates/cib.xml")
- end
-
- has_remotefile(:name => "/etc/ha.d/haresources") do
- mode 644
- template File.join(File.dirname(__FILE__), "..", "templates/haresources")
- end
- # end
-
- # variables for the templates
- has_variable(:name => "ha_nodenames", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'name', '-n', '#{cloud.name}')")
- has_variable(:name => "ha_node_ips", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'ip', '-n', '#{cloud.name}')")
-
- has_variable({:name => "ha_timeout", :value => (self.respond_to?(:timeout) ? timeout : "5s")})
- has_variable({:name => "ha_port", :value => (self.respond_to?(:port) ? port : Base.port)})
-
- # Finally, let's set a few options and start it
-# has_exec(:name => "set and start") do
-# refreshonly true
-# command <<-EOC
-# crm_mon -i5
-# EOC
-# end
-
- end
-
- # execute_on_master do
- # if list_of_node_names.size > 1
- # has_exec(:name => "update pem for heartbeat", :refreshonly => true) do
- # command "scp /etc/puppet/ssl/ca/ca_crl.pem #{user || Base.user}@#{list_of_node_ips[1]}:#{Base.base_config_directory}/ssl/ca"
- # end
- # end
+ has_package({:name => "heartbeat"})
+
+ # has_service(:name => "heartbeat", :hasstatus => true, :hasrestart => true)
+ # has_directory(:name => "/etc/ha.d")
+ #
+ # has_remotefile(:name => "/etc/ha.d/ha.cf") do
+ # mode 444
+ # notify service(:name => "heartbeat")
+ # template "ha.cf"
# end
-
+ #
+ # has_remotefile(:name => "/etc/ha.d/logd.cf") do
+ # mode 600
+ # notify service(:name => "heartbeat")
+ # template File.join(File.dirname(__FILE__), "..", "templates/logd.cf")
+ # end
+ #
+ # has_exec(:name => "heartbeat-update-cib", :command => "/usr/sbin/cibadmin -R -x /etc/ha.d/cib.xml", :refreshonly => true)
+ #
+ # has_remotefile(:name => "/etc/ha.d/authkeys") do
+ # mode 600
+ # notify service(:name => "heartbeat")
+ # template File.join(File.dirname(__FILE__), "..", "templates/authkeys")
+ # end
+ #
+ # has_remotefile(:name => "/etc/ha.d/cib.xml") do
+ # mode 444
+ # notify exec(:name => "heartbeat-update-cib")
+ # template File.join(File.dirname(__FILE__), "..", "templates/cib.xml")
+ # end
+ #
+ # has_remotefile(:name => "/etc/ha.d/haresources") do
+ # mode 644
+ # template File.join(File.dirname(__FILE__), "..", "templates/haresources")
+ # end
+ # # end
+ #
+ # # variables for the templates
+ # has_variable(:name => "ha_nodenames", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'name', '-n', '#{cloud.name}')")
+ # has_variable(:name => "ha_node_ips", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'ip', '-n', '#{cloud.name}')")
+ #
+ # has_variable({:name => "ha_timeout", :value => (self.respond_to?(:timeout) ? timeout : "5s")})
+ # has_variable({:name => "ha_port", :value => (self.respond_to?(:port) ? port : Default.port)})
+
end
end
View
162 lib/poolparty/base_packages/poolparty.rb
@@ -2,92 +2,82 @@ module PoolParty
class Base
plugin :poolparty_base_packages do
- def enable
- # Build hostsfile
-
- has_package(:name => "erlang")
- has_package(:name => "erlang-dev")
- has_package(:name => "erlang-src")
- # has_package(:name => "yaws")
-
- has_package(:name => "rubygems") do
- # These should be installed automagically by poolparty, but just in case
- # TODO: Fix the requires method with a helper
- has_gempackage(:name => "flexmock", :download_url => "http://rubyforge.org/frs/download.php/42580/flexmock-0.8.3.gem")
- has_gempackage(:name => "lockfile", :download_url => "http://rubyforge.org/frs/download.php/18698/lockfile-1.4.3.gem")
- has_gempackage(:name => "logging", :download_url => "http://rubyforge.org/frs/download.php/44731/logging-0.9.4.gem", :requires => [get_gempackage("flexmock"), get_gempackage("lockfile")])
-
- has_gempackage(:name => "rubyforge", :download_url => "http://rubyforge.org/frs/download.php/45546/rubyforge-1.0.1.gem")
- has_gempackage(:name => "hoe", :download_url => "http://rubyforge.org/frs/download.php/45685/hoe-1.8.2.gem", :version => "1.8", :requires => get_gempackage("rubyforge"))
- has_gempackage(:name => "ZenTest", :download_url => "http://rubyforge.org/frs/download.php/45581/ZenTest-3.11.0.gem", :requires => [get_gempackage("hoe"), get_gempackage("rubyforge")])
-
- has_gempackage(:name => "rake", :download_url => "http://rubyforge.org/frs/download.php/43954/rake-0.8.3.gem")
- has_gempackage(:name => "xml-simple", :download_url => "http://rubyforge.org/frs/download.php/18366/xml-simple-1.0.11.gem")
- has_gempackage(:name => "amazon-ec2", :download_url => "http://rubyforge.org/frs/download.php/43666/amazon-ec2-0.3.1.gem", :requires => get_gempackage("xml-simple"))
-
- has_gempackage(:name => "sexp_processor", :download_url => "http://rubyforge.org/frs/download.php/45589/sexp_processor-3.0.0.gem")
-
- # Capistrano
- has_gempackage(:name => "net-ssh", :download_url => "http://rubyforge.org/frs/download.php/51288/net-ssh-2.0.10.gem", :version => "2.0.10")
- has_gempackage(:name => "net-sftp", :download_url => "http://rubyforge.org/frs/download.php/37669/net-sftp-2.0.1.gem")
- has_gempackage(:name => "net-scp", :download_url => "http://rubyforge.org/frs/download.php/37664/net-scp-1.0.1.gem")
- has_gempackage(:name => "net-ssh-gateway", :download_url => "http://rubyforge.org/frs/download.php/36389/net-ssh-gateway-1.0.0.gem")
- has_gempackage(:name => "echoe", :download_url => "http://rubyforge.org/frs/download.php/51240/echoe-3.1.gem")
- has_gempackage(:name => "highline", :download_url => "http://rubyforge.org/frs/download.php/46328/highline-1.5.0.gem")
- has_gempackage(:name => "capistrano