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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +35 -29
  3. data/config.ru +1 -1
  4. data/defaults.yml +16 -12
  5. data/lib/rest-ftp-daemon.rb +1 -0
  6. data/lib/rest-ftp-daemon/api/config.rb +1 -2
  7. data/lib/rest-ftp-daemon/api/dashboard.rb +6 -4
  8. data/lib/rest-ftp-daemon/api/debug.rb +6 -5
  9. data/lib/rest-ftp-daemon/api/jobs.rb +1 -1
  10. data/lib/rest-ftp-daemon/api/root.rb +11 -10
  11. data/lib/rest-ftp-daemon/api/status.rb +1 -1
  12. data/lib/rest-ftp-daemon/constants.rb +12 -3
  13. data/lib/rest-ftp-daemon/counters.rb +1 -1
  14. data/lib/rest-ftp-daemon/entities/job.rb +1 -5
  15. data/lib/rest-ftp-daemon/entities/location.rb +4 -3
  16. data/lib/rest-ftp-daemon/entities/options.rb +1 -1
  17. data/lib/rest-ftp-daemon/exceptions.rb +1 -1
  18. data/lib/rest-ftp-daemon/helpers/api.rb +1 -1
  19. data/lib/rest-ftp-daemon/helpers/common.rb +1 -1
  20. data/lib/rest-ftp-daemon/helpers/views.rb +29 -10
  21. data/lib/rest-ftp-daemon/initialize.rb +1 -1
  22. data/lib/rest-ftp-daemon/job.rb +11 -13
  23. data/lib/rest-ftp-daemon/job_queue.rb +9 -10
  24. data/lib/rest-ftp-daemon/jobs/dummy.rb +1 -1
  25. data/lib/rest-ftp-daemon/jobs/errors.rb +13 -15
  26. data/lib/rest-ftp-daemon/jobs/transfer.rb +15 -15
  27. data/lib/rest-ftp-daemon/jobs/video.rb +7 -7
  28. data/lib/rest-ftp-daemon/launcher.rb +1 -1
  29. data/lib/rest-ftp-daemon/location.rb +91 -67
  30. data/lib/rest-ftp-daemon/metrics.rb +2 -2
  31. data/lib/rest-ftp-daemon/notification.rb +1 -1
  32. data/lib/rest-ftp-daemon/paginate.rb +1 -1
  33. data/lib/rest-ftp-daemon/remote/base.rb +8 -3
  34. data/lib/rest-ftp-daemon/remote/ftp.rb +18 -18
  35. data/lib/rest-ftp-daemon/remote/s3.rb +100 -41
  36. data/lib/rest-ftp-daemon/remote/sftp.rb +15 -15
  37. data/lib/rest-ftp-daemon/static/css/main.css +34 -4
  38. data/lib/rest-ftp-daemon/uri.rb +1 -1
  39. data/lib/rest-ftp-daemon/views/dashboard.haml +1 -1
  40. data/lib/rest-ftp-daemon/views/dashboard_counters.haml +1 -1
  41. data/lib/rest-ftp-daemon/views/dashboard_footer.haml +1 -1
  42. data/lib/rest-ftp-daemon/views/dashboard_header.haml +1 -1
  43. data/lib/rest-ftp-daemon/views/dashboard_jobs.haml +1 -2
  44. data/lib/rest-ftp-daemon/views/dashboard_rates.haml +1 -1
  45. data/lib/rest-ftp-daemon/views/dashboard_table.haml +8 -5
  46. data/lib/rest-ftp-daemon/views/dashboard_tokens.haml +1 -1
  47. data/lib/rest-ftp-daemon/views/dashboard_workers.haml +1 -1
  48. data/lib/rest-ftp-daemon/worker_pool.rb +2 -2
  49. data/lib/rest-ftp-daemon/workers/conchita.rb +1 -1
  50. data/lib/rest-ftp-daemon/workers/reporter.rb +1 -1
  51. data/lib/rest-ftp-daemon/workers/transfer.rb +3 -3
  52. data/lib/rest-ftp-daemon/workers/worker.rb +1 -1
  53. data/lib/shared/patch_file.rb +5 -0
  54. data/rest-ftp-daemon.gemspec +2 -2
  55. data/spec/spec_helper.rb +2 -1
  56. data/spec/support/request_helpers.rb +1 -1
  57. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33e255f828fa170324200b0f55874d10e6855e07
4
- data.tar.gz: e3cb2d11b564f572293286e1afd083affb4da4c4
3
+ metadata.gz: 180577d1189952b25cbcecf2a7ba1144116d2c41
4
+ data.tar.gz: 013a7a6dbaac918ef25e2d3607e9d7cc89efb45e
5
5
  SHA512:
