auser-poolparty 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CHANGELOG +12 -0
  2. data/Manifest +115 -0
  3. data/README.txt +140 -0
  4. data/Rakefile +27 -0
  5. data/bin/instance +61 -0
  6. data/bin/pool +62 -0
  7. data/config/cloud_master_takeover +17 -0
  8. data/config/create_proxy_ami.sh +582 -0
  9. data/config/haproxy.conf +29 -0
  10. data/config/heartbeat.conf +8 -0
  11. data/config/heartbeat_authkeys.conf +2 -0
  12. data/config/installers/ubuntu_install.sh +77 -0
  13. data/config/monit/haproxy.monit.conf +7 -0
  14. data/config/monit/nginx.monit.conf +0 -0
  15. data/config/monit.conf +9 -0
  16. data/config/nginx.conf +24 -0
  17. data/config/reconfigure_instances_script.sh +18 -0
  18. data/config/sample-config.yml +23 -0
  19. data/config/scp_instances_script.sh +12 -0
  20. data/lib/core/array.rb +13 -0
  21. data/lib/core/exception.rb +9 -0
  22. data/lib/core/float.rb +13 -0
  23. data/lib/core/hash.rb +11 -0
  24. data/lib/core/kernel.rb +12 -0
  25. data/lib/core/module.rb +22 -0
  26. data/lib/core/object.rb +18 -0
  27. data/lib/core/proc.rb +15 -0
  28. data/lib/core/string.rb +49 -0
  29. data/lib/core/time.rb +41 -0
  30. data/lib/modules/callback.rb +133 -0
  31. data/lib/modules/ec2_wrapper.rb +82 -0
  32. data/lib/modules/safe_instance.rb +31 -0
  33. data/lib/modules/vlad_override.rb +82 -0
  34. data/lib/poolparty/application.rb +170 -0
  35. data/lib/poolparty/init.rb +6 -0
  36. data/lib/poolparty/master.rb +329 -0
  37. data/lib/poolparty/monitors/cpu.rb +19 -0
  38. data/lib/poolparty/monitors/memory.rb +26 -0
  39. data/lib/poolparty/monitors/web.rb +23 -0
  40. data/lib/poolparty/monitors.rb +13 -0
  41. data/lib/poolparty/optioner.rb +16 -0
  42. data/lib/poolparty/plugin.rb +43 -0
  43. data/lib/poolparty/plugin_manager.rb +67 -0
  44. data/lib/poolparty/provider/packages/essential.rb +6 -0
  45. data/lib/poolparty/provider/packages/git.rb +4 -0
  46. data/lib/poolparty/provider/packages/haproxy.rb +20 -0
  47. data/lib/poolparty/provider/packages/heartbeat.rb +4 -0
  48. data/lib/poolparty/provider/packages/monit.rb +6 -0
  49. data/lib/poolparty/provider/packages/rsync.rb +4 -0
  50. data/lib/poolparty/provider/packages/ruby.rb +37 -0
  51. data/lib/poolparty/provider/packages/s3fuse.rb +11 -0
  52. data/lib/poolparty/provider/provider.rb +60 -0
  53. data/lib/poolparty/provider.rb +2 -0
  54. data/lib/poolparty/remote_instance.rb +216 -0
  55. data/lib/poolparty/remoter.rb +106 -0
  56. data/lib/poolparty/remoting.rb +112 -0
  57. data/lib/poolparty/scheduler.rb +103 -0
  58. data/lib/poolparty/tasks/cloud.rake +57 -0
  59. data/lib/poolparty/tasks/development.rake +38 -0
  60. data/lib/poolparty/tasks/ec2.rake +20 -0
  61. data/lib/poolparty/tasks/instance.rake +63 -0
  62. data/lib/poolparty/tasks/plugins.rake +30 -0
  63. data/lib/poolparty/tasks/server.rake +42 -0
  64. data/lib/poolparty/tasks.rb +29 -0
  65. data/lib/poolparty/tmp.rb +46 -0
  66. data/lib/poolparty.rb +105 -0
  67. data/lib/s3/s3_object_store_folders.rb +44 -0
  68. data/misc/basics_tutorial.txt +142 -0
  69. data/poolparty.gemspec +72 -0
  70. data/spec/application_spec.rb +39 -0
  71. data/spec/callback_spec.rb +194 -0
  72. data/spec/core_spec.rb +15 -0
  73. data/spec/helpers/ec2_mock.rb +44 -0
  74. data/spec/kernel_spec.rb +11 -0
  75. data/spec/master_spec.rb +203 -0
  76. data/spec/monitors/cpu_monitor_spec.rb +38 -0
  77. data/spec/monitors/memory_spec.rb +50 -0
  78. data/spec/monitors/misc_monitor_spec.rb +50 -0
  79. data/spec/monitors/web_spec.rb +39 -0
  80. data/spec/optioner_spec.rb +22 -0
  81. data/spec/plugin_manager_spec.rb +31 -0
  82. data/spec/plugin_spec.rb +101 -0
  83. data/spec/pool_binary_spec.rb +10 -0
  84. data/spec/poolparty_spec.rb +15 -0
  85. data/spec/provider_spec.rb +17 -0
  86. data/spec/remote_instance_spec.rb +149 -0
  87. data/spec/remoter_spec.rb +65 -0
  88. data/spec/remoting_spec.rb +84 -0
  89. data/spec/scheduler_spec.rb +75 -0
  90. data/spec/spec_helper.rb +39 -0
  91. data/spec/string_spec.rb +28 -0
  92. data/web/static/conf/nginx.conf +22 -0
  93. data/web/static/site/images/balloon.png +0 -0
  94. data/web/static/site/images/cb.png +0 -0
  95. data/web/static/site/images/clouds.png +0 -0
  96. data/web/static/site/images/railsconf_preso_img.png +0 -0
  97. data/web/static/site/index.html +71 -0
  98. data/web/static/site/javascripts/application.js +3 -0
  99. data/web/static/site/javascripts/corner.js +178 -0
  100. data/web/static/site/javascripts/jquery-1.2.6.pack.js +11 -0
  101. data/web/static/site/misc.html +42 -0
  102. data/web/static/site/storage/pool_party_presentation.pdf +0 -0
  103. data/web/static/site/stylesheets/application.css +100 -0
  104. data/web/static/site/stylesheets/reset.css +17 -0
  105. data/web/static/src/layouts/application.haml +25 -0
  106. data/web/static/src/pages/index.haml +25 -0
  107. data/web/static/src/pages/misc.haml +5 -0
  108. data/web/static/src/stylesheets/application.sass +100 -0
  109. metadata +260 -0
