rest-ftp-daemon 0.435.2 → 0.501.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +35 -29
- data/config.ru +1 -1
- data/defaults.yml +16 -12
- data/lib/rest-ftp-daemon.rb +1 -0
- data/lib/rest-ftp-daemon/api/config.rb +1 -2
- data/lib/rest-ftp-daemon/api/dashboard.rb +6 -4
- data/lib/rest-ftp-daemon/api/debug.rb +6 -5
- data/lib/rest-ftp-daemon/api/jobs.rb +1 -1
- data/lib/rest-ftp-daemon/api/root.rb +11 -10
- data/lib/rest-ftp-daemon/api/status.rb +1 -1
- data/lib/rest-ftp-daemon/constants.rb +12 -3
- data/lib/rest-ftp-daemon/counters.rb +1 -1
- data/lib/rest-ftp-daemon/entities/job.rb +1 -5
- data/lib/rest-ftp-daemon/entities/location.rb +4 -3
- data/lib/rest-ftp-daemon/entities/options.rb +1 -1
- data/lib/rest-ftp-daemon/exceptions.rb +1 -1
- data/lib/rest-ftp-daemon/helpers/api.rb +1 -1
- data/lib/rest-ftp-daemon/helpers/common.rb +1 -1
- data/lib/rest-ftp-daemon/helpers/views.rb +29 -10
- data/lib/rest-ftp-daemon/initialize.rb +1 -1
- data/lib/rest-ftp-daemon/job.rb +11 -13
- data/lib/rest-ftp-daemon/job_queue.rb +9 -10
- data/lib/rest-ftp-daemon/jobs/dummy.rb +1 -1
- data/lib/rest-ftp-daemon/jobs/errors.rb +13 -15
- data/lib/rest-ftp-daemon/jobs/transfer.rb +15 -15
- data/lib/rest-ftp-daemon/jobs/video.rb +7 -7
- data/lib/rest-ftp-daemon/launcher.rb +1 -1
- data/lib/rest-ftp-daemon/location.rb +91 -67
- data/lib/rest-ftp-daemon/metrics.rb +2 -2
- data/lib/rest-ftp-daemon/notification.rb +1 -1
- data/lib/rest-ftp-daemon/paginate.rb +1 -1
- data/lib/rest-ftp-daemon/remote/base.rb +8 -3
- data/lib/rest-ftp-daemon/remote/ftp.rb +18 -18
- data/lib/rest-ftp-daemon/remote/s3.rb +100 -41
- data/lib/rest-ftp-daemon/remote/sftp.rb +15 -15
- data/lib/rest-ftp-daemon/static/css/main.css +34 -4
- data/lib/rest-ftp-daemon/uri.rb +1 -1
- data/lib/rest-ftp-daemon/views/dashboard.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_counters.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_footer.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_header.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_jobs.haml +1 -2
- data/lib/rest-ftp-daemon/views/dashboard_rates.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_table.haml +8 -5
- data/lib/rest-ftp-daemon/views/dashboard_tokens.haml +1 -1
- data/lib/rest-ftp-daemon/views/dashboard_workers.haml +1 -1
- data/lib/rest-ftp-daemon/worker_pool.rb +2 -2
- data/lib/rest-ftp-daemon/workers/conchita.rb +1 -1
- data/lib/rest-ftp-daemon/workers/reporter.rb +1 -1
- data/lib/rest-ftp-daemon/workers/transfer.rb +3 -3
- data/lib/rest-ftp-daemon/workers/worker.rb +1 -1
- data/lib/shared/patch_file.rb +5 -0
- data/rest-ftp-daemon.gemspec +2 -2
- data/spec/spec_helper.rb +2 -1
- data/spec/support/request_helpers.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 180577d1189952b25cbcecf2a7ba1144116d2c41
|
4
|
+
data.tar.gz: 013a7a6dbaac918ef25e2d3607e9d7cc89efb45e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0328a020bf3a3c59d649be271d92e3a2a6661ae0e654255e323c2fb5e6a3e18fbc425c48a905a8c1b84971c1251a393e51135c049d2b3192b2fa2f23307bcb7
|
7
|
+
data.tar.gz: 3b42ec7c4feef47bb5005b338a56f4bb45e094919d97b00f822a66987cc7f749d65ad4912a42384bf7bece3acba7dc187a68ec184b3b976ec29b6c0a1273972b
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-ftp-daemon (0.
|
4
|
+
rest-ftp-daemon (0.501.0)
|
5
5
|
activesupport (~> 4.2)
|
6
6
|
api-auth
|
7
7
|
aws-sdk-resources (~> 2)
|
8
|
-
bmc-daemon-lib (~> 0.
|
8
|
+
bmc-daemon-lib (~> 0.5.0)
|
9
9
|
double-bag-ftps
|
10
10
|
facter
|
11
11
|
get_process_mem
|
@@ -34,18 +34,21 @@ GEM
|
|
34
34
|
minitest (~> 5.1)
|
35
35
|
thread_safe (~> 0.3, >= 0.3.4)
|
36
36
|
tzinfo (~> 1.1)
|
37
|
-
addressable (2.
|
37
|
+
addressable (2.5.0)
|
38
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
38
39
|
api-auth (2.0.1)
|
39
40
|
ast (2.3.0)
|
40
|
-
aws-sdk-core (2.6.
|
41
|
+
aws-sdk-core (2.6.26)
|
42
|
+
aws-sigv4 (~> 1.0)
|
41
43
|
jmespath (~> 1.0)
|
42
|
-
aws-sdk-resources (2.6.
|
43
|
-
aws-sdk-core (= 2.6.
|
44
|
+
aws-sdk-resources (2.6.26)
|
45
|
+
aws-sdk-core (= 2.6.26)
|
46
|
+
aws-sigv4 (1.0.0)
|
44
47
|
axiom-types (0.1.1)
|
45
48
|
descendants_tracker (~> 0.0.4)
|
46
49
|
ice_nine (~> 0.11.0)
|
47
50
|
thread_safe (~> 0.3, >= 0.3.1)
|
48
|
-
bmc-daemon-lib (0.
|
51
|
+
bmc-daemon-lib (0.5.1)
|
49
52
|
chamber (~> 2.9.1)
|
50
53
|
builder (3.2.2)
|
51
54
|
chamber (2.9.1)
|
@@ -60,30 +63,29 @@ GEM
|
|
60
63
|
descendants_tracker (0.0.4)
|
61
64
|
thread_safe (~> 0.3, >= 0.3.1)
|
62
65
|
diff-lcs (1.2.5)
|
63
|
-
domain_name (0.5.
|
66
|
+
domain_name (0.5.20161021)
|
64
67
|
unf (>= 0.0.5, < 1.0.0)
|
65
68
|
double-bag-ftps (0.1.3)
|
66
|
-
enumerable-lazy (0.0.1)
|
67
69
|
equalizer (0.0.11)
|
68
|
-
eventmachine (1.2.
|
70
|
+
eventmachine (1.2.1)
|
69
71
|
facter (2.4.6)
|
70
72
|
CFPropertyList (~> 2.2.6)
|
71
73
|
ffi (1.9.14)
|
72
74
|
get_process_mem (0.2.1)
|
73
|
-
grape (0.
|
75
|
+
grape (0.18.0)
|
74
76
|
activesupport
|
75
77
|
builder
|
76
78
|
hashie (>= 2.1.0)
|
77
79
|
multi_json (>= 1.3.2)
|
78
80
|
multi_xml (>= 0.5.2)
|
79
|
-
|
81
|
+
mustermann-grape (~> 0.4.0)
|
80
82
|
rack (>= 1.3.0)
|
81
83
|
rack-accept
|
82
84
|
virtus (>= 1.0.0)
|
83
|
-
grape-entity (0.
|
85
|
+
grape-entity (0.6.0)
|
84
86
|
activesupport
|
85
87
|
multi_json (>= 1.3.2)
|
86
|
-
grape-swagger (0.
|
88
|
+
grape-swagger (0.25.0)
|
87
89
|
grape (>= 0.12.0)
|
88
90
|
grape-swagger-entity (0.1.4)
|
89
91
|
grape-entity
|
@@ -94,12 +96,12 @@ GEM
|
|
94
96
|
haml (4.0.7)
|
95
97
|
tilt
|
96
98
|
hashie (3.4.6)
|
97
|
-
http (2.0
|
99
|
+
http (2.1.0)
|
98
100
|
addressable (~> 2.3)
|
99
101
|
http-cookie (~> 1.0)
|
100
102
|
http-form_data (~> 1.0.1)
|
101
103
|
http_parser.rb (~> 0.6.0)
|
102
|
-
http-cookie (1.0.
|
104
|
+
http-cookie (1.0.3)
|
103
105
|
domain_name (~> 0.5)
|
104
106
|
http-form_data (1.0.1)
|
105
107
|
http_parser.rb (0.6.0)
|
@@ -109,42 +111,45 @@ GEM
|
|
109
111
|
json (1.8.3)
|
110
112
|
method_source (0.8.2)
|
111
113
|
mime-types (2.99.3)
|
112
|
-
minitest (5.9.
|
114
|
+
minitest (5.9.1)
|
113
115
|
multi_json (1.12.1)
|
114
116
|
multi_xml (0.5.5)
|
115
|
-
|
116
|
-
|
117
|
+
mustermann (0.4.0)
|
118
|
+
tool (~> 0.2)
|
119
|
+
mustermann-grape (0.4.0)
|
120
|
+
mustermann (= 0.4.0)
|
117
121
|
net-sftp (2.1.2)
|
118
122
|
net-ssh (>= 2.6.5)
|
119
123
|
net-ssh (3.2.0)
|
120
124
|
netrc (0.11.0)
|
121
|
-
newrelic_rpm (3.
|
122
|
-
parser (2.3.
|
125
|
+
newrelic_rpm (3.17.1.326)
|
126
|
+
parser (2.3.2.0)
|
123
127
|
ast (~> 2.2)
|
124
128
|
powerpack (0.1.1)
|
125
129
|
pry (0.10.4)
|
126
130
|
coderay (~> 1.1.0)
|
127
131
|
method_source (~> 0.8.1)
|
128
132
|
slop (~> 3.4)
|
133
|
+
public_suffix (2.0.4)
|
129
134
|
rack (2.0.1)
|
130
135
|
rack-accept (0.4.5)
|
131
136
|
rack (>= 0.4)
|
132
137
|
rainbow (2.1.0)
|
133
138
|
rake (11.3.0)
|
134
|
-
representable (3.0.
|
139
|
+
representable (3.0.1)
|
135
140
|
declarative (~> 0.0.5)
|
136
|
-
uber (
|
141
|
+
uber (>= 0.0.15, < 0.2.0)
|
137
142
|
rest-client (1.8.0)
|
138
143
|
http-cookie (>= 1.0.2, < 2.0)
|
139
144
|
mime-types (>= 1.16, < 3.0)
|
140
145
|
netrc (~> 0.7)
|
141
|
-
rollbar (2.13.
|
146
|
+
rollbar (2.13.3)
|
142
147
|
multi_json
|
143
148
|
rspec (3.5.0)
|
144
149
|
rspec-core (~> 3.5.0)
|
145
150
|
rspec-expectations (~> 3.5.0)
|
146
151
|
rspec-mocks (~> 3.5.0)
|
147
|
-
rspec-core (3.5.
|
152
|
+
rspec-core (3.5.4)
|
148
153
|
rspec-support (~> 3.5.0)
|
149
154
|
rspec-expectations (3.5.0)
|
150
155
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -153,7 +158,7 @@ GEM
|
|
153
158
|
diff-lcs (>= 1.2.0, < 2.0)
|
154
159
|
rspec-support (~> 3.5.0)
|
155
160
|
rspec-support (3.5.0)
|
156
|
-
rubocop (0.
|
161
|
+
rubocop (0.45.0)
|
157
162
|
parser (>= 2.3.1.1, < 3.0)
|
158
163
|
powerpack (~> 0.1)
|
159
164
|
rainbow (>= 1.99.1, < 3.0)
|
@@ -162,7 +167,7 @@ GEM
|
|
162
167
|
ruby-prof (0.16.2)
|
163
168
|
ruby-progressbar (1.8.1)
|
164
169
|
slop (3.6.0)
|
165
|
-
streamio-ffmpeg (3.0.
|
170
|
+
streamio-ffmpeg (3.0.2)
|
166
171
|
multi_json (~> 1.8)
|
167
172
|
sys-cpu (0.7.2)
|
168
173
|
ffi
|
@@ -173,9 +178,10 @@ GEM
|
|
173
178
|
thor (0.19.1)
|
174
179
|
thread_safe (0.3.5)
|
175
180
|
tilt (2.0.5)
|
181
|
+
tool (0.2.3)
|
176
182
|
tzinfo (1.2.2)
|
177
183
|
thread_safe (~> 0.1)
|
178
|
-
uber (0.0
|
184
|
+
uber (0.1.0)
|
179
185
|
unf (0.1.4)
|
180
186
|
unf_ext
|
181
187
|
unf_ext (0.0.7.2)
|
@@ -200,4 +206,4 @@ DEPENDENCIES
|
|
200
206
|
ruby-prof
|
201
207
|
|
202
208
|
BUNDLED WITH
|
203
|
-
1.
|
209
|
+
1.13.5
|
data/config.ru
CHANGED
data/defaults.yml
CHANGED
@@ -5,6 +5,11 @@ user: rftpd
|
|
5
5
|
# host: "myhost"
|
6
6
|
allow_reload: false
|
7
7
|
|
8
|
+
# FUTURE
|
9
|
+
debug:
|
10
|
+
ftp: false
|
11
|
+
location: false
|
12
|
+
|
8
13
|
pools: # number of workers decidated to each pool value
|
9
14
|
default: 2
|
10
15
|
urgent: 1
|
@@ -28,7 +33,6 @@ transfer:
|
|
28
33
|
overwrite: false # overwrite any target file with the same name
|
29
34
|
timeout: 1800 # jobs running for longer than X seconds will be killed
|
30
35
|
notify_after: 5 # wait at least X seconds between HTTP notifications
|
31
|
-
|
32
36
|
debug_s3: false
|
33
37
|
debug_ftp: false
|
34
38
|
debug_ftps: false
|
@@ -68,16 +72,16 @@ logs:
|
|
68
72
|
path: "/tmp/"
|
69
73
|
level: debug
|
70
74
|
|
71
|
-
thin: "rftpd-default
|
72
|
-
default: "rftpd-default
|
75
|
+
thin: "rftpd-default.log"
|
76
|
+
default: "rftpd-default.log"
|
73
77
|
|
74
|
-
queue: "rftpd-default
|
75
|
-
api: "rftpd-default
|
76
|
-
workers: "rftpd-default
|
77
|
-
transfer: "rftpd-default
|
78
|
-
conchita: "rftpd-default
|
79
|
-
reporter: "rftpd-default
|
80
|
-
notify: "rftpd-default
|
78
|
+
queue: "rftpd-default.log"
|
79
|
+
api: "rftpd-default.log"
|
80
|
+
workers: "rftpd-default.log"
|
81
|
+
transfer: "rftpd-default.log"
|
82
|
+
conchita: "rftpd-default.log"
|
83
|
+
reporter: "rftpd-default.log"
|
84
|
+
notify: "rftpd-default.log"
|
81
85
|
|
82
|
-
newrelic: "rftpd-
|
83
|
-
rollbar: "rftpd-
|
86
|
+
newrelic: "rftpd-newrelic.log"
|
87
|
+
rollbar: "rftpd-rollbar.log"
|
data/lib/rest-ftp-daemon.rb
CHANGED
@@ -8,6 +8,8 @@ module RestFtpDaemon
|
|
8
8
|
module API
|
9
9
|
class Dashboard < Grape::API
|
10
10
|
include BmcDaemonLib
|
11
|
+
content_type :html, 'application/html'
|
12
|
+
format :html
|
11
13
|
|
12
14
|
### HELPERS
|
13
15
|
helpers do
|
@@ -61,10 +63,10 @@ module RestFtpDaemon
|
|
61
63
|
output = render :dashboard
|
62
64
|
|
63
65
|
# Send response
|
64
|
-
env["api.format"] = :html
|
65
|
-
format "html"
|
66
|
+
#env["api.format"] = :html
|
67
|
+
# format "html"
|
66
68
|
status 200
|
67
|
-
content_type "
|
69
|
+
content_type "html"
|
68
70
|
body output
|
69
71
|
end
|
70
72
|
|
@@ -85,4 +87,4 @@ module RestFtpDaemon
|
|
85
87
|
|
86
88
|
end
|
87
89
|
end
|
88
|
-
end
|
90
|
+
end
|
@@ -18,7 +18,7 @@ module RestFtpDaemon
|
|
18
18
|
def debug_encodings
|
19
19
|
# Encodings
|
20
20
|
encodings = {}
|
21
|
-
jobs =
|
21
|
+
jobs = JobQueue.instance.jobs
|
22
22
|
|
23
23
|
jobs.each do |job|
|
24
24
|
# here = out[job.id] = {}
|
@@ -27,7 +27,7 @@ module RestFtpDaemon
|
|
27
27
|
me[:error] = job.error.encoding.to_s unless job.error.nil?
|
28
28
|
me[:status] = job.status.encoding.to_s unless job.status.nil?
|
29
29
|
|
30
|
-
|
30
|
+
Job::IMPORTED.each do |name|
|
31
31
|
value = job.send(name)
|
32
32
|
me[name] = value.encoding.to_s if value.is_a? String
|
33
33
|
end
|
@@ -46,11 +46,11 @@ module RestFtpDaemon
|
|
46
46
|
|
47
47
|
# Extract routes
|
48
48
|
routes = []
|
49
|
-
|
49
|
+
API::Root.routes.each do |route|
|
50
50
|
routes << {
|
51
51
|
url: "#{route.options[:method]} #{route.pattern.path}",
|
52
52
|
vars: route.instance_variables,
|
53
|
-
options: route.options
|
53
|
+
options: route.options,
|
54
54
|
}
|
55
55
|
|
56
56
|
end
|
@@ -60,9 +60,10 @@ module RestFtpDaemon
|
|
60
60
|
metrics: debug_metrics,
|
61
61
|
encodings: debug_encodings,
|
62
62
|
routes: routes,
|
63
|
+
content_types: Grape::ContentTypes::CONTENT_TYPES
|
63
64
|
}
|
64
65
|
end
|
65
66
|
|
66
67
|
end
|
67
68
|
end
|
68
|
-
end
|
69
|
+
end
|
@@ -31,7 +31,8 @@ module RestFtpDaemon
|
|
31
31
|
|
32
32
|
def exception_error error, http_code, exception
|
33
33
|
# Extract message lines
|
34
|
-
lines = exception.message.lines
|
34
|
+
lines = exception.message.lines
|
35
|
+
#.lines.collect(&:strip).reject(&:empty?)
|
35
36
|
|
36
37
|
# Log error to file
|
37
38
|
log_error "[#{error}] [#{http_code}] #{lines.shift} ", lines
|
@@ -67,9 +68,9 @@ module RestFtpDaemon
|
|
67
68
|
# version 'v1'
|
68
69
|
|
69
70
|
# Response formats
|
70
|
-
content_type :json, 'application/json; charset=utf-8'
|
71
|
-
|
72
|
-
default_format :json
|
71
|
+
#content_type :json, 'application/json; charset=utf-8'
|
72
|
+
format :json
|
73
|
+
# default_format :json
|
73
74
|
|
74
75
|
# Pretty JSON
|
75
76
|
# formatter :json_tmp, ->(object, env) do
|
@@ -78,11 +79,11 @@ module RestFtpDaemon
|
|
78
79
|
# end
|
79
80
|
|
80
81
|
### MOUNTPOINTS
|
81
|
-
mount
|
82
|
-
mount
|
83
|
-
mount
|
84
|
-
mount
|
85
|
-
mount
|
82
|
+
mount API::Status => MOUNT_STATUS
|
83
|
+
mount API::Jobs => MOUNT_JOBS
|
84
|
+
mount API::Dashboard => MOUNT_BOARD
|
85
|
+
mount API::Config => MOUNT_CONFIG
|
86
|
+
mount API::Debug => MOUNT_DEBUG
|
86
87
|
|
87
88
|
|
88
89
|
### API Documentation
|
@@ -109,4 +110,4 @@ module RestFtpDaemon
|
|
109
110
|
|
110
111
|
end
|
111
112
|
end
|
112
|
-
end
|
113
|
+
end
|
@@ -3,17 +3,25 @@ DEFAULT_POOL = "default"
|
|
3
3
|
DEFAULT_SFTP_TIMEOUT = 600 # 10mn
|
4
4
|
DEFAULT_PAGE_SIZE = 50 # 50 lines
|
5
5
|
DEFAULT_RETRY_AFTER = 10 # 10s
|
6
|
-
TARGET_BLANK
|
6
|
+
TARGET_BLANK = "_blank"
|
7
|
+
KB = 1024
|
8
|
+
MB = 1024*KB
|
9
|
+
GB = 1024*MB
|
10
|
+
|
7
11
|
|
8
12
|
# Internal job constants
|
9
13
|
JOB_RANDOM_LEN = 8
|
10
14
|
JOB_IDENT_LEN = 4
|
11
15
|
JOB_TEMPFILE_LEN = 8
|
12
|
-
|
16
|
+
|
17
|
+
JOB_FTP_CHUNKMB = 2*MB
|
18
|
+
JOB_S3_MIN_PART = 5*MB
|
19
|
+
JOB_S3_MAX_COUNT = 10_000
|
13
20
|
|
14
21
|
JOB_FFMPEG_THREADS = 2
|
15
22
|
JOB_FFMPEG_ATTRIBUTES = [:video_codec, :video_bitrate, :video_bitrate_tolerance, :frame_rate, :resolution, :aspect, :keyframe_interval, :x264_vprofile, :x264_preset, :audio_codec, :audio_bitrate, :audio_sample_rate, :audio_channels]
|
16
23
|
|
24
|
+
|
17
25
|
# Internal job infos
|
18
26
|
INFO_PARAMS = :params
|
19
27
|
INFO_ERROR_MESSAGE = :error_message
|
@@ -34,10 +42,10 @@ LOGGER_FORMAT = {
|
|
34
42
|
# context: "%#{-LOG_PREFIX_WID.to_i}s %#{-LOG_PREFIX_JID.to_i}s %#{-LOG_PREFIX_ID.to_i}s ",
|
35
43
|
# context: "wid:%-8{wid} jid:%-12{jid} id:%-5{id}",
|
36
44
|
context: {
|
37
|
-
caller: "%-17s",
|
38
45
|
wid: "%-10s",
|
39
46
|
jid: "%-10s",
|
40
47
|
id: "%-8s",
|
48
|
+
caller: "%18s |",
|
41
49
|
}
|
42
50
|
}
|
43
51
|
|
@@ -123,3 +131,4 @@ MOUNT_CONFIG = "/config"
|
|
123
131
|
# Notifications
|
124
132
|
NOTIFY_PREFIX = "rftpd"
|
125
133
|
NOTIFY_IDENTIFIER_LEN = 4
|
134
|
+
|