rest-ftp-daemon 0.230.3 → 0.231.0
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/Gemfile.lock +10 -10
- data/bin/rest-ftp-daemon +2 -14
- data/lib/rest-ftp-daemon/api/jobs.rb +3 -3
- data/lib/rest-ftp-daemon/api/root.rb +12 -2
- data/lib/rest-ftp-daemon/constants.rb +24 -2
- data/lib/rest-ftp-daemon/helpers.rb +3 -5
- data/lib/rest-ftp-daemon/job.rb +2 -4
- data/lib/rest-ftp-daemon/job_queue.rb +5 -6
- data/lib/rest-ftp-daemon/logger.rb +1 -2
- data/lib/rest-ftp-daemon/notification.rb +0 -2
- data/lib/rest-ftp-daemon/path.rb +2 -2
- data/lib/rest-ftp-daemon/remote.rb +1 -1
- data/lib/rest-ftp-daemon/remote_ftp.rb +3 -6
- data/lib/rest-ftp-daemon/remote_sftp.rb +7 -8
- data/lib/rest-ftp-daemon/settings.rb +30 -25
- data/lib/rest-ftp-daemon/worker_job.rb +0 -1
- data/lib/rest-ftp-daemon/worker_pool.rb +5 -6
- data/rest-ftp-daemon.yml.sample +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66b0655649ee2a3e30ef38f68e1af2d49f1f734f
|
4
|
+
data.tar.gz: 6eada364e7297144b6d72f1c3b51a3dd109f0566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ce9aad2b8f6bcf1cbc9bfa806c184b67ad79740279e66e73e3c219579fa29c24a4333bbd0b9203fa7d4f67a26bf7b9dd83a4fe8e4bf3ed8e52d68864cc242e
|
7
|
+
data.tar.gz: 460b89ca8c5d7405fefa708c42c1a6c9e2c6c5ad9511d363d6561797d387591b073458f52af8caff1c3546e5b9fde34b8bed00e54a229fa48ae9d9c2a6088d26
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-ftp-daemon (0.
|
4
|
+
rest-ftp-daemon (0.231.0)
|
5
5
|
double-bag-ftps
|
6
6
|
facter
|
7
7
|
get_process_mem
|
@@ -19,14 +19,14 @@ GEM
|
|
19
19
|
remote: http://rubygems.org/
|
20
20
|
specs:
|
21
21
|
CFPropertyList (2.2.8)
|
22
|
-
activesupport (4.2.
|
22
|
+
activesupport (4.2.4)
|
23
23
|
i18n (~> 0.7)
|
24
24
|
json (~> 1.7, >= 1.7.7)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
thread_safe (~> 0.3, >= 0.3.4)
|
27
27
|
tzinfo (~> 1.1)
|
28
28
|
addressable (2.3.8)
|
29
|
-
ast (2.
|
29
|
+
ast (2.1.0)
|
30
30
|
astrolabe (1.3.1)
|
31
31
|
parser (~> 2.2)
|
32
32
|
axiom-types (0.1.1)
|
@@ -45,12 +45,12 @@ GEM
|
|
45
45
|
unf (>= 0.0.5, < 1.0.0)
|
46
46
|
double-bag-ftps (0.1.2)
|
47
47
|
equalizer (0.0.11)
|
48
|
-
eventmachine (1.0.
|
48
|
+
eventmachine (1.0.8)
|
49
49
|
facter (2.4.4)
|
50
50
|
CFPropertyList (~> 2.2.6)
|
51
51
|
ffi (1.9.10)
|
52
52
|
get_process_mem (0.2.0)
|
53
|
-
grape (0.
|
53
|
+
grape (0.13.0)
|
54
54
|
activesupport
|
55
55
|
builder
|
56
56
|
hashie (>= 2.1.0)
|
@@ -60,13 +60,13 @@ GEM
|
|
60
60
|
rack-accept
|
61
61
|
rack-mount
|
62
62
|
virtus (>= 1.0.0)
|
63
|
-
grape-entity (0.4.
|
63
|
+
grape-entity (0.4.8)
|
64
64
|
activesupport
|
65
65
|
multi_json (>= 1.3.2)
|
66
|
-
haml (4.0.
|
66
|
+
haml (4.0.7)
|
67
67
|
tilt
|
68
68
|
hashie (3.4.2)
|
69
|
-
http (0.
|
69
|
+
http (0.9.4)
|
70
70
|
addressable (~> 2.3)
|
71
71
|
http-cookie (~> 1.0)
|
72
72
|
http-form_data (~> 1.0.1)
|
@@ -79,13 +79,13 @@ GEM
|
|
79
79
|
ice_nine (0.11.1)
|
80
80
|
json (1.8.3)
|
81
81
|
method_source (0.8.2)
|
82
|
-
minitest (5.
|
82
|
+
minitest (5.8.0)
|
83
83
|
multi_json (1.11.2)
|
84
84
|
multi_xml (0.5.5)
|
85
85
|
net-sftp (2.1.2)
|
86
86
|
net-ssh (>= 2.6.5)
|
87
87
|
net-ssh (2.9.2)
|
88
|
-
newrelic_rpm (3.
|
88
|
+
newrelic_rpm (3.13.0.299)
|
89
89
|
parser (2.2.2.6)
|
90
90
|
ast (>= 1.1, < 3.0)
|
91
91
|
powerpack (0.1.1)
|
data/bin/rest-ftp-daemon
CHANGED
@@ -20,18 +20,6 @@ end
|
|
20
20
|
puts
|
21
21
|
|
22
22
|
|
23
|
-
# Provide default config file information
|
24
|
-
DEFAULT_CONFIG_PATH = File.expand_path "/etc/#{APP_NAME}.yml"
|
25
|
-
SAMPLE_CONFIG_FILE = File.expand_path("#{app_root}/rest-ftp-daemon.yml.sample")
|
26
|
-
#SAMPLE_CONFIG_FILE = File.expand_path("#{app_root}/#{APP_NAME}.yml.sample")
|
27
|
-
TAIL_MESSAGE = <<EOD
|
28
|
-
|
29
|
-
A default configuration is available here: #{SAMPLE_CONFIG_FILE}.
|
30
|
-
You should copy it to the expected location #{DEFAULT_CONFIG_PATH}:
|
31
|
-
|
32
|
-
sudo cp #{SAMPLE_CONFIG_FILE} #{DEFAULT_CONFIG_PATH}
|
33
|
-
EOD
|
34
|
-
|
35
23
|
# Detect options from ARGV
|
36
24
|
options = {}
|
37
25
|
parser = OptionParser.new do |opts|
|
@@ -50,7 +38,7 @@ parser = OptionParser.new do |opts|
|
|
50
38
|
opts.separator ""
|
51
39
|
opts.on_tail("-h", "--help", "Show this message") do
|
52
40
|
puts opts
|
53
|
-
puts TAIL_MESSAGE unless File.
|
41
|
+
puts TAIL_MESSAGE unless File.exist?(DEFAULT_CONFIG_PATH)
|
54
42
|
exit
|
55
43
|
end
|
56
44
|
opts.on_tail("-v", "--version", "Show version (#{APP_VER})") { puts APP_VER; exit }
|
@@ -72,7 +60,7 @@ end
|
|
72
60
|
# Load config, and merge options from ARGV into settings
|
73
61
|
# FIXME: file configuration detection could reside in settings.rb
|
74
62
|
APP_CONF ||= DEFAULT_CONFIG_PATH
|
75
|
-
abort "EXITING: cannot read configuration file: #{APP_CONF}" unless File.
|
63
|
+
abort "EXITING: cannot read configuration file: #{APP_CONF}" unless File.exist? APP_CONF
|
76
64
|
begin
|
77
65
|
# Import settings
|
78
66
|
require File.expand_path("#{app_root}/lib/rest-ftp-daemon/settings")
|
@@ -81,15 +81,15 @@ module RestFtpDaemon
|
|
81
81
|
optional :overwrite,
|
82
82
|
type: Boolean,
|
83
83
|
desc: "Overwrites files at target server",
|
84
|
-
default: Settings.transfer
|
84
|
+
default: Settings.at(:transfer, :overwrite)
|
85
85
|
optional :mkdir,
|
86
86
|
type: Boolean,
|
87
87
|
desc: "Create missing directories on target server",
|
88
|
-
default: Settings.transfer
|
88
|
+
default: Settings.at(:transfer, :mkdir)
|
89
89
|
optional :tempfile,
|
90
90
|
type: Boolean,
|
91
91
|
desc: "Upload to a temp file before renaming it to the target filename",
|
92
|
-
default: Settings.transfer
|
92
|
+
default: Settings.at(:transfer, :tempfile)
|
93
93
|
end
|
94
94
|
|
95
95
|
post "/" do
|
@@ -73,12 +73,22 @@ module RestFtpDaemon
|
|
73
73
|
status: $queue.counts_by_status,
|
74
74
|
workers: $pool.worker_variables,
|
75
75
|
jobs_count: $queue.jobs_count,
|
76
|
-
jobs_queued: $queue.queued_ids
|
77
|
-
config: Helpers.get_censored_config
|
76
|
+
jobs_queued: $queue.queued_ids
|
78
77
|
}
|
79
78
|
end
|
80
79
|
|
81
80
|
|
81
|
+
####### GET /config
|
82
|
+
|
83
|
+
# Server config
|
84
|
+
get "/config" do
|
85
|
+
log_info "GET /config"
|
86
|
+
|
87
|
+
status 200
|
88
|
+
return Helpers.get_censored_config
|
89
|
+
end
|
90
|
+
|
91
|
+
|
82
92
|
end
|
83
93
|
end
|
84
94
|
end
|
@@ -1,8 +1,23 @@
|
|
1
1
|
# Terrific constants
|
2
2
|
APP_NAME = "rest-ftp-daemon"
|
3
3
|
APP_NICK = "rftpd"
|
4
|
-
APP_VER = "0.
|
4
|
+
APP_VER = "0.231.0"
|
5
5
|
|
6
|
+
# Provide default config file information
|
7
|
+
APP_LIB = File.expand_path File.dirname(__FILE__)
|
8
|
+
APP_ROOT = File.expand_path(File.dirname(__FILE__) + "/../../")
|
9
|
+
|
10
|
+
DEFAULT_CONFIG_PATH = File.expand_path "/etc/#{APP_NAME}.yml"
|
11
|
+
SAMPLE_CONFIG_FILE = File.expand_path(File.join File.dirname(__FILE__), "/../../rest-ftp-daemon.yml.sample")
|
12
|
+
|
13
|
+
#SAMPLE_CONFIG_FILE = File.expand_path("#{app_root}/#{APP_NAME}.yml.sample")
|
14
|
+
TAIL_MESSAGE = <<EOD
|
15
|
+
|
16
|
+
A default configuration is available here: #{SAMPLE_CONFIG_FILE}.
|
17
|
+
You should copy it to the expected location #{DEFAULT_CONFIG_PATH}:
|
18
|
+
|
19
|
+
sudo cp #{SAMPLE_CONFIG_FILE} #{DEFAULT_CONFIG_PATH}
|
20
|
+
EOD
|
6
21
|
|
7
22
|
# Jobs and workers
|
8
23
|
JOB_RANDOM_LEN = 8
|
@@ -40,6 +55,10 @@ LOG_FORMAT_MESSAGE = "%#{-LOG_COL_WID.to_i}s\t%#{-LOG_COL_JID.to_i}s\t%#{-L
|
|
40
55
|
LOG_NEWLINE = "\n"
|
41
56
|
LOG_INDENT = "\t"
|
42
57
|
|
58
|
+
BIND_PORT_TIMEOUT = 3
|
59
|
+
BIND_PORT_LOCALHOST = '127.0.0.1'
|
60
|
+
|
61
|
+
|
43
62
|
|
44
63
|
# Notifications
|
45
64
|
NOTIFY_PREFIX = "rftpd"
|
@@ -64,6 +83,10 @@ DASHBOARD_WORKER_STYLES = {
|
|
64
83
|
}
|
65
84
|
|
66
85
|
|
86
|
+
# API server
|
87
|
+
# API_LISTEN_HOST = "0.0.0.0"
|
88
|
+
|
89
|
+
|
67
90
|
# Configuration defaults
|
68
91
|
DEFAULT_WORKER_TIMEOUT = 3600
|
69
92
|
DEFAULT_FTP_CHUNK = 512
|
@@ -75,4 +98,3 @@ DEFAULT_WORKERS = 1
|
|
75
98
|
APP_STARTED = Time.now
|
76
99
|
APP_LIBS = File.dirname(__FILE__)
|
77
100
|
|
78
|
-
|
@@ -43,7 +43,7 @@ module RestFtpDaemon
|
|
43
43
|
def self.extract_filename path
|
44
44
|
return unless path.is_a? String
|
45
45
|
# match everything that's after a slash at the end of the string
|
46
|
-
m = path.match
|
46
|
+
m = path.match(/\/?([^\/]+)$/)
|
47
47
|
return m[1] unless m.nil?
|
48
48
|
end
|
49
49
|
|
@@ -61,12 +61,10 @@ module RestFtpDaemon
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def self.local_port_used? port
|
64
|
-
ip = "127.0.0.1"
|
65
|
-
timeout = 1
|
66
64
|
begin
|
67
|
-
Timeout.timeout(
|
65
|
+
Timeout.timeout(BIND_PORT_TIMEOUT) do
|
68
66
|
begin
|
69
|
-
TCPSocket.new(
|
67
|
+
TCPSocket.new(BIND_PORT_LOCALHOST, port).close
|
70
68
|
true
|
71
69
|
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
72
70
|
false
|
data/lib/rest-ftp-daemon/job.rb
CHANGED
@@ -59,7 +59,7 @@ module RestFtpDaemon
|
|
59
59
|
flag_default :tempfile, false
|
60
60
|
|
61
61
|
# Read source file size and parameters
|
62
|
-
@notify_after_sec = Settings.transfer
|
62
|
+
@notify_after_sec = Settings.at(:transfer, :notify_after_sec) rescue nil
|
63
63
|
|
64
64
|
# Flag current job
|
65
65
|
@queued_at = Time.now
|
@@ -176,7 +176,6 @@ module RestFtpDaemon
|
|
176
176
|
log_info "Job.process notify [ended]"
|
177
177
|
client_notify :ended
|
178
178
|
end
|
179
|
-
|
180
179
|
end
|
181
180
|
|
182
181
|
def get attribute
|
@@ -440,7 +439,6 @@ module RestFtpDaemon
|
|
440
439
|
if @tempfile
|
441
440
|
tempname = "#{target.name}.temp-#{Helpers.identifier(JOB_TEMPFILE_LEN)}"
|
442
441
|
#log_info "Job.remote_push tempname [#{tempname}]"
|
443
|
-
else
|
444
442
|
end
|
445
443
|
|
446
444
|
# Remove any existing version if expected, or test its presence
|
@@ -536,7 +534,7 @@ module RestFtpDaemon
|
|
536
534
|
|
537
535
|
rescue StandardError => ex
|
538
536
|
log_error "Job.client_notify EXCEPTION: #{ex.inspect}"
|
539
|
-
|
537
|
+
end
|
540
538
|
|
541
539
|
def get_bitrate delta_data, delta_time
|
542
540
|
return nil if delta_time.nil? || delta_time.zero?
|
@@ -103,7 +103,7 @@ module RestFtpDaemon
|
|
103
103
|
log_info "find_by_id (#{id}, #{prefixed}) > #{id}"
|
104
104
|
|
105
105
|
# Search in jobs queues
|
106
|
-
@jobs.
|
106
|
+
@jobs.reverse.find { |item| item.id == id }
|
107
107
|
end
|
108
108
|
|
109
109
|
def push job
|
@@ -138,7 +138,7 @@ module RestFtpDaemon
|
|
138
138
|
|
139
139
|
def pop non_block=false
|
140
140
|
@mutex.synchronize do
|
141
|
-
|
141
|
+
loop do
|
142
142
|
if @queue.empty?
|
143
143
|
# info "JobQueue.pop: empty"
|
144
144
|
raise ThreadError, "queue empty" if non_block
|
@@ -174,7 +174,7 @@ module RestFtpDaemon
|
|
174
174
|
before = Time.now - maxage.to_i
|
175
175
|
|
176
176
|
# Verbose output ?
|
177
|
-
log_info "JobQueue.expire \t[#{status
|
177
|
+
log_info "JobQueue.expire \t[#{status}] \tbefore \t[#{before}]" if verbose
|
178
178
|
|
179
179
|
@mutex.synchronize do
|
180
180
|
# Delete jobs from the queue when they match status and age limits
|
@@ -186,12 +186,11 @@ module RestFtpDaemon
|
|
186
186
|
next if job.updated_at > before
|
187
187
|
|
188
188
|
# Ok, we have to clean it up ..
|
189
|
-
log_info "expire [#{status
|
189
|
+
log_info "expire [#{status}] [#{maxage}] > [#{job.id}] [#{job.updated_at}]"
|
190
190
|
log_info "#{LOG_INDENT}unqueued" if @queue.delete(job)
|
191
191
|
|
192
192
|
true
|
193
193
|
end
|
194
|
-
|
195
194
|
end
|
196
195
|
|
197
196
|
end
|
@@ -204,7 +203,7 @@ module RestFtpDaemon
|
|
204
203
|
|
205
204
|
def sort_queue!
|
206
205
|
@mutex_counters.synchronize do
|
207
|
-
@queue.sort_by!
|
206
|
+
@queue.sort_by!(&:weight)
|
208
207
|
end
|
209
208
|
end
|
210
209
|
|
data/lib/rest-ftp-daemon/path.rb
CHANGED
@@ -18,14 +18,14 @@ module RestFtpDaemon
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def size
|
21
|
-
File.size full if File.
|
21
|
+
File.size full if File.exist? full
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def extract_filename path
|
27
27
|
# match everything that's after a slash at the end of the string
|
28
|
-
m = path.match
|
28
|
+
m = path.match(/\/?([^\/]+)$/)
|
29
29
|
return m[1].to_s unless m.nil?
|
30
30
|
end
|
31
31
|
|
@@ -68,15 +68,13 @@ module RestFtpDaemon
|
|
68
68
|
def chdir_or_create directory, mkdir = false
|
69
69
|
# Init, extract my parent name and my own name
|
70
70
|
log_info "RemoteFTP.chdir_or_create mkdir[#{mkdir}] dir[#{directory}]"
|
71
|
-
parent,
|
72
|
-
|
73
|
-
fulldir = "/#{directory}"
|
71
|
+
parent, _current = Helpers.extract_parent(directory)
|
74
72
|
|
75
73
|
# Access this directory
|
76
74
|
begin
|
77
75
|
@ftp.chdir "/#{directory}"
|
78
76
|
|
79
|
-
rescue Net::FTPPermError =>
|
77
|
+
rescue Net::FTPPermError => _e
|
80
78
|
# If not allowed to create path, that's over, we're stuck
|
81
79
|
return false unless mkdir
|
82
80
|
|
@@ -112,7 +110,6 @@ module RestFtpDaemon
|
|
112
110
|
# Update job status after this block transfer
|
113
111
|
yield data.bytesize, destination.name
|
114
112
|
end
|
115
|
-
|
116
113
|
end
|
117
114
|
|
118
115
|
def close
|
@@ -137,7 +134,7 @@ module RestFtpDaemon
|
|
137
134
|
@ftp = DoubleBagFTPS.new
|
138
135
|
@ftp.ssl_context = DoubleBagFTPS.create_ssl_context(verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
139
136
|
@ftp.ftps_mode = DoubleBagFTPS::EXPLICIT
|
140
|
-
|
137
|
+
end
|
141
138
|
|
142
139
|
|
143
140
|
end
|
@@ -30,12 +30,11 @@ module RestFtpDaemon
|
|
30
30
|
def present? target
|
31
31
|
log_info "RemoteSFTP.present? [#{target.name}]"
|
32
32
|
stat = @sftp.stat! target.full
|
33
|
-
size = "?"
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
rescue Net::SFTP::StatusException
|
35
|
+
return false
|
36
|
+
else
|
37
|
+
return stat.size
|
39
38
|
end
|
40
39
|
|
41
40
|
# def remove target
|
@@ -64,14 +63,14 @@ module RestFtpDaemon
|
|
64
63
|
def chdir_or_create directory, mkdir = false
|
65
64
|
# Init, extract my parent name and my own name
|
66
65
|
log_info "RemoteSFTP.chdir_or_create mkdir[#{mkdir}] dir[#{directory}]"
|
67
|
-
parent,
|
66
|
+
parent, _current = Helpers.extract_parent(directory)
|
68
67
|
|
69
68
|
# Access this directory
|
70
69
|
begin
|
71
70
|
# log_info " chdir [/#{directory}]"
|
72
|
-
|
71
|
+
@sftp.opendir! "./#{directory}"
|
73
72
|
|
74
|
-
rescue Net::SFTP::StatusException =>
|
73
|
+
rescue Net::SFTP::StatusException => _e
|
75
74
|
# If not allowed to create path, that's over, we're stuck
|
76
75
|
return false unless mkdir
|
77
76
|
|
@@ -3,16 +3,10 @@ require "settingslogic"
|
|
3
3
|
# Configuration class
|
4
4
|
class Settings < Settingslogic
|
5
5
|
# Read configuration
|
6
|
-
namespace
|
7
|
-
source
|
6
|
+
namespace defined?(APP_ENV) ? APP_ENV : "production"
|
7
|
+
source File.exist?(APP_CONF) ? APP_CONF : Hash.new
|
8
8
|
suppress_errors true
|
9
9
|
|
10
|
-
# Compute my PID filename
|
11
|
-
def pidfile
|
12
|
-
port = self["port"]
|
13
|
-
self["pidfile"] || "/tmp/#{APP_NAME}.port#{port}.pid"
|
14
|
-
end
|
15
|
-
|
16
10
|
# Direct access to any depth
|
17
11
|
def at *path
|
18
12
|
path.reduce(Settings) { |m, key| m && m[key.to_s] }
|
@@ -23,31 +17,42 @@ class Settings < Settingslogic
|
|
23
17
|
to_hash.to_yaml(indent: 4, useheader: true, useversion: false )
|
24
18
|
end
|
25
19
|
|
26
|
-
def init_defaults
|
27
|
-
Settings["host"] ||= `hostname`.chomp.split(".").first
|
28
|
-
end
|
29
|
-
|
30
20
|
def newrelic_enabled?
|
31
21
|
Settings.at(:newrelic)
|
32
22
|
end
|
33
23
|
|
34
|
-
def
|
35
|
-
#
|
36
|
-
|
24
|
+
def init_defaults
|
25
|
+
# Init host if missing
|
26
|
+
Settings["host"] ||= `hostname`.chomp.split(".").first
|
27
|
+
|
28
|
+
# Init PID file name if missing
|
29
|
+
Settings["pidfile"] ||= "/tmp/#{APP_NAME}-#{Settings['host']}-#{Settings['port']}.pid"
|
37
30
|
|
38
|
-
#
|
39
|
-
|
40
|
-
|
31
|
+
# Init NEWRELIC env
|
32
|
+
if Settings.newrelic_enabled?
|
33
|
+
# Enable module
|
34
|
+
ENV["NEWRELIC_AGENT_ENABLED"] = "true"
|
35
|
+
ENV["NEW_RELIC_MONITOR_MODE"] = "true"
|
41
36
|
|
42
|
-
|
43
|
-
|
37
|
+
# License
|
38
|
+
ENV["NEW_RELIC_LICENSE_KEY"] = Settings.at(:newrelic, :licence)
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
# Appname
|
41
|
+
platform = Settings.newrelic[:platform] || Settings["host"]
|
42
|
+
Settings.newrelic[:app_name] ||= "#{APP_NICK}-#{platform}-#{Settings.namespace}"
|
43
|
+
ENV["NEW_RELIC_APP_NAME"] = Settings.newrelic[:app_name]
|
44
|
+
|
45
|
+
# Logfile
|
46
|
+
ENV["NEW_RELIC_LOG"] = Settings.at(:logs, :newrelic)
|
47
|
+
else
|
48
|
+
ENV["NEWRELIC_AGENT_ENABLED"] = "false"
|
49
|
+
end
|
50
|
+
|
51
|
+
# That's it!
|
52
|
+
end
|
48
53
|
|
49
|
-
|
50
|
-
|
54
|
+
def overwrite options
|
55
|
+
Settings.merge!(options) if options.is_a? Enumerable
|
51
56
|
end
|
52
57
|
|
53
58
|
end
|
@@ -72,7 +72,6 @@ module RestFtpDaemon
|
|
72
72
|
|
73
73
|
rescue StandardError => ex
|
74
74
|
log_error "UNHDNALED EXCEPTION: #{ex.message}", ex.backtrace
|
75
|
-
|
76
75
|
end
|
77
76
|
|
78
77
|
def create_worker_thread wid
|
@@ -97,12 +96,12 @@ module RestFtpDaemon
|
|
97
96
|
end
|
98
97
|
end
|
99
98
|
|
100
|
-
protected
|
101
99
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
|
101
|
+
if Settings.newrelic_enabled?
|
102
|
+
add_transaction_tracer :create_conchita_thread, category: :task
|
103
|
+
add_transaction_tracer :create_worker_thread, category: :task
|
104
|
+
end
|
106
105
|
|
107
106
|
end
|
108
107
|
end
|
data/rest-ftp-daemon.yml.sample
CHANGED
@@ -21,8 +21,9 @@ defaults: &defaults
|
|
21
21
|
# clean_queued: 86400
|
22
22
|
|
23
23
|
newrelic:
|
24
|
-
licence: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
25
|
-
platform:
|
24
|
+
licence: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
25
|
+
platform: "bigbusiness" # app platform name
|
26
|
+
app_name: "rftpd-bigbusiness-dev" # nickname used for naming app
|
26
27
|
|
27
28
|
debug:
|
28
29
|
ftp: false
|
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.
|
4
|
+
version: 0.231.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|