6
- metadata.gz: ffd7d9b083f8787d12cf50c15faeb3f479cc552ab2fd8181a05db9405cb90bf9a52411b39ce5af80e7eac02ddfe6a20f37c6e65265bcb2172af12fdd1f7f7795
7
- data.tar.gz: a8dacb6c52cefacd1954b92709938fef737880dcdf4e3e9c346ff6c158e1e7c2f1ccea39ae02e4823993c58f625ff972e5c8fb7d6d626da3fcfb49e1f75cc055
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.435.2)
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.4.3)
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.4.0)
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.2)
41
+ aws-sdk-core (2.6.26)
42
+ aws-sigv4 (~> 1.0)
41
43
  jmespath (~> 1.0)
42
- aws-sdk-resources (2.6.2)
43
- aws-sdk-core (= 2.6.2)
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.4.3)
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.20160826)
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.0.1)
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.17.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
- mustermann19 (~> 0.4.3)
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.5.1)
85
+ grape-entity (0.6.0)
84
86
  activesupport
85
87
  multi_json (>= 1.3.2)
86
- grape-swagger (0.23.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.3)
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.2)
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.0)
114
+ minitest (5.9.1)
113
115
  multi_json (1.12.1)
114
116
  multi_xml (0.5.5)
115
- mustermann19 (0.4.4)
116
- enumerable-lazy
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.16.2.321)
122
- parser (2.3.1.4)
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.0)
139
+ representable (3.0.1)
135
140
  declarative (~> 0.0.5)
136
- uber (~> 0.0.15)
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.1)
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.3)
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.43.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.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.15)
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.12.5
209
+ 1.13.5
data/config.ru CHANGED
@@ -30,7 +30,7 @@ use Rack::Static, root: "#{Conf.app_libs}/static/", urls: [
30
30
  case Conf.app_env
31
31
  when "development"
32
32
  # Rack reloader
33
- # use Rack::Reloader, 1
33
+ use Rack::Reloader, 1
34
34
 
35
35
  # Newrelic dev mode
36
36
  require 'new_relic/rack/developer_mode'
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-thin.log"
72
- default: "rftpd-default-core.log"
75
+ thin: "rftpd-default.log"
76
+ default: "rftpd-default.log"
73
77
 
74
- queue: "rftpd-default-core.log"
75
- api: "rftpd-default-core.log"
76
- workers: "rftpd-default-core.log"
77
- transfer: "rftpd-default-workers.log"
78
- conchita: "rftpd-default-workers.log"
79
- reporter: "rftpd-default-workers.log"
80
- notify: "rftpd-default-workers.log"
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-default-newrelic.log"
83
- rollbar: "rftpd-default-rollbar.log"
86
+ newrelic: "rftpd-newrelic.log"
87
+ rollbar: "rftpd-rollbar.log"
@@ -13,6 +13,7 @@ require "rollbar"
13
13
  # Shared libs / monkey-patching
14
14
  require_relative "shared/patch_array"
15
15
  require_relative "shared/patch_haml"
16
+ require_relative "shared/patch_file"
16
17
 
17
18
  # Project's libs
18
19
  require_relative "rest-ftp-daemon/constants"
@@ -11,7 +11,6 @@ module RestFtpDaemon
11
11
  end
12
12
  end
13
13
 
14
-
15
14
  ### ENDPOINTS
16
15
  desc "Show daemon config"
17
16
  get "/" do
@@ -33,4 +32,4 @@ module RestFtpDaemon
33
32
 
34
33
  end
35
34
  end
36
- end
35
+ end
@@ -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 "text/html"
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 = RestFtpDaemon::JobQueue.instance.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
- RestFtpDaemon::Job::IMPORTED.each do |name|
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
- RestFtpDaemon::API::Root.routes.each do |route|
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
@@ -171,4 +171,4 @@ module RestFtpDaemon
171
171
 
172
172
  end
173
173
  end
174
- end
174
+ 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.collect(&:strip).reject(&:empty?)
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
- # format :json
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 RestFtpDaemon::API::Status => MOUNT_STATUS
82
- mount RestFtpDaemon::API::Jobs => MOUNT_JOBS
83
- mount RestFtpDaemon::API::Dashboard => MOUNT_BOARD
84
- mount RestFtpDaemon::API::Config => MOUNT_CONFIG
85
- mount RestFtpDaemon::API::Debug => MOUNT_DEBUG
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
@@ -49,4 +49,4 @@ module RestFtpDaemon
49
49
 
50
50
  end
51
51
  end
52
- end
52
+ 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 = "_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
- JOB_FTP_CHUNKMB = 2048 # 2 MB
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
+