wakame 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/History.txt +4 -0
  2. data/LICENSE +202 -0
  3. data/Rakefile +11 -12
  4. data/VERSION +1 -1
  5. data/app_generators/wakame/templates/bin/wakame-agent +1 -1
  6. data/app_generators/wakame/templates/bin/wakame-master +1 -1
  7. data/app_generators/wakame/templates/config/cluster.rb +32 -24
  8. data/app_generators/wakame/templates/config/init.d/centos/wakame-agent +40 -0
  9. data/app_generators/wakame/templates/config/init.d/centos/wakame-master +40 -0
  10. data/app_generators/wakame/templates/config/init.d/wakame-master +1 -1
  11. data/lib/ext/eventmachine.rb +5 -5
  12. data/lib/wakame.rb +12 -0
  13. data/lib/wakame/action.rb +10 -11
  14. data/lib/wakame/actions/deploy_application.rb +61 -0
  15. data/lib/wakame/actions/deploy_config.rb +1 -3
  16. data/lib/wakame/actions/freeze_cluster.rb +15 -0
  17. data/lib/wakame/actions/launch_cluster.rb +1 -3
  18. data/lib/wakame/actions/launch_vm.rb +1 -1
  19. data/lib/wakame/actions/migrate_service.rb +4 -3
  20. data/lib/wakame/actions/notify_child_changed.rb +3 -6
  21. data/lib/wakame/actions/notify_parent_changed.rb +4 -7
  22. data/lib/wakame/actions/propagate_resource.rb +1 -3
  23. data/lib/wakame/actions/propagate_service.rb +1 -3
  24. data/lib/wakame/actions/register_agent.rb +43 -0
  25. data/lib/wakame/actions/reload_service.rb +2 -2
  26. data/lib/wakame/actions/shutdown_cluster.rb +4 -6
  27. data/lib/wakame/actions/shutdown_vm.rb +27 -6
  28. data/lib/wakame/actions/start_service.rb +40 -32
  29. data/lib/wakame/actions/stop_service.rb +8 -10
  30. data/lib/wakame/actions/unfreeze_cluster.rb +15 -0
  31. data/lib/wakame/actor.rb +2 -5
  32. data/lib/wakame/actor/deploy.rb +110 -0
  33. data/lib/wakame/actor/monitor.rb +14 -0
  34. data/lib/wakame/actor/s3fs.rb +45 -0
  35. data/lib/wakame/actor/service_monitor.rb +0 -17
  36. data/lib/wakame/actor/system.rb +5 -1
  37. data/lib/wakame/agent.rb +29 -179
  38. data/lib/wakame/agent_manager.rb +11 -0
  39. data/lib/wakame/agent_managers/actor_manager.rb +101 -0
  40. data/lib/wakame/agent_managers/monitor_manager.rb +48 -0
  41. data/lib/wakame/command.rb +4 -7
  42. data/lib/wakame/command/actor.rb +9 -12
  43. data/lib/wakame/command/agent_status.rb +2 -2
  44. data/lib/wakame/command/control_service.rb +66 -0
  45. data/lib/wakame/command/deploy_application.rb +18 -0
  46. data/lib/wakame/command/deploy_config.rb +16 -0
  47. data/lib/wakame/command/launch_cluster.rb +1 -1
  48. data/lib/wakame/command/launch_vm.rb +1 -1
  49. data/lib/wakame/command/propagate_resource.rb +1 -1
  50. data/lib/wakame/command/propagate_service.rb +5 -3
  51. data/lib/wakame/command/reload_service.rb +1 -1
  52. data/lib/wakame/command/shutdown_cluster.rb +1 -1
  53. data/lib/wakame/command/shutdown_vm.rb +37 -11
  54. data/lib/wakame/command/start_service.rb +1 -1
  55. data/lib/wakame/command/status.rb +6 -4
  56. data/lib/wakame/command/stop_service.rb +1 -1
  57. data/lib/wakame/configuration.rb +5 -0
  58. data/lib/wakame/event.rb +85 -33
  59. data/lib/wakame/event_dispatcher.rb +2 -2
  60. data/lib/wakame/initializer.rb +97 -31
  61. data/lib/wakame/master.rb +23 -346
  62. data/lib/wakame/master_manager.rb +11 -0
  63. data/lib/wakame/master_managers/action_manager.rb +321 -0
  64. data/lib/wakame/master_managers/agent_monitor.rb +166 -0
  65. data/lib/wakame/master_managers/cluster_manager.rb +176 -0
  66. data/lib/wakame/master_managers/command_queue.rb +133 -0
  67. data/lib/wakame/models/agent_pool.rb +113 -0
  68. data/lib/wakame/models/application_repository.rb +34 -0
  69. data/lib/wakame/models/object_store.rb +32 -0
  70. data/lib/wakame/models/service_cluster_pool.rb +36 -0
  71. data/lib/wakame/monitor.rb +3 -6
  72. data/lib/wakame/monitor/agent.rb +9 -6
  73. data/lib/wakame/monitor/service.rb +56 -29
  74. data/lib/wakame/runner/administrator_command.rb +210 -24
  75. data/lib/wakame/runner/agent.rb +2 -0
  76. data/lib/wakame/runner/master.rb +2 -1
  77. data/lib/wakame/service.rb +140 -130
  78. data/lib/wakame/status_db.rb +101 -121
  79. data/lib/wakame/util.rb +26 -15
  80. data/tests/setup_master.rb +1 -0
  81. data/tests/test_master.rb +0 -2
  82. data/tests/test_model_agent_pool.rb +21 -0
  83. data/tests/test_service.rb +14 -8
  84. data/tests/test_status_db.rb +2 -0
  85. data/tests/test_util.rb +12 -1
  86. data/wakame_generators/resource/templates/apache_app/apache_app.rb +20 -11
  87. data/wakame_generators/resource/templates/apache_app/conf/vh/aaa.test.conf +1 -1
  88. data/wakame_generators/resource/templates/apache_lb/apache_lb.rb +7 -7
  89. data/wakame_generators/resource/templates/apache_lb/conf/system-lb.conf +6 -4
  90. data/wakame_generators/resource/templates/apache_www/apache_www.rb +15 -13
  91. data/wakame_generators/resource/templates/ec2_elastic_ip/ec2_elastic_ip.rb +17 -17
  92. data/wakame_generators/resource/templates/ec2_elb/ec2_elb.rb +22 -15
  93. data/wakame_generators/resource/templates/mongodb/conf/mongodb.conf +95 -0
  94. data/wakame_generators/resource/templates/mongodb/init.d/mongodb +244 -0
  95. data/wakame_generators/resource/templates/mongodb/mongodb.rb +64 -0
  96. data/wakame_generators/resource/templates/mysql_master/mysql_master.rb +17 -21
  97. data/wakame_generators/resource/templates/nginx/conf/nginx.conf +4 -0
  98. data/wakame_generators/resource/templates/nginx/conf/vh/ec2_elb_common.conf +19 -0
  99. data/wakame_generators/resource/templates/nginx/init.d/nginx +6 -0
  100. data/wakame_generators/resource/templates/nginx/init.d/spawn-fcgi +46 -0
  101. data/wakame_generators/resource/templates/nginx/nginx.rb +15 -10
  102. data/wakame_generators/resource/templates/nginx_passenger/conf/nginx-passenger.conf +39 -0
  103. data/wakame_generators/resource/templates/nginx_passenger/conf/vh/ec2_elb_common.conf +10 -0
  104. data/wakame_generators/resource/templates/nginx_passenger/init.d/nginx-passenger +70 -0
  105. data/wakame_generators/resource/templates/nginx_passenger/nginx_passenger.rb +71 -0
  106. data/wakame_generators/resource/templates/s3fs/s3fs.rb +24 -0
  107. metadata +195 -74
  108. data/lib/wakame/action_manager.rb +0 -303
  109. data/lib/wakame/command/clone_service.rb +0 -12
  110. data/lib/wakame/command_queue.rb +0 -135
  111. data/lib/wakame/vm_manipulator.rb +0 -187
