luban 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/luban/deployment/cli/command.rb +1 -2
- data/lib/luban/deployment/cli/service/controller.rb +38 -35
- data/lib/luban/deployment/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1386501b0b0e2a9483089453c5c009650655097
|
4
|
+
data.tar.gz: fa8b1ffbe8e0e553d5b9e0f8f4ddae622b334b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee4acb1e7cd29517bbedef6c53db64e1d8ec84712427779287974178b53658dd96df0fb3e600fef79c29f78d42d4c1ae2e64a17f522c648e1f04b15be2f59f9
|
7
|
+
data.tar.gz: 169b0790ec7a43078499ae14d1e73c153625a0d6b31cebedd950456baa54836599b8607a81295287f1a723d950a2b53a9d9fcaf3dd10477ab399f0e252850e14
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Version 0.8.3 (Sept 21, 2016)
|
4
|
+
|
5
|
+
Minor enhancements:
|
6
|
+
* Simplified process_monitor settings
|
7
|
+
* Checked if process is monitorable before any monitoring related operations
|
8
|
+
* thru convenient method #process_monitorable?
|
9
|
+
* Added control file for process monitor
|
10
|
+
* Used #include instead of #prepend when loading monitoring public commands
|
11
|
+
|
3
12
|
## Version 0.8.2 (Sept 20, 2016)
|
4
13
|
|
5
14
|
Minor enhancements:
|
@@ -104,8 +104,7 @@ module Luban
|
|
104
104
|
def process_monitor_via(monitor, env: "uber/lubmon")
|
105
105
|
monitor = monitor.to_s.downcase
|
106
106
|
env = "#{stage}.#{env.to_s.downcase}"
|
107
|
-
process_monitor name: monitor, env: env
|
108
|
-
service_entry: "#{env.gsub('/', '.')}.#{monitor}"
|
107
|
+
process_monitor name: monitor, env: env
|
109
108
|
end
|
110
109
|
|
111
110
|
protected
|
@@ -33,12 +33,26 @@ module Luban
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def process_monitorable?
|
37
|
+
process_monitor_defined? and !process_monitor?
|
38
|
+
end
|
39
|
+
|
40
|
+
def process_monitor_defined?
|
41
|
+
!process_monitor[:name].nil?
|
42
|
+
end
|
43
|
+
|
36
44
|
def process_monitor?
|
37
|
-
|
45
|
+
env_name == process_monitor[:env]
|
38
46
|
end
|
39
47
|
|
40
48
|
def monitor_executable
|
41
|
-
@monitor_executable ||= env_path.join(process_monitor[:env], 'bin',
|
49
|
+
@monitor_executable ||= env_path.join(process_monitor[:env], 'bin',
|
50
|
+
process_monitor[:name])
|
51
|
+
end
|
52
|
+
|
53
|
+
def monitor_control_file_path
|
54
|
+
@monitor_control_file_path ||= env_path.join(process_monitor[:env], 'shared', 'profile',
|
55
|
+
process_monitor[:name], monitor_control_file_name)
|
42
56
|
end
|
43
57
|
|
44
58
|
def start_process
|
@@ -50,7 +64,10 @@ module Luban
|
|
50
64
|
output = start_process!
|
51
65
|
if check_until { process_started? }
|
52
66
|
update_result "Start #{service_full_name}: [OK] #{output}"
|
53
|
-
|
67
|
+
if process_monitorable?
|
68
|
+
reload_monitor_process
|
69
|
+
monitor_process
|
70
|
+
end
|
54
71
|
else
|
55
72
|
remove_orphaned_pid_file
|
56
73
|
update_result "Start #{service_full_name}: [FAILED] #{output}",
|
@@ -64,7 +81,7 @@ module Luban
|
|
64
81
|
return
|
65
82
|
end
|
66
83
|
|
67
|
-
unmonitor_process
|
84
|
+
unmonitor_process if process_monitorable?
|
68
85
|
output = stop_process! || 'OK'
|
69
86
|
if check_until { process_stopped? }
|
70
87
|
update_result "Stop #{service_full_name}: [OK] #{output}"
|
@@ -77,7 +94,7 @@ module Luban
|
|
77
94
|
|
78
95
|
def restart_process
|
79
96
|
if process_started?
|
80
|
-
unmonitor_process
|
97
|
+
unmonitor_process if process_monitorable?
|
81
98
|
output = stop_process!
|
82
99
|
if check_until { process_stopped? }
|
83
100
|
remove_orphaned_pid_file
|
@@ -93,7 +110,7 @@ module Luban
|
|
93
110
|
output = start_process!
|
94
111
|
if check_until { process_started? }
|
95
112
|
update_result "Restart #{service_full_name}: [OK] #{output}"
|
96
|
-
monitor_process
|
113
|
+
monitor_process if process_monitorable?
|
97
114
|
else
|
98
115
|
remove_orphaned_pid_file
|
99
116
|
update_result "Restart #{service_full_name}: [FAILED] #{output}",
|
@@ -115,7 +132,7 @@ module Luban
|
|
115
132
|
return
|
116
133
|
end
|
117
134
|
|
118
|
-
unmonitor_process
|
135
|
+
unmonitor_process if process_monitorable?
|
119
136
|
output = kill_process!
|
120
137
|
if check_until { process_stopped? }
|
121
138
|
update_result "Kill #{service_full_name}: [OK] #{output}"
|
@@ -125,37 +142,27 @@ module Luban
|
|
125
142
|
remove_orphaned_pid_file
|
126
143
|
end
|
127
144
|
|
128
|
-
def process_monitor_defined?
|
129
|
-
!process_monitor[:name].nil?
|
130
|
-
end
|
131
|
-
|
132
145
|
def monitor_process
|
133
|
-
if
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
info "Failed to turn on process monitor for #{service_entry}"
|
138
|
-
end
|
146
|
+
if monitor_process!
|
147
|
+
info "Turned on process monitor for #{service_entry}"
|
148
|
+
else
|
149
|
+
info "Failed to turn on process monitor for #{service_entry}"
|
139
150
|
end
|
140
151
|
end
|
141
152
|
|
142
153
|
def unmonitor_process
|
143
|
-
if
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
info "Failed to turn off process monitor for #{service_entry}"
|
148
|
-
end
|
154
|
+
if unmonitor_process!
|
155
|
+
info "Turned off process monitor for #{service_entry}"
|
156
|
+
else
|
157
|
+
info "Failed to turn off process monitor for #{service_entry}"
|
149
158
|
end
|
150
159
|
end
|
151
160
|
|
152
161
|
def reload_monitor_process
|
153
|
-
if
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
info "Failed to reload process monitor for #{service_entry}"
|
158
|
-
end
|
162
|
+
if reload_monitor_process!
|
163
|
+
info "Reloaded process monitor for #{service_entry}"
|
164
|
+
else
|
165
|
+
info "Failed to reload process monitor for #{service_entry}"
|
159
166
|
end
|
160
167
|
end
|
161
168
|
|
@@ -164,16 +171,12 @@ module Luban
|
|
164
171
|
|
165
172
|
protected
|
166
173
|
|
167
|
-
def before_start_process
|
168
|
-
reload_monitor_process unless process_monitor?
|
169
|
-
end
|
170
|
-
|
171
174
|
def init
|
172
|
-
load_process_monitor_commands
|
175
|
+
load_process_monitor_commands if process_monitorable?
|
173
176
|
end
|
174
177
|
|
175
178
|
def load_process_monitor_commands
|
176
|
-
singleton_class.send(:
|
179
|
+
singleton_class.send(:include,
|
177
180
|
process_monitor_module.const_get("Controller::Commands::Public"))
|
178
181
|
end
|
179
182
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Lei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban-cli
|