rest-ftp-daemon 0.306.1 → 0.306.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -14
- data/README.md +3 -3
- data/config.ru +1 -0
- data/defaults.yml +2 -0
- data/lib/rest-ftp-daemon/metrics.rb +2 -2
- data/lib/rest-ftp-daemon/static/css/main.css +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_workers.haml +1 -1
- data/lib/rest-ftp-daemon/worker_pool.rb +34 -35
- data/lib/rest-ftp-daemon/workers/reporter.rb +10 -1
- data/rest-ftp-daemon.gemspec +3 -2
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3ba09263b0e0f9b574f05b07e686181872696be
|
4
|
+
data.tar.gz: cb8d3c93c629c8fe885ae561c0a65bcfcca49115
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 020c5dc65568a55a968cf2d1dffd5a85807df9ee204fda3843dd3ba837b3696da9baef16efde60914f980ef1895eb6e6b66f9e46e27b3f4fa66f394ed1e3c71f
|
7
|
+
data.tar.gz: e7fbfb2d4e4fa68aa75d51d87aa631dd698ee6275222d94dcfcedf5f4b2370662f1d6a2bc478390b562ca812cdc59c8c322507510e4c25f1c1f6e03b1e4d6e22
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-ftp-daemon (0.306.
|
4
|
+
rest-ftp-daemon (0.306.3)
|
5
|
+
activesupport (~> 4.2)
|
5
6
|
api-auth
|
6
|
-
bmc-daemon-lib (~> 0.
|
7
|
+
bmc-daemon-lib (~> 0.3.1)
|
7
8
|
double-bag-ftps
|
8
9
|
facter
|
9
10
|
get_process_mem
|
@@ -22,13 +23,14 @@ GEM
|
|
22
23
|
remote: http://rubygems.org/
|
23
24
|
specs:
|
24
25
|
CFPropertyList (2.2.8)
|
25
|
-
activesupport (
|
26
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
activesupport (4.2.7.1)
|
27
27
|
i18n (~> 0.7)
|
28
|
+
json (~> 1.7, >= 1.7.7)
|
28
29
|
minitest (~> 5.1)
|
30
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
29
31
|
tzinfo (~> 1.1)
|
30
32
|
addressable (2.4.0)
|
31
|
-
api-auth (2.0.
|
33
|
+
api-auth (2.0.1)
|
32
34
|
ast (2.3.0)
|
33
35
|
astrolabe (1.3.1)
|
34
36
|
parser (~> 2.2)
|
@@ -36,7 +38,7 @@ GEM
|
|
36
38
|
descendants_tracker (~> 0.0.4)
|
37
39
|
ice_nine (~> 0.11.0)
|
38
40
|
thread_safe (~> 0.3, >= 0.3.1)
|
39
|
-
bmc-daemon-lib (0.2
|
41
|
+
bmc-daemon-lib (0.3.2)
|
40
42
|
chamber (~> 2.9)
|
41
43
|
builder (3.2.2)
|
42
44
|
chamber (2.9.0)
|
@@ -45,14 +47,13 @@ GEM
|
|
45
47
|
coderay (1.1.1)
|
46
48
|
coercible (1.0.0)
|
47
49
|
descendants_tracker (~> 0.0.1)
|
48
|
-
|
49
|
-
daemons (1.2.3)
|
50
|
+
daemons (1.2.4)
|
50
51
|
descendants_tracker (0.0.4)
|
51
52
|
thread_safe (~> 0.3, >= 0.3.1)
|
52
53
|
diff-lcs (1.2.5)
|
53
54
|
domain_name (0.5.20160615)
|
54
55
|
unf (>= 0.0.5, < 1.0.0)
|
55
|
-
double-bag-ftps (0.1.
|
56
|
+
double-bag-ftps (0.1.3)
|
56
57
|
enumerable-lazy (0.0.1)
|
57
58
|
equalizer (0.0.11)
|
58
59
|
eventmachine (1.2.0.1)
|
@@ -60,7 +61,7 @@ GEM
|
|
60
61
|
CFPropertyList (~> 2.2.6)
|
61
62
|
ffi (1.9.14)
|
62
63
|
get_process_mem (0.2.1)
|
63
|
-
grape (0.
|
64
|
+
grape (0.17.0)
|
64
65
|
activesupport
|
65
66
|
builder
|
66
67
|
hashie (>= 2.1.0)
|
@@ -76,7 +77,7 @@ GEM
|
|
76
77
|
haml (4.0.7)
|
77
78
|
tilt
|
78
79
|
hashie (3.4.4)
|
79
|
-
http (2.0.
|
80
|
+
http (2.0.3)
|
80
81
|
addressable (~> 2.3)
|
81
82
|
http-cookie (~> 1.0)
|
82
83
|
http-form_data (~> 1.0.1)
|
@@ -99,7 +100,7 @@ GEM
|
|
99
100
|
net-ssh (>= 2.6.5)
|
100
101
|
net-ssh (3.2.0)
|
101
102
|
netrc (0.11.0)
|
102
|
-
newrelic_rpm (3.16.
|
103
|
+
newrelic_rpm (3.16.1.320)
|
103
104
|
parser (2.3.1.2)
|
104
105
|
ast (~> 2.2)
|
105
106
|
powerpack (0.1.1)
|
@@ -120,7 +121,7 @@ GEM
|
|
120
121
|
rspec-core (~> 3.5.0)
|
121
122
|
rspec-expectations (~> 3.5.0)
|
122
123
|
rspec-mocks (~> 3.5.0)
|
123
|
-
rspec-core (3.5.
|
124
|
+
rspec-core (3.5.2)
|
124
125
|
rspec-support (~> 3.5.0)
|
125
126
|
rspec-expectations (3.5.0)
|
126
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -171,4 +172,4 @@ DEPENDENCIES
|
|
171
172
|
rubocop (~> 0.32.0)
|
172
173
|
|
173
174
|
BUNDLED WITH
|
174
|
-
1.
|
175
|
+
1.12.5
|
data/README.md
CHANGED
@@ -293,7 +293,7 @@ TODO for this document
|
|
293
293
|
Debian install preparation
|
294
294
|
------------------------------------------------------------------------------------
|
295
295
|
|
296
|
-
This project is available as a rubygem, requires Ruby 2.2 and RubyGems installed.
|
296
|
+
This project is available as a rubygem, requires Ruby 2.2.2 and RubyGems installed.
|
297
297
|
|
298
298
|
#### Using rbenv and ruby-build
|
299
299
|
|
@@ -330,8 +330,8 @@ Use a dedicated user for the daemon, switch to this user and enable rbenv
|
|
330
330
|
Install the right ruby version and activate it
|
331
331
|
|
332
332
|
```
|
333
|
-
# rbenv install 2.2.
|
334
|
-
# rbenv local 2.2.
|
333
|
+
# rbenv install 2.2.2
|
334
|
+
# rbenv local 2.2.2
|
335
335
|
# rbenv rehash
|
336
336
|
```
|
337
337
|
|
data/config.ru
CHANGED
data/defaults.yml
CHANGED
@@ -3,8 +3,8 @@ module RestFtpDaemon
|
|
3
3
|
|
4
4
|
def self.sample
|
5
5
|
# Check validity of globals
|
6
|
-
return
|
7
|
-
return
|
6
|
+
return unless $pool.is_a? RestFtpDaemon::WorkerPool
|
7
|
+
return unless $queue.is_a? RestFtpDaemon::JobQueue
|
8
8
|
|
9
9
|
# Prepare external deps
|
10
10
|
mem = GetProcessMem.new
|
@@ -19,12 +19,38 @@ module RestFtpDaemon
|
|
19
19
|
@mutex = Mutex.new
|
20
20
|
|
21
21
|
# Identifiers generator
|
22
|
-
@
|
22
|
+
@seqno = 0
|
23
|
+
end
|
24
|
+
|
25
|
+
def start!
|
26
|
+
# Read configuration or initialize with empty hash
|
27
|
+
pools = Conf.at[:pools]
|
28
|
+
pools = {} unless pools.is_a? Hash
|
29
|
+
|
30
|
+
# Minimum one worker on DEFAULT_POOL
|
31
|
+
if !(pools.is_a? Hash)
|
32
|
+
log_error "create_threads: one JobWorker is the minimum (#{pools.inspect}"
|
33
|
+
end
|
34
|
+
log_info "WorkerPool creating all workers with #{pools.to_hash.inspect}"
|
23
35
|
|
24
|
-
#
|
25
|
-
|
36
|
+
# Start ConchitaWorker and ReporterWorker
|
37
|
+
create_thread ConchitaWorker, :conchita
|
38
|
+
create_thread ReporterWorker, :reporter
|
39
|
+
|
40
|
+
# Start JobWorkers threads, ensure we have at least one worker in default pool
|
41
|
+
pools[DEFAULT_POOL] ||= 1
|
42
|
+
pools.each do |pool, count|
|
43
|
+
count.times do
|
44
|
+
my_wid = next_wid()
|
45
|
+
create_thread TransferWorker, my_wid, pool
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue StandardError => ex
|
50
|
+
log_error "EXCEPTION: #{ex.message}", ex.backtrace
|
26
51
|
end
|
27
52
|
|
53
|
+
|
28
54
|
def worker_variables
|
29
55
|
vars = {}
|
30
56
|
@workers.collect do |wid, worker|
|
@@ -53,42 +79,15 @@ module RestFtpDaemon
|
|
53
79
|
vars
|
54
80
|
end
|
55
81
|
|
56
|
-
def
|
82
|
+
def next_wid
|
57
83
|
@mutex.synchronize do
|
58
|
-
@
|
84
|
+
@seqno += 1
|
59
85
|
end
|
60
|
-
"w#{@
|
61
|
-
end
|
62
|
-
|
63
|
-
def create_threads
|
64
|
-
# Read configuration or initialize with empty hash
|
65
|
-
pools = Conf.at[:pools]
|
66
|
-
pools = {} unless pools.is_a? Hash
|
67
|
-
|
68
|
-
# Minimum one worker on DEFAULT_POOL
|
69
|
-
if !(pools.is_a? Hash)
|
70
|
-
log_error "create_threads: one JobWorker is the minimum (#{pools.inspect}"
|
71
|
-
end
|
72
|
-
log_info "WorkerPool creating all workers with #{pools.to_hash.inspect}"
|
73
|
-
|
74
|
-
# Start ConchitaWorker and ReporterWorker
|
75
|
-
create_thread :conchita, ConchitaWorker
|
76
|
-
create_thread :reporter, ReporterWorker
|
77
|
-
|
78
|
-
# Start JobWorkers threads, ensure we have at least one worker in default pool
|
79
|
-
pools[DEFAULT_POOL] ||= 1
|
80
|
-
pools.each do |pool, count|
|
81
|
-
count.times do
|
82
|
-
wid = next_worker_id
|
83
|
-
create_thread(wid, TransferWorker, pool)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
rescue StandardError => ex
|
88
|
-
log_error "EXCEPTION: #{ex.message}", ex.backtrace
|
86
|
+
"w#{@seqno}"
|
89
87
|
end
|
90
88
|
|
91
|
-
def create_thread
|
89
|
+
def create_thread klass, wid, pool = nil
|
90
|
+
# def create_thread wid, klass, pool = nil
|
92
91
|
# Spawn thread and add it to my index
|
93
92
|
log_info "spawning #{klass.name} wid[#{wid}] pool[#{pool}]"
|
94
93
|
@workers[wid] = Thread.new do
|
@@ -13,7 +13,9 @@ module RestFtpDaemon
|
|
13
13
|
@report_newrelic = Conf.newrelic_enabled?
|
14
14
|
|
15
15
|
# Check that everything is OK
|
16
|
-
return "invalid timer"
|
16
|
+
return "invalid timer" unless @config[:timer].to_i > 0
|
17
|
+
# return "invalid WorkerPool" unless $pool.is_a? RestFtpDaemon::WorkerPool
|
18
|
+
# return "invalid JobQueue" unless $queue.is_a? RestFtpDaemon::JobQueue
|
17
19
|
return false
|
18
20
|
end
|
19
21
|
|
@@ -40,6 +42,12 @@ module RestFtpDaemon
|
|
40
42
|
# Get common metrics and dump them to logs
|
41
43
|
log_debug "begin metrics sample"
|
42
44
|
metrics = Metrics.sample
|
45
|
+
|
46
|
+
# Skip following if no valid metrics collected
|
47
|
+
unless metrics.is_a? Hash
|
48
|
+
log_error "unable to collect metrics"
|
49
|
+
return
|
50
|
+
end
|
43
51
|
log_info "collected metrics (newrelic: #{@report_newrelic})", metrics
|
44
52
|
|
45
53
|
# Transpose metrics to NewRelic metrics
|
@@ -47,6 +55,7 @@ module RestFtpDaemon
|
|
47
55
|
end
|
48
56
|
|
49
57
|
def report_newrelic metrics
|
58
|
+
|
50
59
|
metrics_newrelic = {}
|
51
60
|
metrics.each do |group, pairs|
|
52
61
|
pairs.each do |key, value|
|
data/rest-ftp-daemon.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
|
4
4
|
# Project version
|
5
|
-
spec.version = "0.306.
|
5
|
+
spec.version = "0.306.3"
|
6
6
|
|
7
7
|
# Project description
|
8
8
|
spec.name = "rest-ftp-daemon"
|
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "http"
|
34
34
|
|
35
35
|
# Runtime dependencies
|
36
|
-
spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.
|
36
|
+
spec.add_runtime_dependency "bmc-daemon-lib", "~> 0.3.1"
|
37
37
|
spec.add_runtime_dependency "json", "~> 1.8"
|
38
38
|
spec.add_runtime_dependency "thin", "~> 1.7"
|
39
|
+
spec.add_runtime_dependency "activesupport", "~> 4.2"
|
39
40
|
spec.add_runtime_dependency "grape"
|
40
41
|
spec.add_runtime_dependency "grape-entity"
|
41
42
|
spec.add_runtime_dependency "settingslogic"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-ftp-daemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.306.
|
4
|
+
version: 0.306.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.3.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.3.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: json
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.7'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: activesupport
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '4.2'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '4.2'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: grape
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -394,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
408
|
version: '0'
|
395
409
|
requirements: []
|
396
410
|
rubyforge_project:
|
397
|
-
rubygems_version: 2.
|
411
|
+
rubygems_version: 2.4.5
|
398
412
|
signing_key:
|
399
413
|
specification_version: 4
|
400
414
|
summary: RESTful FTP client daemon
|