data/CHANGELOG ADDED
@@ -0,0 +1,12 @@
1
+ v0.0.8 * Added plugin_manager
2
+ * Moved remoting to rake remote task (from vlad)
3
+ * Changed configuration from instance-based to cloud-based
4
+ v0.0.7 * Updated source
5
+ v0.0.6 * Plugin support
6
+ * Cleaned up base
7
+ * Extensible monitoring
8
+ v0.0.5 Initial launched release
9
+ v0.0.4 Rewrite before release - with haproxy, heartbeat, hosts and s3fuse
10
+ v0.0.3 Rewrite - Cleanup
11
+ v0.0.2 Rewrite - with web-proxy methods
12
+ v0.0.1 Initial idea
data/Manifest ADDED
@@ -0,0 +1,115 @@
1
+ archives/ruby-1.8.6-p111.tar.gz
2
+ bin/instance
3
+ bin/pool
4
+ CHANGELOG
5
+ config/cloud_master_takeover
6
+ config/create_proxy_ami.sh
7
+ config/haproxy.conf
8
+ config/heartbeat.conf
9
+ config/heartbeat_authkeys.conf
10
+ config/installers/ubuntu_install.sh
11
+ config/monit/haproxy.monit.conf
12
+ config/monit/nginx.monit.conf
13
+ config/monit.conf
14
+ config/nginx.conf
15
+ config/reconfigure_instances_script.sh
16
+ config/sample-config.yml
17
+ config/scp_instances_script.sh
18
+ lib/core/array.rb
19
+ lib/core/exception.rb
20
+ lib/core/float.rb
21
+ lib/core/hash.rb
22
+ lib/core/kernel.rb
23
+ lib/core/module.rb
24
+ lib/core/object.rb
25
+ lib/core/proc.rb
26
+ lib/core/string.rb
27
+ lib/core/time.rb
28
+ lib/modules/callback.rb
29
+ lib/modules/ec2_wrapper.rb
30
+ lib/modules/safe_instance.rb
31
+ lib/modules/vlad_override.rb
32
+ lib/poolparty/application.rb
33
+ lib/poolparty/init.rb
34
+ lib/poolparty/master.rb
35
+ lib/poolparty/monitors/cpu.rb
36
+ lib/poolparty/monitors/memory.rb
37
+ lib/poolparty/monitors/web.rb
38
+ lib/poolparty/monitors.rb
39
+ lib/poolparty/optioner.rb
40
+ lib/poolparty/plugin.rb
41
+ lib/poolparty/plugin_manager.rb
42
+ lib/poolparty/provider/packages/essential.rb
43
+ lib/poolparty/provider/packages/git.rb
44
+ lib/poolparty/provider/packages/haproxy.rb
45
+ lib/poolparty/provider/packages/heartbeat.rb
46
+ lib/poolparty/provider/packages/monit.rb
47
+ lib/poolparty/provider/packages/rsync.rb
48
+ lib/poolparty/provider/packages/ruby.rb
49
+ lib/poolparty/provider/packages/s3fuse.rb
50
+ lib/poolparty/provider/provider.rb
51
+ lib/poolparty/provider.rb
52
+ lib/poolparty/remote_instance.rb
53
+ lib/poolparty/remoter.rb
54
+ lib/poolparty/remoting.rb
55
+ lib/poolparty/scheduler.rb
56
+ lib/poolparty/tasks/cloud.rake
57
+ lib/poolparty/tasks/development.rake
58
+ lib/poolparty/tasks/ec2.rake
59
+ lib/poolparty/tasks/instance.rake
60
+ lib/poolparty/tasks/plugins.rake
61
+ lib/poolparty/tasks/server.rake
62
+ lib/poolparty/tasks.rb
63
+ lib/poolparty/tmp.rb
64
+ lib/poolparty.rb
65
+ lib/s3/s3_object_store_folders.rb
66
+ Manifest
67
+ misc/basics_tutorial.txt
68
+ Rakefile
69
+ README.txt
70
+ spec/application_spec.rb
71
+ spec/callback_spec.rb
72
+ spec/core_spec.rb
73
+ spec/helpers/ec2_mock.rb
74
+ spec/kernel_spec.rb
75
+ spec/master_spec.rb
76
+ spec/monitors/cpu_monitor_spec.rb
77
+ spec/monitors/memory_spec.rb
78
+ spec/monitors/misc_monitor_spec.rb
79
+ spec/monitors/web_spec.rb
80
+ spec/optioner_spec.rb
81
+ spec/plugin_manager_spec.rb
82
+ spec/plugin_spec.rb
83
+ spec/pool_binary_spec.rb
84
+ spec/poolparty_spec.rb
85
+ spec/provider_spec.rb
86
+ spec/remote_instance_spec.rb
87
+ spec/remoter_spec.rb
88
+ spec/remoting_spec.rb
89
+ spec/scheduler_spec.rb
90
+ spec/spec_helper.rb
91
+ spec/string_spec.rb
92
+ tmp/node0-pool-party-ha.cf
93
+ tmp/node0-pool-party-haresources
94
+ tmp/node0-pool-party-hosts
95
+ tmp/node1-pool-party-ha.cf
96
+ tmp/node1-pool-party-haresources
97
+ tmp/node1-pool-party-hosts
98
+ tmp/pool-party-haproxy.cfg
99
+ web/static/conf/nginx.conf
100
+ web/static/site/images/balloon.png
101
+ web/static/site/images/cb.png
102
+ web/static/site/images/clouds.png
103
+ web/static/site/images/railsconf_preso_img.png
104
+ web/static/site/index.html
105
+ web/static/site/javascripts/application.js
106
+ web/static/site/javascripts/corner.js
107
+ web/static/site/javascripts/jquery-1.2.6.pack.js
108
+ web/static/site/misc.html
109
+ web/static/site/storage/pool_party_presentation.pdf
110
+ web/static/site/stylesheets/application.css
111
+ web/static/site/stylesheets/reset.css
112
+ web/static/src/layouts/application.haml
113
+ web/static/src/pages/index.haml
114
+ web/static/src/pages/misc.haml
115
+ web/static/src/stylesheets/application.sass
data/README.txt ADDED
@@ -0,0 +1,140 @@
1
+ = PoolParty
2
+
3
+ http://poolpartyrb.com
4
+ Ari Lerner
5
+ CitrusByte
6
+ http://blog.citrusbyte.com
7
+
8
+ == DESCRIPTION:
9
+
10
+ PoolParty (http://poolpartyrb.com), Ari Lerner (http://blog.xnot.org, http://blog.citrusbyte.com) - PoolParty is a framework for maintaining and running auto-scalable applications on Amazon's EC2 cloud. Run entire applications using the EC2 cluster and the unlimited S3 disk. More details to be listed at http://poolpartyrb.com.
11
+
12
+ == Basics
13
+
14
+ PoolParty is written with the intention of being as application-agnostic as possible. It installs only the basic required software to glue the cloud together on the instances as listed below.
15
+
16
+ PoolParty is easily configuration. In fact, it makes little assumptions about your development environment and allows several options on how to begin configuring the cloud.
17
+
18
+ = Development setup
19
+
20
+ === IN THE ENVIRONMENT
21
+
22
+ There are 5 values that PoolParty reads from the environment, you can set these basic environment variables and leave the rest to the PoolParty defaults. Those values are:
23
+
24
+ ENV["ACCESS_KEY"] => AWS access key
25
+ ENV["SECRET_ACCESS_KEY"] => AWS secret access key
26
+ ENV["CONFIG_FILE"] => Location of your config yaml file (optional)
27
+ ENV["EC2_HOME"] => EC2 home directory (defaults to ~/.ec2)
28
+ ENV["KEYPAIR_NAME"] => The keypair used to launch instances
29
+
30
+ The structure assumed for the keypair is EC2_HOME/id_rsa-<keypairname>
31
+
32
+ === IN A CONFIG FILE
33
+
34
+ PoolParty assumes your config directory is set in config/config.yml. However, you can set this in your environment variables and it will read the config file from the environment variable
35
+
36
+ === WITH A RAKE TASK
37
+
38
+ PoolParty comes with a rake task that can setup your environment for you. Set the environment variables above and run
39
+
40
+ rake dev:setup
41
+
42
+ This will write a .<KEYPAIR_NAME>_pool_keys into your home directory. Then you can just run
43
+
44
+ source ~/.<KEYPAIR_NAME>_pool_keys
45
+
46
+ and your environment will be all setup for you everytime you want to work on the cloud
47
+
48
+ = Basics
49
+
50
+ PoolParty can work in two ways to load balance it's traffic. It can either do server-side or client-side load-balancing. Since every instance load balances itself, you can either set the client to grab an instance and send it to that using client-side load balancing (with a js library). Alternatively, you can set the master in dns and reference it when referring to the application.
51
+
52
+ Since PoolParty makes no assumptions as to what you will be hosting on the application, the world is your oyster when running a cloud. You can set each instance to register with a dynDNS service so that your application has multiple points of entry and can run load-balanced on the fly.
53
+
54
+ Every instance will auto-mount the s3 bucket set in the config file (if it is set up) into the /data folder of the instance. This gives each instance access to the same data regardless of the instance. It uses s3fuse and caching through s3fuse in the /tmp directory to work as fast as possible on the local instances.
55
+
56
+ The instances all are loaded with the following software:
57
+
58
+ * Haproxy - The basic load balancing software
59
+ * Heartbeat - The failover software
60
+ * S3Fuse - The mounting software for the s3 bucket
61
+ * Monit - The maintainer of the services to maintain services
62
+
63
+ When an instance is started or brought down, the master is responsible for reloading every instance with the new data on each instance. If the master goes down, the next in succession will take over as the master (using heartbeat) and it will reconfigure the cloud, setting itself as the master and take over the maintenance of the cloud.
64
+
65
+ Your cloud is never guaranteed to be maintained, but with more than 1 instance unless you have more than 1 instance up
66
+
67
+ Each instance has a /etc/hosts file that has each node listed as the node name listed in the cloud:list (rake task).
68
+
69
+ = CloudSpeak - Communicating to your cloud(s)
70
+ Binaries!
71
+ Included in PoolParty are two binaries to communicate back with your clouds. Those are:
72
+
73
+ * pool - operate on your pool. This includes list, start, stop maintain, restart. Check the help with pool -h
74
+ * instance - operate on a specific instance. This allos you to ssh, scp, reload, install as well. Check the help with: instance -h
75
+
76
+ The cloud can be maintained entirely through rake tasks, although there are a few front-ends being developed (one in cocoa).
77
+
78
+ It is simple to include these tasks in your Rakefile. Just add the following lines:
79
+
80
+ require "poolparty"
81
+ PoolParty.include_cloud_tasks # or PoolParty.tasks or PoolParty.include_tasks
82
+
83
+ All the cloud rake tasks are in the cloud namespace and can be viewed with:
84
+
85
+ rake -T cloud
86
+
87
+ The instance rake tasks are in the instance namespace and can be listed with:
88
+
89
+ rake -T instance
90
+
91
+ For more help, check http://poolpartyrb.com
92
+
93
+ == REQUIREMENTS:
94
+
95
+ * aws/s3
96
+ * SQS
97
+ * aska
98
+ * EC2
99
+
100
+ == INSTALL:
101
+
102
+ gem install poolparty
103
+
104
+ == ROADMAP
105
+
106
+ * v0.0.5 - Released!
107
+ * v0.0.6 - Speed the configuration on the instances
108
+ * v0.0.7 - Callback support
109
+ * v0.0.8 - Add SQS task support
110
+
111
+ == THANKS
112
+
113
+ Ron Evans, http://deadprogrammersociety.blogspot.com/ for his enthusiasm
114
+ Tim Goh, http://citrusbyte.com for sanity checks and thoughts
115
+ Daniel Fischer, http://citrusbyte.com for initial site design
116
+
117
+ == LICENSE:
118
+
119
+ (The MIT License)
120
+
121
+ Copyright (c) 2008 Ari Lerner. CitrusByte
122
+
123
+ Permission is hereby granted, free of charge, to any person obtaining
124
+ a copy of this software and associated documentation files (the
125
+ 'Software'), to deal in the Software without restriction, including
126
+ without limitation the rights to use, copy, modify, merge, publish,
127
+ distribute, sublicense, and/or sell copies of the Software, and to
128
+ permit persons to whom the Software is furnished to do so, subject to
129
+ the following conditions:
130
+
131
+ The above copyright notice and this permission notice shall be
132
+ included in all copies or substantial portions of the Software.
133
+
134
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
135
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
136
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
137
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
138
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
139
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
140
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'echoe'
3
+ require 'lib/poolparty'
4
+
5
+ task :default => :test
6
+
7
+ Echoe.new("poolparty") do |p|
8
+ p.author = "Ari Lerner"
9
+ p.email = "ari.lerner@citrusbyte.com"
10
+ p.summary = "Run your entire application off EC2, managed and auto-scaling"
11
+ p.url = "http://blog.citrusbyte.com"
12
+ p.dependencies = %w(aws-s3 amazon-ec2 aska git)
13
+ p.install_message =<<-EOM
14
+ Thanks for installing PoolParty!
15
+
16
+ Please check out the documentation for any questions or check out the google groups at
17
+ http://groups.google.com/group/poolpartyrb
18
+
19
+ Don't forget to check out the plugins for extending PoolParty!
20
+
21
+ For more information, check http://poolpartyrb.com
22
+ *** Ari Lerner @ <ari.lerner@citrusbyte.com> ***
23
+ EOM
24
+ p.include_rakefile = true
25
+ end
26
+
27
+ PoolParty.include_tasks
data/bin/instance ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/ruby
2
+ require 'rubygems'
3
+ require 'optparse'
4
+ require 'poolparty'
5
+ require "fileutils"
6
+
7
+ # Set defaults
8
+ commandables = %w(ssh cmd scp restart start stop install start_maintain stop_maintain)
9
+ options = PoolParty.options(:optsparse =>
10
+ { :banner => <<-EOU
11
+ Usage: instance [OPTIONS] { #{commandables.join(" | ")} }
12
+ -----------------------------------------------------------------
13
+ EOU
14
+ })
15
+ PoolParty.load_plugins
16
+ master = PoolParty::Master.new
17
+ list = PoolParty::Optioner.parse(ARGV.dup, %w(-v))
18
+ num = list.reject {|a| commandables.include?(a) }.pop
19
+
20
+ instance = master.get_node(num)
21
+
22
+ unless instance
23
+ puts "Cloud is not running"
24
+ exit
25
+ end
26
+
27
+ case list[0]
28
+ when "ssh"
29
+ PoolParty.message "Ssh'ing into #{instance.ip}"
30
+ instance.ssh
31
+ when "cmd"
32
+ PoolParty.message "Executing #{instance_options[:cmd]} on #{instance.ip}"
33
+ instance.ssh instance_options[:cmd]
34
+ when "scp"
35
+ instance.scp instance_options[:src], instance_options[:dest]
36
+ when "restart"
37
+ PoolParty.message "Restarting services"
38
+ instance.restart_with_monit
39
+ when "start"
40
+ PoolParty.message "Starting services"
41
+ instance.start_with_monit
42
+ when "stop"
43
+ PoolParty.message "Stopping services"
44
+ instance.stop_with_monit
45
+ when "install"
46
+ PoolParty.message "Installing services"
47
+ instance.install
48
+ when "start_maintain"
49
+ PoolParty.message "Running heartbeat failover service"
50
+ pid = Master.run_thread_loop(:daemonize => true) do
51
+ instance.become_master if instance.is_not_master_and_master_is_not_running?
52
+ end
53
+ File.open(Application.maintain_pid_path) {|f| f.write(pid)}
54
+ when "stop_maintain"
55
+ PoolParty.message "Stopping heartbeat failover service"
56
+ pid = open(Application.maintain_pid_path).read
57
+ `kill -9 #{pid}`
58
+ FileUtils.rm Application.maintain_pid_path # Check this
59
+ else
60
+ puts master.list
61
+ end
data/bin/pool ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/ruby
2
+ require 'rubygems'
3
+ $:.unshift(File.join(File.dirname(__FILE__), "lib"))
4
+ require 'poolparty'
5
+
6
+ def display_config_data
7
+ PoolParty.message <<-EOM
8
+ Starting #{PoolParty::Application.app_name ? "#{PoolParty::Application.app_name} " : "" }cloud
9
+ On #{PoolParty::Application.ami}
10
+ Minimum instances: #{PoolParty::Application.minimum_instances}
11
+ Maximum instances: #{PoolParty::Application.maximum_instances}
12
+ Polling every: #{PoolParty::Application.polling_time}
13
+ Keypair: #{PoolParty::Application.keypair}
14
+ size: #{PoolParty::Application.size}
15
+ Plugins:
16
+ --------------
17
+ #{Dir["#{PoolParty::Application.plugin_dir}/*"].collect {|a| " #{File.basename(a)}"}.join("\n")}
18
+
19
+ EOM
20
+ end
21
+
22
+ # Set defaults
23
+ options = PoolParty.options(:optsparse =>
24
+ {:banner => <<-EOU
25
+ Usage: pool [OPTIONS] {start | stop | list | maintain | restart | install | configure}
26
+ -----------------------------------------------------------------
27
+ EOU
28
+ })
29
+
30
+ PoolParty.load_plugins
31
+ master = PoolParty::Master.new
32
+ list = PoolParty::Optioner.parse(ARGV.dup, %w(-v))
33
+
34
+ case list[0]
35
+ when "start"
36
+ display_config_data
37
+ master.start_cloud!
38
+ when "show"
39
+ display_config_data
40
+ when "grow"
41
+ master.grow_by_one
42
+ when "shrink"
43
+ master.shrink_by_one
44
+ when "install"
45
+ master.install_cloud
46
+ when "configure"
47
+ master.configure_cloud
48
+ when "stop"
49
+ PoolParty.message "Stopping cloud"
50
+ master.request_termination_of_all_instances
51
+ when "list"
52
+ puts master.list
53
+ when "maintain"
54
+ PoolParty.message "Maintaining cloud"
55
+ master.start_monitor!
56
+ when "restart"
57
+ PoolParty.message "Restarting cloud"
58
+ master.request_termination_of_all_instances
59
+ master.start_cloud!
60
+ else
61
+ puts master.list
62
+ end
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ # This is responsible for checking to make sure that the master instance is up and running
3
+ # and if it is not, take over the master role and reconfigure the cloud
4
+ case $1 in
5
+ start)
6
+ instance start_maintain
7
+ ;;
8
+ stop)
9
+ instance stop_maintain
10
+ ;;
11
+ status)
12
+ ps aux | awk '{print $2}' | grep `cat /var/run/pool_maintain.pid`
13
+ ;;
14
+ *)
15
+ echo "Syntax incorrect. You need one of {start|stop|status}"
16
+ ;;
17
+ esac