@@ -1,3 +1,7 @@
1
+ == 0.5.1 2009-11-22
2
+
3
+ * Add deploy_application action.
4
+
1
5
  == 0.5.0 2009-09-18
2
6
 
3
7
  * Add Memcached resource.
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2009 axsh Co. Ltd.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/Rakefile CHANGED
@@ -6,29 +6,28 @@ require 'rake/clean'
6
6
  begin
7
7
  require 'jeweler'
8
8
  Jeweler::Tasks.new do |gem|
9
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
9
10
  gem.name = "wakame"
10
11
  gem.summary = %q{A distributed service framework on top of Cloud environments.}
11
12
  gem.description = <<__END__
12
13
  __END__
13
- gem.email = ["m-fujiwara@axsh.net"]
14
- gem.homepage = "http://wakame.rubyforge.org/"
15
- gem.authors = ["axsh co.,Ltd.", "Masahiro Fujiwara"]
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- gem.rubyforge_project = 'wakame'
14
+ gem.email = ["info@axsh.net"]
15
+ gem.homepage = "http://wakame.axsh.jp/"
16
+ gem.authors = ["axsh Co. Ltd."]
18
17
  gem.executables = ['wakame']
19
- [['amqp','>= 0.6.0'],
18
+ [['amqp','>= 0.6.5'],
20
19
  ['right_aws','>= 1.10.0'], # Ec2ELB works with 1.10.99 in their github.
21
- ['eventmachine','>= 0.12.8'],
20
+ ['eventmachine','>= 0.12.10'],
22
21
  ['rake', '>= 0.8.7'],
23
22
  ['log4r', '>= 1.0.5'],
24
23
  ['daemons', '>= 1.0.10'],
25
24
  ['rubigen', '>= 1.5.2'],
26
- ['open4', '>= 0.9.6'],
25
+ ['open4', '>= 1.0.0'],
27
26
  ['jeweler', '>= 1.0.0'],
28
27
  ['rack', '>= 1.0.0'],
29
- ['thin', '>= 1.2.2'],
28
+ ['thin', '>= 1.2.5'],
30
29
  ['json', '>= 1.1.7'],
31
- ['sequel', '>= 3.2.0']
30
+ ['sequel', '>= 3.6.0']
32
31
  ].each { |i|
33
32
  gem.add_dependency(i[0], i[1])
34
33
  }
@@ -41,9 +40,9 @@ __END__
41
40
  'tasks/**/*',
42
41
  'tests/**/*'].to_a
