wakame 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/LICENSE +202 -0
- data/Rakefile +11 -12
- data/VERSION +1 -1
- data/app_generators/wakame/templates/bin/wakame-agent +1 -1
- data/app_generators/wakame/templates/bin/wakame-master +1 -1
- data/app_generators/wakame/templates/config/cluster.rb +32 -24
- data/app_generators/wakame/templates/config/init.d/centos/wakame-agent +40 -0
- data/app_generators/wakame/templates/config/init.d/centos/wakame-master +40 -0
- data/app_generators/wakame/templates/config/init.d/wakame-master +1 -1
- data/lib/ext/eventmachine.rb +5 -5
- data/lib/wakame.rb +12 -0
- data/lib/wakame/action.rb +10 -11
- data/lib/wakame/actions/deploy_application.rb +61 -0
- data/lib/wakame/actions/deploy_config.rb +1 -3
- data/lib/wakame/actions/freeze_cluster.rb +15 -0
- data/lib/wakame/actions/launch_cluster.rb +1 -3
- data/lib/wakame/actions/launch_vm.rb +1 -1
- data/lib/wakame/actions/migrate_service.rb +4 -3
- data/lib/wakame/actions/notify_child_changed.rb +3 -6
- data/lib/wakame/actions/notify_parent_changed.rb +4 -7
- data/lib/wakame/actions/propagate_resource.rb +1 -3
- data/lib/wakame/actions/propagate_service.rb +1 -3
- data/lib/wakame/actions/register_agent.rb +43 -0
- data/lib/wakame/actions/reload_service.rb +2 -2
- data/lib/wakame/actions/shutdown_cluster.rb +4 -6
- data/lib/wakame/actions/shutdown_vm.rb +27 -6
- data/lib/wakame/actions/start_service.rb +40 -32
- data/lib/wakame/actions/stop_service.rb +8 -10
- data/lib/wakame/actions/unfreeze_cluster.rb +15 -0
- data/lib/wakame/actor.rb +2 -5
- data/lib/wakame/actor/deploy.rb +110 -0
- data/lib/wakame/actor/monitor.rb +14 -0
- data/lib/wakame/actor/s3fs.rb +45 -0
- data/lib/wakame/actor/service_monitor.rb +0 -17
- data/lib/wakame/actor/system.rb +5 -1
- data/lib/wakame/agent.rb +29 -179
- data/lib/wakame/agent_manager.rb +11 -0
- data/lib/wakame/agent_managers/actor_manager.rb +101 -0
- data/lib/wakame/agent_managers/monitor_manager.rb +48 -0
- data/lib/wakame/command.rb +4 -7
- data/lib/wakame/command/actor.rb +9 -12
- data/lib/wakame/command/agent_status.rb +2 -2
- data/lib/wakame/command/control_service.rb +66 -0
- data/lib/wakame/command/deploy_application.rb +18 -0
- data/lib/wakame/command/deploy_config.rb +16 -0
- data/lib/wakame/command/launch_cluster.rb +1 -1
- data/lib/wakame/command/launch_vm.rb +1 -1
- data/lib/wakame/command/propagate_resource.rb +1 -1
- data/lib/wakame/command/propagate_service.rb +5 -3
- data/lib/wakame/command/reload_service.rb +1 -1
- data/lib/wakame/command/shutdown_cluster.rb +1 -1
- data/lib/wakame/command/shutdown_vm.rb +37 -11
- data/lib/wakame/command/start_service.rb +1 -1
- data/lib/wakame/command/status.rb +6 -4
- data/lib/wakame/command/stop_service.rb +1 -1
- data/lib/wakame/configuration.rb +5 -0
- data/lib/wakame/event.rb +85 -33
- data/lib/wakame/event_dispatcher.rb +2 -2
- data/lib/wakame/initializer.rb +97 -31
- data/lib/wakame/master.rb +23 -346
- data/lib/wakame/master_manager.rb +11 -0
- data/lib/wakame/master_managers/action_manager.rb +321 -0
- data/lib/wakame/master_managers/agent_monitor.rb +166 -0
- data/lib/wakame/master_managers/cluster_manager.rb +176 -0
- data/lib/wakame/master_managers/command_queue.rb +133 -0
- data/lib/wakame/models/agent_pool.rb +113 -0
- data/lib/wakame/models/application_repository.rb +34 -0
- data/lib/wakame/models/object_store.rb +32 -0
- data/lib/wakame/models/service_cluster_pool.rb +36 -0
- data/lib/wakame/monitor.rb +3 -6
- data/lib/wakame/monitor/agent.rb +9 -6
- data/lib/wakame/monitor/service.rb +56 -29
- data/lib/wakame/runner/administrator_command.rb +210 -24
- data/lib/wakame/runner/agent.rb +2 -0
- data/lib/wakame/runner/master.rb +2 -1
- data/lib/wakame/service.rb +140 -130
- data/lib/wakame/status_db.rb +101 -121
- data/lib/wakame/util.rb +26 -15
- data/tests/setup_master.rb +1 -0
- data/tests/test_master.rb +0 -2
- data/tests/test_model_agent_pool.rb +21 -0
- data/tests/test_service.rb +14 -8
- data/tests/test_status_db.rb +2 -0
- data/tests/test_util.rb +12 -1
- data/wakame_generators/resource/templates/apache_app/apache_app.rb +20 -11
- data/wakame_generators/resource/templates/apache_app/conf/vh/aaa.test.conf +1 -1
- data/wakame_generators/resource/templates/apache_lb/apache_lb.rb +7 -7
- data/wakame_generators/resource/templates/apache_lb/conf/system-lb.conf +6 -4
- data/wakame_generators/resource/templates/apache_www/apache_www.rb +15 -13
- data/wakame_generators/resource/templates/ec2_elastic_ip/ec2_elastic_ip.rb +17 -17
- data/wakame_generators/resource/templates/ec2_elb/ec2_elb.rb +22 -15
- data/wakame_generators/resource/templates/mongodb/conf/mongodb.conf +95 -0
- data/wakame_generators/resource/templates/mongodb/init.d/mongodb +244 -0
- data/wakame_generators/resource/templates/mongodb/mongodb.rb +64 -0
- data/wakame_generators/resource/templates/mysql_master/mysql_master.rb +17 -21
- data/wakame_generators/resource/templates/nginx/conf/nginx.conf +4 -0
- data/wakame_generators/resource/templates/nginx/conf/vh/ec2_elb_common.conf +19 -0
- data/wakame_generators/resource/templates/nginx/init.d/nginx +6 -0
- data/wakame_generators/resource/templates/nginx/init.d/spawn-fcgi +46 -0
- data/wakame_generators/resource/templates/nginx/nginx.rb +15 -10
- data/wakame_generators/resource/templates/nginx_passenger/conf/nginx-passenger.conf +39 -0
- data/wakame_generators/resource/templates/nginx_passenger/conf/vh/ec2_elb_common.conf +10 -0
- data/wakame_generators/resource/templates/nginx_passenger/init.d/nginx-passenger +70 -0
- data/wakame_generators/resource/templates/nginx_passenger/nginx_passenger.rb +71 -0
- data/wakame_generators/resource/templates/s3fs/s3fs.rb +24 -0
- metadata +195 -74
- data/lib/wakame/action_manager.rb +0 -303
- data/lib/wakame/command/clone_service.rb +0 -12
- data/lib/wakame/command_queue.rb +0 -135
- data/lib/wakame/vm_manipulator.rb +0 -187
data/tests/test_service.rb
CHANGED
@@ -144,21 +144,27 @@ class TestService < Test::Unit::TestCase
|
|
144
144
|
|
145
145
|
|
146
146
|
def test_vmspec
|
147
|
+
spec = VmSpec.define {
|
148
|
+
environment(:EC2) { |ec2|
|
149
|
+
ec2.instance_type = 'm1.small'
|
150
|
+
ec2.availability_zone = 'us-east-c1'
|
151
|
+
ec2.security_groups << 'default'
|
152
|
+
}
|
153
|
+
|
154
|
+
environment(:StandAlone) {
|
155
|
+
}
|
156
|
+
}
|
147
157
|
|
148
|
-
Wakame.config.vm_environment = :EC2
|
149
|
-
assert_equal(VmSpec::EC2, VmSpec.current.class)
|
150
158
|
|
159
|
+
Wakame.config.vm_environment = :EC2
|
160
|
+
p spec.current.attrs
|
151
161
|
Wakame.config.vm_environment = :StandAlone
|
152
|
-
|
162
|
+
p spec.current.attrs
|
153
163
|
|
154
164
|
assert_raise(RuntimeError) {
|
155
165
|
Wakame.config.vm_environment = :EC3
|
156
|
-
|
166
|
+
spec.current.attrs
|
157
167
|
}
|
158
|
-
|
159
|
-
Wakame.config.vm_environment = :EC2
|
160
|
-
spec = VmSpec.current
|
161
|
-
spec
|
162
168
|
end
|
163
169
|
|
164
170
|
|
data/tests/test_status_db.rb
CHANGED
data/tests/test_util.rb
CHANGED
@@ -12,7 +12,7 @@ class TestUtilClass < Test::Unit::TestCase
|
|
12
12
|
include AttributeHelper
|
13
13
|
|
14
14
|
def_attribute :a, 1
|
15
|
-
def_attribute :b, 2
|
15
|
+
def_attribute :b, {:default=>2, :persistent=>true}
|
16
16
|
def_attribute :c, []
|
17
17
|
attr :m
|
18
18
|
attr_accessor :n, :o
|
@@ -26,6 +26,11 @@ class TestUtilClass < Test::Unit::TestCase
|
|
26
26
|
def_attribute :f
|
27
27
|
end
|
28
28
|
|
29
|
+
class C < B
|
30
|
+
update_attribute :b, {:a=>1, :b=>1}
|
31
|
+
update_attribute :d, {:a=>1, :b=>1}
|
32
|
+
end
|
33
|
+
|
29
34
|
def test_attribute_helper1
|
30
35
|
a = A.new
|
31
36
|
assert_equal(1, a.a)
|
@@ -45,6 +50,12 @@ class TestUtilClass < Test::Unit::TestCase
|
|
45
50
|
end
|
46
51
|
|
47
52
|
|
53
|
+
def test_attribute_helper2
|
54
|
+
c = C.new
|
55
|
+
assert_equal({:default=>{:a=>1, :b=>1}, :persistent=>true}, C.get_attr_attribute(:b))
|
56
|
+
assert_equal({:default=>{:a=>1, :b=>1}}, C.get_attr_attribute(:d))
|
57
|
+
end
|
58
|
+
|
48
59
|
|
49
60
|
H={23=>1, 38=>3, 2837=>1, 3727=>4, 937=>1, 184=>5, 328=>2, 8939=>1}
|
50
61
|
def test_sorted_hash1
|
@@ -2,8 +2,12 @@ class Apache_APP < Wakame::Service::Resource
|
|
2
2
|
include HttpServer
|
3
3
|
include HttpApplicationServer
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
update_attribute :listen_port, 8001
|
6
|
+
update_attribute :monitors, {'/service' => {
|
7
|
+
:type => :pidfile,
|
8
|
+
:path => '/var/run/apache2-app.pid'
|
9
|
+
}
|
10
|
+
}
|
7
11
|
|
8
12
|
def render_config(template)
|
9
13
|
template.glob_basedir(%w(conf/envvars-app init.d/apache2-app)) { |d|
|
@@ -15,6 +19,13 @@ class Apache_APP < Wakame::Service::Resource
|
|
15
19
|
template.chmod("init.d/apache2-app", 0755)
|
16
20
|
end
|
17
21
|
|
22
|
+
def on_reload_application(svc, action, repo_data)
|
23
|
+
action.actor_request(svc.cloud_host.agent_id, '/system/touch',
|
24
|
+
File.join(application_root_path, repo_data[:app_name], 'current', 'tmp', 'restart.txt')
|
25
|
+
).request.wait
|
26
|
+
end
|
27
|
+
|
28
|
+
|
18
29
|
|
19
30
|
def start(svc, action)
|
20
31
|
cond = ConditionalWait.new { |cond|
|
@@ -23,13 +34,12 @@ class Apache_APP < Wakame::Service::Resource
|
|
23
34
|
}
|
24
35
|
}
|
25
36
|
|
26
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
27
|
-
'/service_monitor/register', svc.id, :pidfile, '/var/run/apache2-app.pid').request
|
28
37
|
action.actor_request(svc.cloud_host.agent_id,
|
29
38
|
'/daemon/start', "apache_app", 'init.d/apache2-app'){ |req|
|
30
39
|
req.wait
|
31
40
|
Wakame.log.debug("#{self.class} process started")
|
32
41
|
}
|
42
|
+
|
33
43
|
cond.wait
|
34
44
|
end
|
35
45
|
|
@@ -40,22 +50,21 @@ class Apache_APP < Wakame::Service::Resource
|
|
40
50
|
event.instance_id == svc.id
|
41
51
|
}
|
42
52
|
}
|
43
|
-
|
53
|
+
|
44
54
|
request = action.actor_request(svc.cloud_host.agent_id,
|
45
55
|
'/daemon/stop', 'apache_app', 'init.d/apache2-app'){ |req|
|
46
56
|
req.wait
|
47
57
|
Wakame.log.debug("#{self.class} process stopped")
|
48
58
|
}
|
49
59
|
cond.wait
|
50
|
-
|
51
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
52
|
-
'/service_monitor/unregister', svc.id ).request
|
53
60
|
end
|
54
61
|
|
55
62
|
def reload(svc, action)
|
56
|
-
|
57
|
-
|
58
|
-
|
63
|
+
action.actor_request(svc.cloud_host.agent_id,
|
64
|
+
'/daemon/reload', "apache_app", 'init.d/apache2-app'){ |req|
|
65
|
+
req.wait
|
66
|
+
Wakame.log.debug("#{self.class} process reloaded")
|
67
|
+
}
|
59
68
|
end
|
60
69
|
|
61
70
|
end
|
@@ -1,8 +1,13 @@
|
|
1
1
|
class Apache_LB < Wakame::Service::Resource
|
2
2
|
include HttpServer
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
update_attribute :listen_port, 80
|
5
|
+
update_attribute :listen_port_https, 443
|
6
|
+
update_attribute :monitors, {'/service' => {
|
7
|
+
:type => :pidfile,
|
8
|
+
:path => '/var/run/apache2-lb.pid'
|
9
|
+
}
|
10
|
+
}
|
6
11
|
|
7
12
|
def render_config(template)
|
8
13
|
template.glob_basedir(%w(conf/envvars-lb init.d/apache2-lb)) { |d|
|
@@ -27,8 +32,6 @@ class Apache_LB < Wakame::Service::Resource
|
|
27
32
|
}
|
28
33
|
}
|
29
34
|
|
30
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
31
|
-
'/service_monitor/register', svc.id, :pidfile, '/var/run/apache2-lb.pid').request
|
32
35
|
action.actor_request(svc.cloud_host.agent_id,
|
33
36
|
'/daemon/start', "apache_lb", 'init.d/apache2-lb'){ |req|
|
34
37
|
req.wait
|
@@ -52,9 +55,6 @@ class Apache_LB < Wakame::Service::Resource
|
|
52
55
|
}
|
53
56
|
|
54
57
|
cond.wait
|
55
|
-
|
56
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
57
|
-
'/service_monitor/unregister', svc.id ).request
|
58
58
|
end
|
59
59
|
|
60
60
|
def reload(svc, action)
|
@@ -75,15 +75,17 @@ Listen <%= resource.listen_port %>
|
|
75
75
|
#</IfModule>
|
76
76
|
|
77
77
|
<Proxy balancer://cluster-www>
|
78
|
-
<%-
|
79
|
-
next if n.status
|
78
|
+
<%- cluster.each_instance(HttpAssetServer) { |n|
|
79
|
+
#next if n.status == STATUS_RELOADING || !n.cloud_host.mapped?
|
80
|
+
next unless n.monitor_status == STATUS_ONLINE
|
80
81
|
-%>
|
81
82
|
BalancerMember http://<%= n.cloud_host.agent_ip %>:<%= n.resource.listen_port %> loadfactor=10
|
82
83
|
<%- } -%>
|
83
84
|
</Proxy>
|
84
85
|
<Proxy balancer://cluster-app>
|
85
|
-
<%-
|
86
|
-
next if n.status
|
86
|
+
<%- cluster.each_instance(HttpApplicationServer) { |n|
|
87
|
+
#next if n.status == STATUS_RELOADING || !n.cloud_host.mapped?
|
88
|
+
next unless n.monitor_status == STATUS_ONLINE
|
87
89
|
-%>
|
88
90
|
BalancerMember http://<%= n.cloud_host.agent_ip %>:<%= n.resource.listen_port %> loadfactor=10
|
89
91
|
<%- } -%>
|
@@ -2,7 +2,12 @@ class Apache_WWW < Wakame::Service::Resource
|
|
2
2
|
include HttpServer
|
3
3
|
include HttpAssetServer
|
4
4
|
|
5
|
-
|
5
|
+
update_attribute :listen_port, 8000
|
6
|
+
update_attribute :monitors, {'/service' => {
|
7
|
+
:type => :pidfile,
|
8
|
+
:path => '/var/run/apache2-www.pid'
|
9
|
+
}
|
10
|
+
}
|
6
11
|
|
7
12
|
def render_config(template)
|
8
13
|
template.glob_basedir(%w(conf/envvars-www init.d/apache2-www)) { |d|
|
@@ -21,10 +26,8 @@ class Apache_WWW < Wakame::Service::Resource
|
|
21
26
|
}
|
22
27
|
}
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
27
|
-
'/daemon/start', "apache_www", 'init.d/apache2-www'){ |req|
|
29
|
+
action.actor_request(svc.cloud_host.agent_id,
|
30
|
+
'/daemon/start', "apache_www", 'init.d/apache2-www'){ |req|
|
28
31
|
req.wait
|
29
32
|
Wakame.log.debug("#{self.class} process started")
|
30
33
|
}
|
@@ -38,21 +41,20 @@ class Apache_WWW < Wakame::Service::Resource
|
|
38
41
|
}
|
39
42
|
}
|
40
43
|
|
41
|
-
|
42
|
-
|
44
|
+
action.actor_request(svc.cloud_host.agent_id,
|
45
|
+
'/daemon/stop', 'apache_www', 'init.d/apache2-www'){ |req|
|
43
46
|
req.wait
|
44
47
|
Wakame.log.debug("#{self.class} process stooped")
|
45
48
|
}
|
46
49
|
cond.wait
|
47
|
-
|
48
|
-
request = action.actor_request(svc.cloud_host.agent_id,
|
49
|
-
'/service_monitor/unregister', svc.id ).request
|
50
50
|
end
|
51
51
|
|
52
52
|
def reload(svc, action)
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
action.actor_request(svc.cloud_host.agent_id,
|
54
|
+
'/daemon/reload', 'apache_www', 'init.d/apache2-www'){ |req|
|
55
|
+
req.wait
|
56
|
+
Wakame.log.debug("#{self.class} process reloaded")
|
57
|
+
}
|
56
58
|
end
|
57
59
|
|
58
60
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class Ec2ElasticIp < Wakame::Service::Resource
|
2
2
|
|
3
3
|
property :elastic_ip
|
4
|
-
property :
|
4
|
+
property :disassociate_ip, {:default=>true}
|
5
|
+
update_attribute :require_agent, false
|
5
6
|
|
6
7
|
def on_parent_changed(svc, action)
|
7
8
|
start(svc, action)
|
@@ -13,25 +14,24 @@ class Ec2ElasticIp < Wakame::Service::Resource
|
|
13
14
|
|
14
15
|
a = svc.parent_instances.first
|
15
16
|
|
16
|
-
Wakame.log.info("Associating the Elastic IP #{self.elastic_ip} to #{a.cloud_host.agent.vm_attr[:
|
17
|
-
ec2.associate_address(a.cloud_host.agent.vm_attr[:
|
18
|
-
|
19
|
-
|
20
|
-
}
|
17
|
+
Wakame.log.info("Associating the Elastic IP #{self.elastic_ip} to #{a.cloud_host.agent.vm_attr[:aws_instance_id]}")
|
18
|
+
ec2.associate_address(a.cloud_host.agent.vm_attr[:aws_instance_id], self.elastic_ip)
|
19
|
+
|
20
|
+
svc.update_monitor_status(Wakame::Service::STATUS_ONLINE)
|
21
21
|
end
|
22
22
|
|
23
23
|
def stop(svc, action)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
24
|
+
if self.disassociate_ip
|
25
|
+
require 'right_aws'
|
26
|
+
ec2 = RightAws::Ec2.new(Wakame.config.aws_access_key, Wakame.config.aws_secret_key)
|
27
|
+
|
28
|
+
a = svc.parent_instances.first
|
29
|
+
|
30
|
+
Wakame.log.info("Disassociating the Elastic IP #{self.elastic_ip} from #{a.cloud_host.agent.vm_attr[:aws_instance_id]}")
|
31
|
+
ec2.disassociate_address(self.elastic_ip)
|
32
|
+
end
|
33
|
+
|
34
|
+
svc.update_monitor_status(Wakame::Service::STATUS_OFFLINE)
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Ec2ELB < Wakame::Service::Resource
|
2
2
|
|
3
3
|
property :elb_name
|
4
|
-
property :require_agent, false
|
5
4
|
property :just_unregister_when_stop, false
|
5
|
+
update_attribute :require_agent, false
|
6
6
|
|
7
7
|
def on_parent_changed(svc, action)
|
8
8
|
start(svc, action)
|
@@ -13,8 +13,8 @@ class Ec2ELB < Wakame::Service::Resource
|
|
13
13
|
|
14
14
|
parents = svc.parent_instances.dup
|
15
15
|
|
16
|
-
vm_slice_ids = parents.collect{|a| a.cloud_host.agent.vm_attr[:
|
17
|
-
av_zones = parents.collect{|a| a.cloud_host.agent.vm_attr[:
|
16
|
+
vm_slice_ids = parents.collect{|a| a.cloud_host.agent.vm_attr[:aws_instance_id] if a.cloud_host.mapped? }.uniq.compact
|
17
|
+
av_zones = parents.collect{|a| a.cloud_host.agent.vm_attr[:aws_availability_zone] if a.cloud_host.mapped? }.uniq.compact
|
18
18
|
Wakame.log.info("Setting up the ELB #{self.elb_name} with #{vm_slice_ids.join(', ')}")
|
19
19
|
begin
|
20
20
|
res = elb.describe_load_balancers(self.elb_name)
|
@@ -32,15 +32,25 @@ class Ec2ELB < Wakame::Service::Resource
|
|
32
32
|
res = elb.describe_load_balancers(self.elb_name)
|
33
33
|
elbdesc = res[0]
|
34
34
|
end
|
35
|
+
Wakame.log.info("Registerd the ELB #{self.elb_name} as #{elbdesc[:dns_name]}")
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
elb.enable_availability_zones_for_load_balancer(elb_name, av_zones)
|
38
|
+
|
39
|
+
elbdesc[:stripped_instances] = elbdesc[:instances].map { |i| i.strip }
|
40
|
+
needless_ids = elbdesc[:stripped_instances] - vm_slice_ids
|
41
|
+
|
42
|
+
unless needless_ids.empty?
|
43
|
+
elb.deregister_instances_with_load_balancer(elb_name, needless_ids)
|
39
44
|
end
|
45
|
+
elb.register_instances_with_load_balancer(elb_name, vm_slice_ids)
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
current_av_zones = elbdesc[:availability_zones].map { |av_zone| av_zone }
|
48
|
+
needless_av_zones = current_av_zones - av_zones
|
49
|
+
unless needless_av_zones.empty?
|
50
|
+
elb.disable_availability_zones_for_load_balancer(elb_name, needless_av_zones)
|
51
|
+
end
|
52
|
+
|
53
|
+
svc.update_monitor_status(Wakame::Service::STATUS_ONLINE)
|
44
54
|
end
|
45
55
|
|
46
56
|
def stop(svc, action)
|
@@ -48,10 +58,10 @@ class Ec2ELB < Wakame::Service::Resource
|
|
48
58
|
|
49
59
|
if self.just_unregister_when_stop
|
50
60
|
parents = svc.parent_instances.dup
|
51
|
-
vm_slice_ids = parents.collect{|a| a.cloud_host.agent.vm_attr[:
|
61
|
+
vm_slice_ids = parents.collect{|a| a.cloud_host.agent.vm_attr[:aws_instance_id] if a.cloud_host.mapped? }.uniq.compact
|
52
62
|
Wakame.log.info("Deregistering the VM instances (#{vm_slice_ids.join(', ')}) from ELB #{self.elb_name}")
|
53
63
|
|
54
|
-
elb.deregister_instances_with_load_balancer(self.elb_name, *
|
64
|
+
elb.deregister_instances_with_load_balancer(self.elb_name, *vm_slice_ids)
|
55
65
|
else
|
56
66
|
Wakame.log.info("Destroying the ELB #{self.elb_name}.")
|
57
67
|
# Ignore errors in case of any issues.
|
@@ -62,10 +72,7 @@ class Ec2ELB < Wakame::Service::Resource
|
|
62
72
|
end
|
63
73
|
end
|
64
74
|
|
65
|
-
|
66
|
-
svc.update_status(Wakame::Service::STATUS_OFFLINE)
|
67
|
-
}
|
68
|
-
|
75
|
+
svc.update_monitor_status(Wakame::Service::STATUS_OFFLINE)
|
69
76
|
end
|
70
77
|
|
71
78
|
private
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# mongodb.conf
|
2
|
+
|
3
|
+
# Where to store the data.
|
4
|
+
|
5
|
+
# Note: if you run mongodb as a non-root user (recommended) you may
|
6
|
+
# need to create and set permissions for this directory manually,
|
7
|
+
# e.g., if the parent directory isn't mutable by the mongodb user.
|
8
|
+
#dbpath=<%= resource.dbpath %>
|
9
|
+
|
10
|
+
#where to log
|
11
|
+
#logpath=<%= resource.logpath %>
|
12
|
+
|
13
|
+
logappend=true
|
14
|
+
|
15
|
+
port=<%= resource.port %>
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
# Enables periodic logging of CPU utilization and I/O wait
|
20
|
+
#cpu = true
|
21
|
+
|
22
|
+
# Turn on/off security. Off is currently the default
|
23
|
+
#noauth = true
|
24
|
+
#auth = true
|
25
|
+
|
26
|
+
# Verbose logging output.
|
27
|
+
#verbose = true
|
28
|
+
|
29
|
+
# Inspect all client data for validity on receipt (useful for
|
30
|
+
# developing drivers)
|
31
|
+
#objcheck = true
|
32
|
+
|
33
|
+
# Enable db quota management
|
34
|
+
#quota = true
|
35
|
+
|
36
|
+
# Set oplogging level where n is
|
37
|
+
# 0=off (default)
|
38
|
+
# 1=W
|
39
|
+
# 2=R
|
40
|
+
# 3=both
|
41
|
+
# 7=W+some reads
|
42
|
+
#oplog = 0
|
43
|
+
|
44
|
+
# Diagnostic/debugging option
|
45
|
+
#nocursors = true
|
46
|
+
|
47
|
+
# Ignore query hints
|
48
|
+
#nohints = true
|
49
|
+
|
50
|
+
# Disable the HTTP interface (Defaults to localhost:27018).
|
51
|
+
#nohttpinterface = true
|
52
|
+
|
53
|
+
# Turns off server-side scripting. This will result in greatly limited
|
54
|
+
# functionality
|
55
|
+
#noscripting = true
|
56
|
+
|
57
|
+
# Turns off table scans. Any query that would do a table scan fails.
|
58
|
+
#notablescan = true
|
59
|
+
|
60
|
+
# Disable data file preallocation.
|
61
|
+
#noprealloc = true
|
62
|
+
|
63
|
+
# Specify .ns file size for new databases.
|
64
|
+
# nssize = <size>
|
65
|
+
|
66
|
+
# Accout token for Mongo monitoring server.
|
67
|
+
#mms-token = <token>
|
68
|
+
|
69
|
+
# Server name for Mongo monitoring server.
|
70
|
+
#mms-name = <server-name>
|
71
|
+
|
72
|
+
# Ping interval for Mongo monitoring server.
|
73
|
+
#mms-interval = <seconds>
|
74
|
+
|
75
|
+
# Replication Options
|
76
|
+
|
77
|
+
# in replicated mongo databases, specify here whether this is a slave or master
|
78
|
+
#slave = true
|
79
|
+
#source = master.example.com
|
80
|
+
# Slave only: specify a single database to replicate
|
81
|
+
#only = master.example.com
|
82
|
+
# or
|
83
|
+
#master = true
|
84
|
+
#source = slave.example.com
|
85
|
+
|
86
|
+
# Address of a server to pair with.
|
87
|
+
#pairwith = <server:port>
|
88
|
+
# Address of arbiter server.
|
89
|
+
#arbiter = <server:port>
|
90
|
+
# Automatically resync if slave data is stale
|
91
|
+
#autoresync
|
92
|
+
# Custom size for replication operation log.
|
93
|
+
#oplogSize = <MB>
|
94
|
+
# Size limit for in-memory storage of op ids.
|
95
|
+
#opIdMem = <bytes>
|