invoker 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +6 -0
- data/examples/crash.rb +2 -0
- data/examples/sample.ini +4 -0
- data/invoker.gemspec +1 -1
- data/lib/invoker.rb +3 -4
- data/lib/invoker/cli.rb +11 -3
- data/lib/invoker/command_worker.rb +1 -1
- data/lib/invoker/ipc/unix_client.rb +2 -2
- data/lib/invoker/parsers/config.rb +1 -1
- data/lib/invoker/power/balancer.rb +1 -1
- data/lib/invoker/power/pf_migrate.rb +2 -2
- data/lib/invoker/power/setup.rb +3 -3
- data/lib/invoker/power/setup/linux_setup.rb +1 -1
- data/lib/invoker/power/setup/osx_setup.rb +4 -4
- data/lib/invoker/process_manager.rb +4 -4
- data/lib/invoker/reactor/reader.rb +17 -6
- data/lib/invoker/version.rb +1 -1
- metadata +8 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94d07aee24e9bfaca5d95b721d38c8b6396b996f
|
4
|
+
data.tar.gz: 0623bb80d7a17b18e6e9f7371c62104a4d22323a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ecb8ff338d9d7824d151e20a30bd7874987a4f03d645cb6787aeb71ca298b673b1e51d62d120a7229fec1fd339f29c9e9a31fa5887745adc3846018cb638444
|
7
|
+
data.tar.gz: f8be5f264d28794ef11e1d023892afc4421e65cc0d840ddb7381eb57be981dffa18cff2f0ab0b50a037102579d52f3d771d00269ce169412db9942da3722d7c2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
## Changelog since 1.5.4
|
2
2
|
|
3
3
|
|
4
|
+
|
5
|
+
# v1.5.5
|
6
|
+
* Fix high cpu usage when process managed by Invoker crashes and Invoker doesn't read from its socket.(https://github.com/code-mancers/invoker/pull/198)
|
7
|
+
* Allow users to specify custom ssl certificate and key (https://github.com/code-mancers/invoker/pull/199)
|
8
|
+
* Remove rainbow dependency and migrate to colorize
|
9
|
+
|
4
10
|
# v1.5.4
|
5
11
|
* Add support for running Invoker build in SELinux environments (https://github.com/code-mancers/invoker/pull/188)
|
6
12
|
* Add an option to print process listing in raw format. This enables us to see complete process list (https://github.com/code-mancers/invoker/pull/193)
|
data/examples/crash.rb
ADDED
data/examples/sample.ini
CHANGED
data/invoker.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.require_paths = ["lib"]
|
27
27
|
s.summary = %q{Something small for Process management}
|
28
28
|
s.add_dependency("thor", "~> 0.19")
|
29
|
-
s.add_dependency("
|
29
|
+
s.add_dependency("colorize", "~> 0.8.1")
|
30
30
|
s.add_dependency("iniparse", "~> 1.1")
|
31
31
|
s.add_dependency("formatador", "~> 0.2")
|
32
32
|
s.add_dependency("eventmachine", "~> 1.0.4")
|
data/lib/invoker.rb
CHANGED
@@ -6,8 +6,7 @@ require "formatador"
|
|
6
6
|
require "ostruct"
|
7
7
|
require "uuid"
|
8
8
|
require "json"
|
9
|
-
require "
|
10
|
-
require "rainbow/ext/string"
|
9
|
+
require "colorize"
|
11
10
|
require "etc"
|
12
11
|
|
13
12
|
require "invoker/version"
|
@@ -36,7 +35,7 @@ require "invoker/process_printer"
|
|
36
35
|
module Invoker
|
37
36
|
class << self
|
38
37
|
attr_accessor :config, :tail_watchers, :commander
|
39
|
-
attr_accessor :dns_cache, :daemonize, :nocolors
|
38
|
+
attr_accessor :dns_cache, :daemonize, :nocolors, :certificate, :private_key
|
40
39
|
|
41
40
|
alias_method :daemonize?, :daemonize
|
42
41
|
alias_method :nocolors?, :nocolors
|
@@ -74,7 +73,7 @@ module Invoker
|
|
74
73
|
return true if File.exist?(Invoker::Power::Config.config_file)
|
75
74
|
|
76
75
|
if throw_warning
|
77
|
-
Invoker::Logger.puts("Invoker has detected setup has not been run. Domain feature will not work without running setup command.".
|
76
|
+
Invoker::Logger.puts("Invoker has detected setup has not been run. Domain feature will not work without running setup command.".colorize(:red))
|
78
77
|
end
|
79
78
|
false
|
80
79
|
end
|
data/lib/invoker/cli.rb
CHANGED
@@ -41,16 +41,24 @@ module Invoker
|
|
41
41
|
type: :boolean,
|
42
42
|
banner: "Disable color in output",
|
43
43
|
aliases: [:nc]
|
44
|
+
option :certificate,
|
45
|
+
type: :string,
|
46
|
+
banner: "Path to certificate"
|
47
|
+
option :private_key,
|
48
|
+
type: :string,
|
49
|
+
banner: "Path to private key"
|
44
50
|
def start(file = nil)
|
45
51
|
Invoker.setup_config_location
|
46
52
|
port = options[:port] || 9000
|
47
53
|
Invoker.daemonize = options[:daemon]
|
48
54
|
Invoker.nocolors = options[:nocolors]
|
55
|
+
Invoker.certificate = options[:certificate]
|
56
|
+
Invoker.private_key = options[:private_key]
|
49
57
|
Invoker.load_invoker_config(file, port)
|
50
58
|
warn_about_notification
|
51
59
|
warn_about_old_configuration
|
52
60
|
pinger = Invoker::CLI::Pinger.new(unix_socket)
|
53
|
-
abort("Invoker is already running".
|
61
|
+
abort("Invoker is already running".colorize(:red)) if pinger.invoker_running?
|
54
62
|
Invoker.commander.start_manager
|
55
63
|
end
|
56
64
|
|
@@ -150,7 +158,7 @@ module Invoker
|
|
150
158
|
require "libnotify"
|
151
159
|
rescue LoadError
|
152
160
|
Invoker::Logger.puts "You can install libnotify gem for Invoker notifications "\
|
153
|
-
"via system tray".
|
161
|
+
"via system tray".colorize(:red)
|
154
162
|
end
|
155
163
|
|
156
164
|
def warn_about_terminal_notifier
|
@@ -158,7 +166,7 @@ module Invoker
|
|
158
166
|
command_path = `which terminal-notifier`
|
159
167
|
if !command_path || command_path.empty?
|
160
168
|
Invoker::Logger.puts "You can enable OSX notification for processes "\
|
161
|
-
"by installing terminal-notifier gem".
|
169
|
+
"by installing terminal-notifier gem".colorize(:red)
|
162
170
|
end
|
163
171
|
end
|
164
172
|
end
|
@@ -25,7 +25,7 @@ module Invoker
|
|
25
25
|
# Print the lines received over the network
|
26
26
|
def receive_line(line)
|
27
27
|
tail_watchers = Invoker.tail_watchers[@command_label]
|
28
|
-
color_line = "#{@command_label.
|
28
|
+
color_line = "#{@command_label.colorize(color)} : #{line}"
|
29
29
|
plain_line = "#{@command_label} : #{line}"
|
30
30
|
if Invoker.nocolors?
|
31
31
|
Invoker::Logger.puts plain_line
|
@@ -28,7 +28,7 @@ module Invoker
|
|
28
28
|
begin
|
29
29
|
socket = Socket.unix(Invoker::IPC::Server::SOCKET_PATH)
|
30
30
|
rescue
|
31
|
-
abort("Invoker does not seem to be running".
|
31
|
+
abort("Invoker does not seem to be running".colorize(:red))
|
32
32
|
end
|
33
33
|
message_object = get_message_object(command, message)
|
34
34
|
send_json_message(socket, message_object)
|
@@ -49,7 +49,7 @@ module Invoker
|
|
49
49
|
def open_client_socket(abort_if_not_running = true)
|
50
50
|
Socket.unix(Invoker::IPC::Server::SOCKET_PATH) { |socket| yield socket }
|
51
51
|
rescue
|
52
|
-
abort_if_not_running && abort("Invoker does not seem to be running".
|
52
|
+
abort_if_not_running && abort("Invoker does not seem to be running".colorize(:red))
|
53
53
|
end
|
54
54
|
|
55
55
|
def send_json_message(socket, message_object)
|
@@ -90,7 +90,7 @@ module Invoker
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def print_message_and_abort
|
93
|
-
Invoker::Logger.puts("\n Invalid config file. Invoker requires an ini or a Procfile.".
|
93
|
+
Invoker::Logger.puts("\n Invalid config file. Invoker requires an ini or a Procfile.".colorize(:red))
|
94
94
|
abort
|
95
95
|
end
|
96
96
|
|
@@ -17,7 +17,7 @@ module Invoker
|
|
17
17
|
osx_setup.install_firewall(Invoker.config.http_port, Invoker.config.https_port)
|
18
18
|
drop_to_normal_user
|
19
19
|
Invoker::Logger.puts "Invoker has updated its configuration for yosemite."\
|
20
|
-
" Please restart OSX to complete the configuration process.".
|
20
|
+
" Please restart OSX to complete the configuration process.".colorize(:red)
|
21
21
|
exit(-1)
|
22
22
|
end
|
23
23
|
end
|
@@ -27,7 +27,7 @@ module Invoker
|
|
27
27
|
Invoker::Logger.puts "Invoker has detected you are running OSX 10.10 "\
|
28
28
|
" but your invoker configuration does not support it."
|
29
29
|
Invoker::Logger.puts "Invoker can update its configuration automaticaly"\
|
30
|
-
" but it will require a system reboot.".
|
30
|
+
" but it will require a system reboot.".colorize(:red)
|
31
31
|
Invoker::CLI::Question.agree("Update Invoker configuration (y/n) :")
|
32
32
|
else
|
33
33
|
true
|
data/lib/invoker/power/setup.rb
CHANGED
@@ -26,7 +26,7 @@ module Invoker
|
|
26
26
|
|
27
27
|
def initialize(tld)
|
28
28
|
if tld !~ /^[a-z]+$/
|
29
|
-
Invoker::Logger.puts("Please specify valid tld".
|
29
|
+
Invoker::Logger.puts("Please specify valid tld".colorize(:red))
|
30
30
|
exit(1)
|
31
31
|
end
|
32
32
|
self.tld = tld
|
@@ -36,7 +36,7 @@ module Invoker
|
|
36
36
|
if check_if_setup_can_run?
|
37
37
|
setup_invoker
|
38
38
|
else
|
39
|
-
Invoker::Logger.puts("The setup has been already run.".
|
39
|
+
Invoker::Logger.puts("The setup has been already run.".colorize(:red))
|
40
40
|
end
|
41
41
|
self
|
42
42
|
end
|
@@ -77,7 +77,7 @@ module Invoker
|
|
77
77
|
begin
|
78
78
|
safe_remove_file(resolver_file)
|
79
79
|
rescue Errno::EACCES
|
80
|
-
Invoker::Logger.puts("Running uninstall requires root access, please rerun it with sudo".
|
80
|
+
Invoker::Logger.puts("Running uninstall requires root access, please rerun it with sudo".colorize(:red))
|
81
81
|
raise
|
82
82
|
end
|
83
83
|
end
|
@@ -19,7 +19,7 @@ module Invoker
|
|
19
19
|
drop_to_normal_user
|
20
20
|
create_config_file
|
21
21
|
else
|
22
|
-
Invoker::Logger.puts("Invoker is not configured to serve from subdomains".
|
22
|
+
Invoker::Logger.puts("Invoker is not configured to serve from subdomains".colorize(:red))
|
23
23
|
end
|
24
24
|
self
|
25
25
|
end
|
@@ -17,7 +17,7 @@ module Invoker
|
|
17
17
|
drop_to_normal_user
|
18
18
|
create_config_file
|
19
19
|
else
|
20
|
-
Invoker::Logger.puts("Invoker is not configured to serve from subdomains".
|
20
|
+
Invoker::Logger.puts("Invoker is not configured to serve from subdomains".colorize(:red))
|
21
21
|
end
|
22
22
|
self
|
23
23
|
end
|
@@ -42,7 +42,7 @@ module Invoker
|
|
42
42
|
def install_resolver(dns_port)
|
43
43
|
open_resolver_for_write { |fl| fl.write(resolve_string(dns_port)) }
|
44
44
|
rescue Errno::EACCES
|
45
|
-
Invoker::Logger.puts("Running setup requires root access, please rerun it with sudo".
|
45
|
+
Invoker::Logger.puts("Running setup requires root access, please rerun it with sudo".colorize(:red))
|
46
46
|
raise
|
47
47
|
end
|
48
48
|
|
@@ -110,7 +110,7 @@ port #{dns_port}
|
|
110
110
|
return true unless File.exist?(resolver_file)
|
111
111
|
|
112
112
|
Invoker::Logger.puts "Invoker has detected an existing Pow installation. We recommend "\
|
113
|
-
"that you uninstall pow and rerun this setup.".
|
113
|
+
"that you uninstall pow and rerun this setup.".colorize(:red)
|
114
114
|
Invoker::Logger.puts "If you have already uninstalled Pow, proceed with installation"\
|
115
115
|
" by pressing y/n."
|
116
116
|
replace_resolver_flag = Invoker::CLI::Question.agree("Replace Pow configuration (y/n) : ")
|
@@ -118,7 +118,7 @@ port #{dns_port}
|
|
118
118
|
if replace_resolver_flag
|
119
119
|
Invoker::Logger.puts "Invoker has overwritten one or more files created by Pow. "\
|
120
120
|
"If .#{tld} domains still don't resolve locally, try turning off the wi-fi"\
|
121
|
-
" and turning it on. It'll force OS X to reload network configuration".
|
121
|
+
" and turning it on. It'll force OS X to reload network configuration".colorize(:green)
|
122
122
|
end
|
123
123
|
replace_resolver_flag
|
124
124
|
end
|
@@ -30,7 +30,7 @@ module Invoker
|
|
30
30
|
# @param process_name [String] Command label of process specified in config file.
|
31
31
|
def start_process_by_name(process_name)
|
32
32
|
if process_running?(process_name)
|
33
|
-
Invoker::Logger.puts "\nProcess '#{process_name}' is already running".
|
33
|
+
Invoker::Logger.puts "\nProcess '#{process_name}' is already running".colorize(:red)
|
34
34
|
return false
|
35
35
|
end
|
36
36
|
|
@@ -49,7 +49,7 @@ module Invoker
|
|
49
49
|
return false unless worker
|
50
50
|
signal_to_use = remove_message.signal || 'INT'
|
51
51
|
|
52
|
-
Invoker::Logger.puts("Removing #{command_label} with signal #{signal_to_use}".
|
52
|
+
Invoker::Logger.puts("Removing #{command_label} with signal #{signal_to_use}".colorize(:red))
|
53
53
|
kill_or_remove_process(worker.pid, signal_to_use, command_label)
|
54
54
|
end
|
55
55
|
|
@@ -128,7 +128,7 @@ module Invoker
|
|
128
128
|
thread = Thread.new do
|
129
129
|
Process.wait(pid)
|
130
130
|
message = "Process with command #{command_label} exited with status #{$?.exitstatus}"
|
131
|
-
Invoker::Logger.puts("\n#{message}".
|
131
|
+
Invoker::Logger.puts("\n#{message}".colorize(:red))
|
132
132
|
Invoker.notify_user(message)
|
133
133
|
Invoker.commander.trigger(command_label, :exit)
|
134
134
|
end
|
@@ -149,7 +149,7 @@ module Invoker
|
|
149
149
|
process_kill(pid, signal_to_use)
|
150
150
|
true
|
151
151
|
rescue Errno::ESRCH
|
152
|
-
Invoker::Logger.puts("Killing process with #{pid} and name #{command_label} failed".
|
152
|
+
Invoker::Logger.puts("Killing process with #{pid} and name #{command_label} failed".colorize(:red))
|
153
153
|
remove_worker(command_label, false)
|
154
154
|
false
|
155
155
|
end
|
@@ -19,18 +19,29 @@ module Invoker
|
|
19
19
|
|
20
20
|
def process_read(ready_fd)
|
21
21
|
command_worker = Invoker.commander.get_worker_from_fd(ready_fd)
|
22
|
-
return unless command_worker
|
23
22
|
begin
|
24
23
|
data = read_data(ready_fd)
|
25
|
-
|
24
|
+
send_data_to_worker(data, command_worker)
|
26
25
|
rescue Invoker::Errors::ProcessTerminated
|
27
|
-
remove_from_read_monitoring(command_worker
|
26
|
+
remove_from_read_monitoring(command_worker, ready_fd)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def send_data_to_worker(data, command_worker)
|
31
|
+
if command_worker
|
32
|
+
command_worker.receive_data(data)
|
33
|
+
else
|
34
|
+
Invoker::Logger.puts("No reader found for incoming data")
|
28
35
|
end
|
29
36
|
end
|
30
37
|
|
31
|
-
def remove_from_read_monitoring(
|
32
|
-
|
33
|
-
|
38
|
+
def remove_from_read_monitoring(command_worker, ready_fd)
|
39
|
+
if command_worker
|
40
|
+
read_array.delete(command_worker.pipe_end)
|
41
|
+
command_worker.unbind
|
42
|
+
else
|
43
|
+
read_array.delete(ready_fd)
|
44
|
+
end
|
34
45
|
rescue StandardError => error
|
35
46
|
Invoker::Logger.puts(error.message)
|
36
47
|
Invoker::Logger.puts(error.backtrace)
|
data/lib/invoker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hemant Kumar
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -26,19 +26,19 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.19'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: colorize
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 0.8.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 0.8.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: iniparse
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,6 +242,7 @@ files:
|
|
242
242
|
- bin/invoker
|
243
243
|
- contrib/completion/invoker-completion.bash
|
244
244
|
- contrib/completion/invoker-completion.zsh
|
245
|
+
- examples/crash.rb
|
245
246
|
- examples/hello_sinatra.rb
|
246
247
|
- examples/sample.ini
|
247
248
|
- invoker.gemspec
|
@@ -355,36 +356,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
356
|
version: '0'
|
356
357
|
requirements: []
|
357
358
|
rubyforge_project:
|
358
|
-
rubygems_version: 2.
|
359
|
+
rubygems_version: 2.6.11
|
359
360
|
signing_key:
|
360
361
|
specification_version: 4
|
361
362
|
summary: Something small for Process management
|
362
|
-
test_files:
|
363
|
-
- spec/invoker/cli/pinger_spec.rb
|
364
|
-
- spec/invoker/cli/tail_watcher_spec.rb
|
365
|
-
- spec/invoker/cli_spec.rb
|
366
|
-
- spec/invoker/command_worker_spec.rb
|
367
|
-
- spec/invoker/commander_spec.rb
|
368
|
-
- spec/invoker/config_spec.rb
|
369
|
-
- spec/invoker/daemon_spec.rb
|
370
|
-
- spec/invoker/event/manager_spec.rb
|
371
|
-
- spec/invoker/invoker_spec.rb
|
372
|
-
- spec/invoker/ipc/client_handler_spec.rb
|
373
|
-
- spec/invoker/ipc/dns_check_command_spec.rb
|
374
|
-
- spec/invoker/ipc/message/list_response_spec.rb
|
375
|
-
- spec/invoker/ipc/message_spec.rb
|
376
|
-
- spec/invoker/ipc/unix_client_spec.rb
|
377
|
-
- spec/invoker/power/balancer_spec.rb
|
378
|
-
- spec/invoker/power/config_spec.rb
|
379
|
-
- spec/invoker/power/http_parser_spec.rb
|
380
|
-
- spec/invoker/power/http_response_spec.rb
|
381
|
-
- spec/invoker/power/pf_migrate_spec.rb
|
382
|
-
- spec/invoker/power/port_finder_spec.rb
|
383
|
-
- spec/invoker/power/setup/linux_setup_spec.rb
|
384
|
-
- spec/invoker/power/setup/osx_setup_spec.rb
|
385
|
-
- spec/invoker/power/setup_spec.rb
|
386
|
-
- spec/invoker/power/url_rewriter_spec.rb
|
387
|
-
- spec/invoker/power/web_sockets_spec.rb
|
388
|
-
- spec/invoker/process_manager_spec.rb
|
389
|
-
- spec/invoker/reactor_spec.rb
|
390
|
-
- spec/spec_helper.rb
|
363
|
+
test_files: []
|