luban 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ffbf682bcf4d234a72678f0cb42de7486a30c22
|
4
|
+
data.tar.gz: ff76e0eb5c9d74a9a0dec9f459d9befaeee0ea8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d647cb328fe109f246babb23010fd1c464f652209090d5493bf07778bcfaaa74efd548ef3644147e2776198cae0b9f7c20fa1effc9fda11845ae9d3e4966306
|
7
|
+
data.tar.gz: 57de317541a53583c89e172db9b3a12e01f6e69f882319a067fb278e527e043bf305bfa76d39ea9465713dd8cf80899f64c262d0e1448fc33f7af349cc6ec4ae
|
data/CHANGELOG.md
CHANGED
@@ -103,8 +103,9 @@ module Luban
|
|
103
103
|
|
104
104
|
def process_monitor_via(monitor, env: "uber/lubmon")
|
105
105
|
monitor = monitor.to_s.downcase
|
106
|
-
env = env.to_s.downcase
|
107
|
-
process_monitor name: monitor, env: env
|
106
|
+
env = "#{stage}.#{env.to_s.downcase}"
|
107
|
+
process_monitor name: monitor, env: env,
|
108
|
+
service_entry: "#{env.gsub('/', '.')}.#{monitor}"
|
108
109
|
end
|
109
110
|
|
110
111
|
protected
|
@@ -33,20 +33,12 @@ module Luban
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
def monitor_command
|
41
|
-
@monitor_command ||= shell_command("#{monitor_executable} monitor #{service_entry}")
|
36
|
+
def process_monitor?
|
37
|
+
service_entry == process_monitor[:service_entry]
|
42
38
|
end
|
43
39
|
|
44
|
-
def
|
45
|
-
@
|
46
|
-
end
|
47
|
-
|
48
|
-
def reload_monitor_command
|
49
|
-
@reload_monitor_command ||= shell_command("#{monitor_executable} reload")
|
40
|
+
def monitor_executable
|
41
|
+
@monitor_executable ||= env_path.join(process_monitor[:env], 'bin', process_monitor[:name])
|
50
42
|
end
|
51
43
|
|
52
44
|
def start_process
|
@@ -58,7 +50,7 @@ module Luban
|
|
58
50
|
output = start_process!
|
59
51
|
if check_until { process_started? }
|
60
52
|
update_result "Start #{service_full_name}: [OK] #{output}"
|
61
|
-
monitor_process
|
53
|
+
monitor_process unless process_monitor?
|
62
54
|
else
|
63
55
|
remove_orphaned_pid_file
|
64
56
|
update_result "Start #{service_full_name}: [FAILED] #{output}",
|
@@ -72,7 +64,7 @@ module Luban
|
|
72
64
|
return
|
73
65
|
end
|
74
66
|
|
75
|
-
unmonitor_process
|
67
|
+
unmonitor_process unless process_monitor?
|
76
68
|
output = stop_process! || 'OK'
|
77
69
|
if check_until { process_stopped? }
|
78
70
|
update_result "Stop #{service_full_name}: [OK] #{output}"
|
@@ -85,7 +77,7 @@ module Luban
|
|
85
77
|
|
86
78
|
def restart_process
|
87
79
|
if process_started?
|
88
|
-
unmonitor_process
|
80
|
+
unmonitor_process unless process_monitor?
|
89
81
|
output = stop_process!
|
90
82
|
if check_until { process_stopped? }
|
91
83
|
remove_orphaned_pid_file
|
@@ -101,7 +93,7 @@ module Luban
|
|
101
93
|
output = start_process!
|
102
94
|
if check_until { process_started? }
|
103
95
|
update_result "Restart #{service_full_name}: [OK] #{output}"
|
104
|
-
monitor_process
|
96
|
+
monitor_process unless process_monitor?
|
105
97
|
else
|
106
98
|
remove_orphaned_pid_file
|
107
99
|
update_result "Restart #{service_full_name}: [FAILED] #{output}",
|
@@ -123,7 +115,7 @@ module Luban
|
|
123
115
|
return
|
124
116
|
end
|
125
117
|
|
126
|
-
unmonitor_process
|
118
|
+
unmonitor_process unless process_monitor?
|
127
119
|
output = kill_process!
|
128
120
|
if check_until { process_stopped? }
|
129
121
|
update_result "Kill #{service_full_name}: [OK] #{output}"
|
@@ -173,7 +165,20 @@ module Luban
|
|
173
165
|
protected
|
174
166
|
|
175
167
|
def before_start_process
|
176
|
-
reload_monitor_process
|
168
|
+
reload_monitor_process unless process_monitor?
|
169
|
+
end
|
170
|
+
|
171
|
+
def init
|
172
|
+
load_process_monitor_commands
|
173
|
+
end
|
174
|
+
|
175
|
+
def load_process_monitor_commands
|
176
|
+
singleton_class.send(:prepend,
|
177
|
+
process_monitor_module.const_get("Controller::Commands::Public"))
|
178
|
+
end
|
179
|
+
|
180
|
+
def process_monitor_module
|
181
|
+
Luban::Deployment::Package::Base.package_class(process_monitor[:name])
|
177
182
|
end
|
178
183
|
|
179
184
|
def check_until(pending_seconds: default_pending_seconds,
|
@@ -225,11 +230,11 @@ module Luban
|
|
225
230
|
end
|
226
231
|
|
227
232
|
def monitor_process!
|
228
|
-
test(monitor_command)
|
233
|
+
test(monitor_command(service_entry))
|
229
234
|
end
|
230
235
|
|
231
236
|
def unmonitor_process!
|
232
|
-
test(unmonitor_command)
|
237
|
+
test(unmonitor_command(service_entry))
|
233
238
|
end
|
234
239
|
|
235
240
|
def reload_monitor_process!
|
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.1
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban-cli
|