43
42
  end
44
-
43
+ Jeweler::GemcutterTasks.new
45
44
  rescue LoadError
46
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
45
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
47
46
  end
48
47
 
49
48
  require 'rake/testtask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/../config/boot'
4
4
 
5
- Wakame::Bootstrap.boot_agent!
5
+ Wakame::Bootstrap.boot!
6
6
 
7
7
  require 'wakame/runner/agent'
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/../config/boot'
4
4
 
5
- Wakame::Bootstrap.boot_master!
5
+ Wakame::Bootstrap.boot!
6
6
 
7
7
  require 'wakame/runner/master'
8
8
 
@@ -1,37 +1,45 @@
1
+ Wakame.log.debug("WAKAME_CLUSTER_ENV=#{Wakame.config.cluster_env}")
2
+
3
+ case Wakame.config.cluster_env
4
+ when 'development'
5
+ ec2_elb_front_fqdn = 'www.d.example.com'
6
+ elb_name = ''
7
+ when 'test'
8
+ ec2_elb_front_fqdn = 'www.t.example.com'
9
+ elb_name = ''
10
+ when 'qa'
11
+ ec2_elb_front_fqdn = 'www.q.example.com'
12
+ elb_name = ''
13
+ when 'production'
14
+ ec2_elb_front_fqdn = 'www.example.com'
15
+ elb_name = ''
16
+ end
17
+
18
+
1
19
  define_cluster('WebCluster1') { |c|
2
- c.add_resource(Apache_APP.new) { |r|
3
- r.listen_port = 8001
4
- r.max_instances = 5
5
- }
6
- c.add_resource(Nginx.new)
7
20
  c.add_resource(Ec2ELB.new) { |r|
8
- r.elb_name = 'xxxxxxx'
21
+ r.elb_name = elb_name
22
+ r.just_unregister_when_stop = true
9
23
  }
10
- c.add_resource(MySQL_Master.new) {|r|
11
- r.mysqld_basedir = '/home/wakame/mysql'
12
- r.ebs_volume = 'vol-xxxxxxx'
13
- r.ebs_device = '/dev/sdm'
24
+ c.add_resource(Nginx.new) { |r|
25
+ r.max_instances = 5
26
+ r.ec2_elb_front_fqdn = ec2_elb_front_fqdn
27
+ # r.fcgi_enabled = true
14
28
  }
29
+ #c.add_resource(MySQL_Master.new) {|r|
30
+ # r.mysqld_basedir = '/home/wakame/mysql'
31
+ # r.ebs_volume = 'vol-xxxxxxx'
32
+ # r.ebs_device = '/dev/sdm'
33
+ #}
15
34
 
16
- c.set_dependency(Apache_APP, Nginx)
17
35
  c.set_dependency(Nginx, Ec2ELB)
18
- c.set_dependency(MySQL_Master, Apache_APP)
36
+ #c.set_dependency(MySQL_Master, Nginx)
19
37
 
20
38
  host = c.add_cloud_host { |h|
21
39
  #h.vm_spec.availability_zone = 'us-east-1a'
22
40
  }
41
+
23
42
  c.propagate(Nginx, host.id)
24
- c.propagate(Apache_APP, host.id)
25
- c.propagate(MySQL_Master, host.id)
43
+ #c.propagate(MySQL_Master, host.id)
26
44
  c.propagate(Ec2ELB)
27
-
28
- c.define_triggers {|r|
29
- #r.register_trigger(Wakame::Triggers::MaintainSshKnownHosts.new)
30
- #r.register_trigger(Wakame::Triggers::LoadHistoryMonitor.new)
31
- #r.register_trigger(Wakame::Triggers::InstanceCountUpdate.new)
32
- #r.register_trigger(Wakame::Triggers::ScaleOutWhenHighLoad.new)
33
- #r.register_trigger(Wakame::Triggers::ShutdownUnusedVM.new)
34
- }
35
-
36
45
  }
37
-
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+ #
3
+
4
+ NAME=`basename $0`
5
+ USER=wakame
6
+ GROUP=wakame
7
+ PIDFILE=/var/run/wakame/$NAME.pid
8
+
9
+ . /etc/rc.d/init.d/functions
10
+ [ -f /etc/default/wakame ] && {
11
+ . /etc/default/wakame
12
+ export WAKAME_ROOT WAKAME_ENV
13
+ }
14
+
15
+ DAEMON=$WAKAME_ROOT/bin/$NAME
16
+
17
+ case "$1" in
18
+ start)
19
+ echo -n $"Starting $NAME: "
20
+ $DAEMON $USER $OPTIONS && success || failure
21
+ RETVAL=$?
22
+ echo
23
+ ;;
24
+ stop)
25
+ echo -n $"Stopping $NAME: "
26
+ kill `cat $PIDFILE`
27
+ RETVAL=$?
28
+ echo
29
+ ;;
30
+ restart)
31
+ $0 stop
32
+ sleep 1
33
+ $0 start
34
+ ;;
35
+ *)
36
+ echo $"Usage: $0 [start|stop|restart]"
37
+ RETVAL=1
38
+ ;;
39
+ esac
40
+ exit $RETVAL
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+ #
3
+
4
+ NAME=`basename $0`
5
+ USER=wakame
6
+ GROUP=wakame
7
+ PIDFILE=/var/run/wakame/$NAME.pid
8
+
9
+ . /etc/rc.d/init.d/functions
10
+ [ -f /etc/default/wakame ] && {
11
+ . /etc/default/wakame
12
+ export WAKAME_ROOT WAKAME_ENV
13
+ }
14
+
15
+ DAEMON=$WAKAME_ROOT/bin/$NAME
16
+
17
+ case "$1" in
18
+ start)
19
+ echo -n $"Starting $NAME: "
20
+ $DAEMON -u $USER $OPTIONS && success || failure
21
+ RETVAL=$?
22
+ echo
23
+ ;;
24
+ stop)
25
+ echo -n $"Stopping $NAME: "
26
+ kill `cat $PIDFILE`
27
+ RETVAL=$?
28
+ echo
29
+ ;;
30
+ restart)
31
+ $0 stop
32
+ sleep 1
33
+ $0 start
34
+ ;;
35
+ *)
36
+ echo $"Usage: $0 [start|stop|restart]"
37
+ RETVAL=1
38
+ ;;
39
+ esac
40
+ exit $RETVAL
@@ -23,7 +23,7 @@ PIDFILE=/var/run/wakame/wakame-master.pid
23
23
  . /lib/lsb/init-functions
