wakame 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/app_generators/wakame/templates/cluster/resources/markers/http_application_server.rb +3 -0
- data/app_generators/wakame/templates/cluster/resources/markers/http_asset_server.rb +2 -0
- data/app_generators/wakame/templates/cluster/resources/markers/http_server.rb +9 -0
- data/app_generators/wakame/templates/config/cluster.rb +36 -99
- data/app_generators/wakame/templates/config/init.d/wakame-agent +3 -3
- data/app_generators/wakame/templates/config/init.d/wakame-master +3 -3
- data/app_generators/wakame/wakame_generator.rb +5 -1
- data/contrib/imagesetup.sh +9 -5
- data/lib/ext/uri.rb +13 -0
- data/lib/wakame/action.rb +46 -21
- data/lib/wakame/{rule_engine.rb → action_manager.rb} +148 -36
- data/lib/wakame/actions/deploy_config.rb +35 -0
- data/lib/wakame/actions/launch_cluster.rb +8 -10
- data/lib/wakame/actions/launch_vm.rb +26 -20
- data/lib/wakame/actions/migrate_service.rb +30 -19
- data/lib/wakame/actions/notify_child_changed.rb +34 -0
- data/lib/wakame/actions/notify_parent_changed.rb +34 -0
- data/lib/wakame/actions/propagate_resource.rb +27 -0
- data/lib/wakame/actions/propagate_service.rb +27 -0
- data/lib/wakame/actions/reload_service.rb +21 -9
- data/lib/wakame/actions/shutdown_cluster.rb +3 -3
- data/lib/wakame/actions/shutdown_vm.rb +14 -5
- data/lib/wakame/actions/start_service.rb +53 -47
- data/lib/wakame/actions/stop_service.rb +35 -23
- data/lib/wakame/actor/system.rb +6 -3
- data/lib/wakame/agent.rb +29 -7
- data/lib/wakame/amqp_client.rb +26 -5
- data/lib/wakame/command/action_status.rb +7 -7
- data/lib/wakame/command/actor.rb +10 -10
- data/lib/wakame/command/import_cluster_config.rb +10 -0
- data/lib/wakame/command/launch_cluster.rb +2 -2
- data/lib/wakame/command/launch_vm.rb +3 -3
- data/lib/wakame/command/migrate_service.rb +7 -7
- data/lib/wakame/command/propagate_resource.rb +42 -0
- data/lib/wakame/command/propagate_service.rb +21 -19
- data/lib/wakame/command/reload_service.rb +3 -13
- data/lib/wakame/command/shutdown_cluster.rb +2 -2
- data/lib/wakame/command/start_service.rb +14 -0
- data/lib/wakame/command/status.rb +32 -10
- data/lib/wakame/command/stop_service.rb +27 -21
- data/lib/wakame/command.rb +19 -3
- data/lib/wakame/command_queue.rb +87 -67
- data/lib/wakame/configuration.rb +6 -0
- data/lib/wakame/event.rb +17 -0
- data/lib/wakame/event_dispatcher.rb +32 -23
- data/lib/wakame/graph.rb +2 -1
- data/lib/wakame/initializer.rb +11 -8
- data/lib/wakame/master.rb +327 -209
- data/lib/wakame/monitor/agent.rb +5 -1
- data/lib/wakame/monitor/service.rb +6 -5
- data/lib/wakame/packets.rb +13 -21
- data/lib/wakame/runner/administrator_command.rb +383 -264
- data/lib/wakame/runner/agent.rb +1 -5
- data/lib/wakame/runner/master.rb +0 -3
- data/lib/wakame/service.rb +817 -538
- data/lib/wakame/status_db.rb +383 -0
- data/lib/wakame/template.rb +27 -130
- data/lib/wakame/trigger.rb +10 -18
- data/lib/wakame/triggers/instance_count_update.rb +1 -1
- data/lib/wakame/triggers/load_history.rb +1 -1
- data/lib/wakame/triggers/maintain_ssh_known_hosts.rb +8 -5
- data/lib/wakame/triggers/shutdown_unused_vm.rb +1 -1
- data/lib/wakame/util.rb +64 -55
- data/lib/wakame.rb +4 -0
- data/tests/test_action_manager.rb +111 -0
- data/tests/test_service.rb +128 -23
- data/tests/test_status_db.rb +82 -0
- data/tests/test_uri_amqp.rb +10 -0
- data/wakame_generators/resource/templates/apache_app/apache_app.rb +19 -18
- data/wakame_generators/resource/templates/apache_app/conf/apache2.conf +14 -2
- data/wakame_generators/resource/templates/apache_app/conf/system-app.conf +1 -1
- data/wakame_generators/resource/templates/apache_app/conf/vh/aaa.test.conf +9 -0
- data/wakame_generators/resource/templates/apache_lb/apache_lb.rb +21 -20
- data/wakame_generators/resource/templates/apache_lb/conf/apache2.conf +14 -2
- data/wakame_generators/resource/templates/apache_lb/conf/system-lb.conf +17 -2
- data/wakame_generators/resource/templates/apache_lb/conf/vh/aaa.test.conf +37 -0
- data/wakame_generators/resource/templates/apache_www/apache_www.rb +20 -18
- data/wakame_generators/resource/templates/apache_www/conf/apache2.conf +14 -2
- data/wakame_generators/resource/templates/apache_www/conf/system-www.conf +1 -1
- data/wakame_generators/resource/templates/apache_www/conf/vh/aaa.test.conf +9 -0
- data/wakame_generators/resource/templates/ec2_elastic_ip/ec2_elastic_ip.rb +6 -8
- data/wakame_generators/resource/templates/ec2_elb/ec2_elb.rb +7 -6
- data/wakame_generators/resource/templates/memcached/conf/memcached.conf +47 -0
- data/wakame_generators/resource/templates/memcached/init.d/memcached +61 -0
- data/wakame_generators/resource/templates/memcached/memcached.rb +73 -0
- data/wakame_generators/resource/templates/mysql_master/conf/my.cnf +5 -7
- data/wakame_generators/resource/templates/mysql_master/mysql_master.rb +35 -34
- data/wakame_generators/resource/templates/mysql_slave/conf/my.cnf +6 -6
- data/wakame_generators/resource/templates/mysql_slave/mysql_slave.rb +21 -24
- data/wakame_generators/resource/templates/nginx/conf/nginx.conf +17 -27
- data/wakame_generators/resource/templates/nginx/conf/vh/aaa.test.conf +30 -0
- data/wakame_generators/resource/templates/nginx/nginx.rb +18 -18
- metadata +34 -21
- data/lib/wakame/actions/propagate_instances.rb +0 -70
- data/lib/wakame/manager/commands.rb +0 -134
- data/lib/wakame/rule.rb +0 -116
- data/lib/wakame/triggers/process_command.rb +0 -41
- data/tests/test_rule_engine.rb +0 -127
- data/wakame_generators/resource/templates/apache_app/conf/sites-app.conf +0 -23
- data/wakame_generators/resource/templates/apache_lb/conf/sites-lb.conf +0 -54
- data/wakame_generators/resource/templates/apache_www/conf/sites-www.conf +0 -23
@@ -14,7 +14,7 @@ class Wakame::Monitor::Service
|
|
14
14
|
@service_monitor = svc_mon
|
15
15
|
@status = Wakame::Service::STATUS_OFFLINE
|
16
16
|
count = 0
|
17
|
-
@timer = Wakame::Monitor::CheckerTimer.new(
|
17
|
+
@timer = Wakame::Monitor::CheckerTimer.new(5) {
|
18
18
|
self.signal_checker
|
19
19
|
}
|
20
20
|
end
|
@@ -60,8 +60,10 @@ class Wakame::Monitor::Service
|
|
60
60
|
case res
|
61
61
|
when Exception
|
62
62
|
update_status(Wakame::Service::STATUS_FAIL)
|
63
|
+
@service_monitor.send_event(Wakame::Packets::StatusCheckResult.new(@service_monitor.agent, self.svc_id, Wakame::Service::STATUS_FAIL, res.message))
|
63
64
|
when Wakame::Service::STATUS_ONLINE, Wakame::Service::STATUS_OFFLINE
|
64
|
-
update_status(res)
|
65
|
+
update_status(res)
|
66
|
+
@service_monitor.send_event(Wakame::Packets::StatusCheckResult.new(@service_monitor.agent, self.svc_id, res))
|
65
67
|
else
|
66
68
|
Wakame.log.error("#{self.class}: Unknown response type from the checker: #{self.svc_id}, ")
|
67
69
|
end
|
@@ -143,7 +145,7 @@ class Wakame::Monitor::Service
|
|
143
145
|
end
|
144
146
|
|
145
147
|
def send_event(a)
|
146
|
-
Wakame.log.debug("Sending back
|
148
|
+
Wakame.log.debug("Sending back the event: #{a.class}")
|
147
149
|
publish_to('agent_event', a.marshal)
|
148
150
|
end
|
149
151
|
|
@@ -158,8 +160,7 @@ class Wakame::Monitor::Service
|
|
158
160
|
def register(svc_id, checker_type, *args)
|
159
161
|
chk = @checkers[svc_id]
|
160
162
|
if chk
|
161
|
-
|
162
|
-
raise "Service registory duplication. #{svc_id}"
|
163
|
+
unregister(svc_id)
|
163
164
|
end
|
164
165
|
case checker_type.to_sym
|
165
166
|
when :pidfile
|
data/lib/wakame/packets.rb
CHANGED
@@ -125,27 +125,19 @@ module Wakame
|
|
125
125
|
class Nop < RequestBase
|
126
126
|
end
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
# end
|
142
|
-
|
143
|
-
# class ServiceReload < RequestBase
|
144
|
-
# attr_reader :instance_id
|
145
|
-
# def initialize(instance_id)
|
146
|
-
# @instance_id = instance_id
|
147
|
-
# end
|
148
|
-
# end
|
128
|
+
class StatusCheckResult < ResponseBase
|
129
|
+
def_attribute :svc_id
|
130
|
+
def_attribute :status
|
131
|
+
def_attribute :new_status
|
132
|
+
def_attribute :fail_message
|
133
|
+
|
134
|
+
def initialize(agent, svc_id, status, fail_message=nil)
|
135
|
+
super(agent)
|
136
|
+
@svc_id = svc_id
|
137
|
+
@status = status
|
138
|
+
@fail_message = fail_message
|
139
|
+
end
|
140
|
+
end
|
149
141
|
|
150
142
|
class ServiceStatusChanged < ResponseBase
|
151
143
|
#attr_accessor :svc_id, :prev_status, :new_status, :fail_message
|