24
24
  if [ -z $WAKAME_ROOT ]; then
25
25
  [ -f /etc/default/wakame ] && . /etc/default/wakame
26
- export GEM_HOME WAKAME_ROOT WAKAME_ENV
26
+ export GEM_HOME WAKAME_ROOT WAKAME_ENV WAKAME_CLUSTER_ENV
27
27
  fi
28
28
 
29
29
  start_master()
@@ -35,7 +35,7 @@ module EventMachine
35
35
 
36
36
  # Redefine EM's threadpool
37
37
  def self.spawn_threadpool
38
- until @threadpool.size == 20
38
+ until @threadpool.size == 30
39
39
  thread = Thread.new {
40
40
  loop {
41
41
  op, cback = *@threadqueue.pop
@@ -61,20 +61,20 @@ module EventMachine
61
61
 
62
62
  raise "Eventmachine is not ready to accept the next_tick() call." unless self.reactor_running?
63
63
 
64
- @q ||= ::Queue.new
64
+ q = ::Queue.new
65
65
  time_start = ::Time.now
66
66
 
67
67
  self.next_tick {
68
68
  #self.add_timer(0) {
69
69
  begin
70
70
  res = blk.call
71
- @q << [true, res]
71
+ q << [true, res]
72
72
  rescue => e
73
- @q << [false, e]
73
+ q << [false, e]
74
74
  end
75
75
  }
76
76
 
77
- res = @q.shift
77
+ res = q.shift
78
78
  time_elapsed = ::Time.now - time_start
79
79
  Wakame.log.debug("EM.barrier: elapsed time for #{blk}: #{time_elapsed} sec (#{$eventmachine_library})") if time_elapsed > 0.05
80
80
  if res[0] == false && res[1].is_a?(Exception)