rest-ftp-daemon 0.250.5 → 0.300.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -14
- data/README.md +12 -3
- data/bin/rest-ftp-daemon +102 -96
- data/config.ru +5 -5
- data/defaults.yml +61 -0
- data/lib/rest-ftp-daemon.rb +10 -4
- data/lib/rest-ftp-daemon/api/config.rb +3 -2
- data/lib/rest-ftp-daemon/api/dashboard.rb +1 -4
- data/lib/rest-ftp-daemon/api/debug.rb +30 -17
- data/lib/rest-ftp-daemon/api/job_presenter.rb +0 -2
- data/lib/rest-ftp-daemon/api/jobs.rb +4 -3
- data/lib/rest-ftp-daemon/api/root.rb +7 -10
- data/lib/rest-ftp-daemon/api/status.rb +7 -13
- data/lib/rest-ftp-daemon/constants.rb +27 -45
- data/lib/rest-ftp-daemon/counters.rb +0 -4
- data/lib/rest-ftp-daemon/helpers.rb +3 -18
- data/lib/rest-ftp-daemon/job.rb +16 -21
- data/lib/rest-ftp-daemon/job_queue.rb +21 -14
- data/lib/rest-ftp-daemon/launcher.rb +26 -0
- data/lib/rest-ftp-daemon/logger_pool.rb +9 -19
- data/lib/rest-ftp-daemon/metrics.rb +41 -0
- data/lib/rest-ftp-daemon/notification.rb +7 -10
- data/lib/rest-ftp-daemon/remote.rb +4 -4
- data/lib/rest-ftp-daemon/remote_ftp.rb +10 -10
- data/lib/rest-ftp-daemon/remote_sftp.rb +13 -24
- data/lib/rest-ftp-daemon/views/dashboard.haml +2 -2
- data/lib/rest-ftp-daemon/views/dashboard_footer.haml +2 -2
- data/lib/rest-ftp-daemon/views/dashboard_header.haml +2 -2
- data/lib/rest-ftp-daemon/views/dashboard_workers.haml +2 -2
- data/lib/rest-ftp-daemon/worker.rb +43 -12
- data/lib/rest-ftp-daemon/worker_conchita.rb +15 -28
- data/lib/rest-ftp-daemon/worker_job.rb +30 -21
- data/lib/rest-ftp-daemon/worker_pool.rb +59 -50
- data/lib/rest-ftp-daemon/worker_reporter.rb +70 -0
- data/lib/shared/conf.rb +195 -0
- data/lib/shared/logger_formatter.rb +31 -0
- data/lib/shared/logger_helper.rb +78 -0
- data/rest-ftp-daemon.gemspec +23 -22
- data/{rest-ftp-daemon.yml.sample → rest-ftp-daemon.sample.yml} +10 -7
- data/spec/spec_helper.rb +1 -1
- metadata +30 -12
- data/lib/rest-ftp-daemon/logger.rb +0 -57
- data/lib/rest-ftp-daemon/logger_helper.rb +0 -36
- data/lib/rest-ftp-daemon/settings.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd2717929c1af430db95ad5e9798060d8ab9e2f
|
4
|
+
data.tar.gz: 9fbd387461378d7523194b5bf3e09600661546c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b92af09c38e6505da2cb1161729be8402f4a6c401e16ac4a0a9ac4f35b017df2d22e2f25d92c068cc0ae611d7a540c1eab189a5ae8f2b56b806ee58f1f1e3d
|
7
|
+
data.tar.gz: ca4061e657d63405810c690aa36f2f98565d26bfe248dcac6389d151a62fb877d8e785722de03e0f8e6714932ccd7b5cde457d7e6757b639f6e36755ec985ac0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rest-ftp-daemon (0.
|
4
|
+
rest-ftp-daemon (0.300.1)
|
5
|
+
chamber
|
5
6
|
double-bag-ftps
|
6
7
|
facter
|
7
8
|
get_process_mem
|
@@ -13,7 +14,7 @@ PATH
|
|
13
14
|
newrelic_rpm
|
14
15
|
settingslogic
|
15
16
|
sys-cpu
|
16
|
-
thin (~> 1
|
17
|
+
thin (~> 1)
|
17
18
|
|
18
19
|
GEM
|
19
20
|
remote: http://rubygems.org/
|
@@ -26,7 +27,7 @@ GEM
|
|
26
27
|
thread_safe (~> 0.3, >= 0.3.4)
|
27
28
|
tzinfo (~> 1.1)
|
28
29
|
addressable (2.4.0)
|
29
|
-
ast (2.
|
30
|
+
ast (2.3.0)
|
30
31
|
astrolabe (1.3.1)
|
31
32
|
parser (~> 2.2)
|
32
33
|
axiom-types (0.1.1)
|
@@ -34,6 +35,9 @@ GEM
|
|
34
35
|
ice_nine (~> 0.11.0)
|
35
36
|
thread_safe (~> 0.3, >= 0.3.1)
|
36
37
|
builder (3.2.2)
|
38
|
+
chamber (2.9.0)
|
39
|
+
hashie (~> 3.3)
|
40
|
+
thor (~> 0.19.1)
|
37
41
|
coderay (1.1.1)
|
38
42
|
coercible (1.0.0)
|
39
43
|
descendants_tracker (~> 0.0.1)
|
@@ -41,7 +45,7 @@ GEM
|
|
41
45
|
descendants_tracker (0.0.4)
|
42
46
|
thread_safe (~> 0.3, >= 0.3.1)
|
43
47
|
diff-lcs (1.2.5)
|
44
|
-
domain_name (0.5.
|
48
|
+
domain_name (0.5.20160615)
|
45
49
|
unf (>= 0.0.5, < 1.0.0)
|
46
50
|
double-bag-ftps (0.1.2)
|
47
51
|
enumerable-lazy (0.0.1)
|
@@ -50,7 +54,7 @@ GEM
|
|
50
54
|
facter (2.4.6)
|
51
55
|
CFPropertyList (~> 2.2.6)
|
52
56
|
ffi (1.9.10)
|
53
|
-
get_process_mem (0.2.
|
57
|
+
get_process_mem (0.2.1)
|
54
58
|
grape (0.16.2)
|
55
59
|
activesupport
|
56
60
|
builder
|
@@ -67,7 +71,7 @@ GEM
|
|
67
71
|
haml (4.0.7)
|
68
72
|
tilt
|
69
73
|
hashie (3.4.4)
|
70
|
-
http (0.
|
74
|
+
http (2.0.1)
|
71
75
|
addressable (~> 2.3)
|
72
76
|
http-cookie (~> 1.0)
|
73
77
|
http-form_data (~> 1.0.1)
|
@@ -83,13 +87,13 @@ GEM
|
|
83
87
|
minitest (5.9.0)
|
84
88
|
multi_json (1.12.1)
|
85
89
|
multi_xml (0.5.5)
|
86
|
-
mustermann19 (0.4.
|
90
|
+
mustermann19 (0.4.4)
|
87
91
|
enumerable-lazy
|
88
92
|
net-sftp (2.1.2)
|
89
93
|
net-ssh (>= 2.6.5)
|
90
|
-
net-ssh (3.
|
94
|
+
net-ssh (3.2.0)
|
91
95
|
newrelic_rpm (3.15.2.317)
|
92
|
-
parser (2.3.1.
|
96
|
+
parser (2.3.1.2)
|
93
97
|
ast (~> 2.2)
|
94
98
|
powerpack (0.1.1)
|
95
99
|
pry (0.10.3)
|
@@ -100,7 +104,7 @@ GEM
|
|
100
104
|
rack-accept (0.4.5)
|
101
105
|
rack (>= 0.4)
|
102
106
|
rainbow (2.1.0)
|
103
|
-
rake (11.
|
107
|
+
rake (11.2.2)
|
104
108
|
rspec (3.4.0)
|
105
109
|
rspec-core (~> 3.4.0)
|
106
110
|
rspec-expectations (~> 3.4.0)
|
@@ -125,12 +129,13 @@ GEM
|
|
125
129
|
slop (3.6.0)
|
126
130
|
sys-cpu (0.7.2)
|
127
131
|
ffi
|
128
|
-
thin (1.
|
132
|
+
thin (1.7.0)
|
129
133
|
daemons (~> 1.0, >= 1.0.9)
|
130
134
|
eventmachine (~> 1.0, >= 1.0.4)
|
131
|
-
rack (
|
135
|
+
rack (>= 1, < 3)
|
136
|
+
thor (0.19.1)
|
132
137
|
thread_safe (0.3.5)
|
133
|
-
tilt (2.0.
|
138
|
+
tilt (2.0.5)
|
134
139
|
tzinfo (1.2.2)
|
135
140
|
thread_safe (~> 0.1)
|
136
141
|
unf (0.1.4)
|
@@ -147,7 +152,7 @@ PLATFORMS
|
|
147
152
|
|
148
153
|
DEPENDENCIES
|
149
154
|
bundler (~> 1.6)
|
150
|
-
http
|
155
|
+
http
|
151
156
|
pry
|
152
157
|
rake
|
153
158
|
rest-ftp-daemon!
|
data/README.md
CHANGED
@@ -40,10 +40,10 @@ Features
|
|
40
40
|
* Realtime status reporting
|
41
41
|
* realtime transfer status reporting, with progress and errors
|
42
42
|
* periodic update notifications sent along with transfer status and progress to an arbitrary URL (JSON resource POSTed)
|
43
|
+
* metrics about pools, throughtput, and queues output to NewRelic
|
43
44
|
|
44
45
|
|
45
|
-
|
46
|
-
Status
|
46
|
+
Project status
|
47
47
|
------------------------------------------------------------------------------------
|
48
48
|
|
49
49
|
Though it may need more robust tests, this gem has been used successfully in production for
|
@@ -185,6 +185,13 @@ As a starting point, `rest-ftp-daemon.yml.sample` is an example config file that
|
|
185
185
|
Default administrator credentials are `admin/admin`. Please change the password in this configuration file before starting any kind of production.
|
186
186
|
|
187
187
|
|
188
|
+
Metrics
|
189
|
+
------------------------------------------------------------------------------------
|
190
|
+
|
191
|
+
[FIXME]
|
192
|
+
|
193
|
+
|
194
|
+
|
188
195
|
Logging
|
189
196
|
------------------------------------------------------------------------------------
|
190
197
|
|
@@ -272,7 +279,9 @@ Update RubyGems and install the gem from rubygems.org
|
|
272
279
|
Known bugs
|
273
280
|
------------------------------------------------------------------------------------
|
274
281
|
|
275
|
-
* As this project is based on
|
282
|
+
* As this project is based on the Psyck YAML parser, configuration merge from "defaults" section and environment-specific section are broken. A sub-tree defined for a specific environment, will overwrite the corresponding subtree from "defaults". Please repeat whole sections from "defaults".
|
283
|
+
|
284
|
+
* As this project is based on Chamber, and it considers hyphens in filename as namespaces, the global /etc/rest-ftp-daemon.yml config file is not parsed (and thus, ignored). Until this is worked around, please specify a config filename on the commandline.
|
276
285
|
|
277
286
|
* If you get ```fatal error: 'openssl/ssl.h' file not found when installing ```eventmachine``` on OSX El Capitan, you can try with:
|
278
287
|
```
|
data/bin/rest-ftp-daemon
CHANGED
@@ -2,122 +2,128 @@
|
|
2
2
|
|
3
3
|
# Try to load external libs, helpers and constants
|
4
4
|
begin
|
5
|
-
require "
|
5
|
+
require "rubygems"
|
6
6
|
require "optparse"
|
7
|
+
require "thin"
|
7
8
|
require "socket"
|
8
|
-
|
9
|
-
|
10
|
-
rescue LoadError
|
11
|
-
raise "EXITING: some
|
9
|
+
require_relative "../lib/rest-ftp-daemon/launcher"
|
10
|
+
require_relative "../lib/shared/conf"
|
11
|
+
rescue LoadError => e
|
12
|
+
raise "EXITING: some basic libs were not found (#{e.message})"
|
12
13
|
end
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
puts
|
14
|
+
include Shared
|
15
|
+
include RestFtpDaemon
|
17
16
|
|
18
17
|
|
19
|
-
#
|
20
|
-
options = {}
|
21
|
-
parser = OptionParser.new do |opts|
|
22
|
-
opts.banner = "Usage: #{File.basename $PROGRAM_NAME} [options] start|stop"
|
23
|
-
opts.on("-c", "--config CONFIGFILE") { |config| APP_CONF = config }
|
24
|
-
opts.on("-e", "--environment ENV") { |env| APP_ENV = env }
|
25
|
-
opts.on("", "--dev") { APP_ENV = "development" }
|
26
|
-
opts.on("-p", "--port PORT", "use PORT") { |port| options["port"] = port.to_i }
|
27
|
-
opts.on("-d", "--daemonize", "Run daemonized in the background") { options["daemonize"] = true }
|
28
|
-
opts.on("-f", "--foreground", "Run in the foreground") { options["daemonize"] = false }
|
29
|
-
opts.on("-P", "--pid FILE", "File to store PID") { |file| options["pidfile"] = file }
|
30
|
-
opts.on("-u", "--user NAME", "User to run daemon as (use with -g)") { |user| options["user"] = user }
|
31
|
-
opts.on("-g", "--group NAME", "Group to run daemon as (use with -u)") { |group| options["group"] = group }
|
32
|
-
|
33
|
-
opts.separator ""
|
34
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
35
|
-
puts opts
|
36
|
-
puts TAIL_MESSAGE unless File.exist?(DEFAULT_CONFIG_PATH)
|
37
|
-
exit
|
38
|
-
end
|
39
|
-
opts.on_tail("-v", "--version", "Show version (#{APP_VER})") { puts(APP_VER) && exit }
|
40
|
-
end
|
41
|
-
|
42
|
-
# Parse options and check compliance
|
18
|
+
# Handle configuration
|
43
19
|
begin
|
44
|
-
|
20
|
+
# Defaults
|
21
|
+
cmd_config = nil
|
22
|
+
cmd_pidfile = nil
|
23
|
+
cmd_port = nil
|
24
|
+
cmd_user = nil
|
25
|
+
cmd_group = nil
|
26
|
+
cmd_daemonize = nil
|
27
|
+
|
28
|
+
# Init Chamber-based configuration from Gemspec
|
29
|
+
Conf.init File.dirname(__FILE__) + "/../"
|
30
|
+
|
31
|
+
# Parse options and check compliance
|
32
|
+
thinopts = {}
|
33
|
+
parser = OptionParser.new do |opts|
|
34
|
+
opts.banner = "Usage: #{File.basename $PROGRAM_NAME} [options] start|stop"
|
35
|
+
opts.on("-c", "--config CONFIGFILE") { |value| cmd_config = File.expand_path(value)}
|
36
|
+
opts.on("-e", "--environment ENV") { |value| Conf.app_env = value }
|
37
|
+
opts.on("", "--dev") { Conf.app_env = "development" }
|
38
|
+
opts.on("-p", "--port PORT", "use PORT") { |value| cmd_port = value.to_i }
|
39
|
+
opts.on("-d", "--daemonize", "Run daemonized in the background") { cmd_daemonize = true }
|
40
|
+
opts.on("-f", "--foreground", "Run in the foreground") { cmd_daemonize = false }
|
41
|
+
opts.on("-P", "--pid FILE", "File to store PID") { |value| cmd_pidfile = value }
|
42
|
+
opts.on("-u", "--user NAME", "User to run daemon as (use with -g)") { |value| cmd_user = value }
|
43
|
+
opts.on("-g", "--group NAME", "Group to run daemon as (use with -u)") { |value| cmd_group = value }
|
44
|
+
|
45
|
+
opts.separator ""
|
46
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
47
|
+
puts opts
|
48
|
+
puts Conf.gen_config_message unless File.exist?(Conf.gen_config_etc)
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
opts.on_tail("-v", "--version", "Show version (#{Conf.app_ver})") { puts(Conf.app_ver) && exit }
|
52
|
+
|
53
|
+
end.order!(ARGV)
|
54
|
+
|
55
|
+
# Load Chamber-based configuration
|
56
|
+
Conf.prepare config: cmd_config, logfile: nil
|
57
|
+
|
58
|
+
# Extract command from command line
|
45
59
|
command = ARGV.shift
|
60
|
+
|
46
61
|
rescue OptionParser::InvalidOption => e
|
47
|
-
abort "EXITING:
|
62
|
+
abort "EXITING: InvalidOption: #{e.message} \n #{e.backtrace.to_yaml}"
|
63
|
+
rescue ConfigParseError => e
|
64
|
+
abort "EXITING: ConfigParseError: #{e.message} \n #{e.backtrace.to_yaml}"
|
65
|
+
rescue StandardError => e
|
66
|
+
abort "EXITING: StandardError: #{e.message} \n #{e.backtrace.to_yaml}"
|
48
67
|
else
|
49
68
|
abort parser.to_s unless ["start", "stop"].include? command
|
50
69
|
end
|
51
70
|
|
52
71
|
|
53
|
-
# Load config, and merge options from ARGV into settings
|
54
|
-
# FIXME: file configuration detection could reside in settings.rb
|
55
|
-
APP_CONF ||= DEFAULT_CONFIG_PATH
|
56
|
-
APP_ENV ||= ENV_PRODUCTION
|
57
|
-
abort "EXITING: cannot read configuration file: #{APP_CONF}" unless File.exist? APP_CONF
|
58
|
-
begin
|
59
|
-
# Import settings
|
60
|
-
# require File.expand_path("#{app_root}/lib/rest-ftp-daemon/settings")
|
61
|
-
require_relative "../lib/rest-ftp-daemon/settings"
|
62
|
-
|
63
|
-
# Set defaults
|
64
|
-
Settings.init_defaults
|
65
|
-
|
66
|
-
# Overwrite with commandline options
|
67
|
-
Settings.merge!(options)
|
68
|
-
|
69
|
-
# Init NewRelic
|
70
|
-
Settings.init_newrelic
|
71
|
-
|
72
|
-
rescue Psych::SyntaxError => e
|
73
|
-
abort "EXITING: config file syntax error: #{e.message}"
|
74
|
-
rescue StandardError => e
|
75
|
-
abort "EXITING: unknow error loading settings #{e.inspect}"
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
72
|
# Validate network configuration
|
80
73
|
if command == "start"
|
81
|
-
if !
|
74
|
+
if !Conf[:port]
|
82
75
|
abort "ABORTING: Network port is missing"
|
83
|
-
elsif
|
84
|
-
abort "ABORTING: Network port #{
|
76
|
+
elsif Launcher.local_port_used? Conf[:port]
|
77
|
+
abort "ABORTING: Network port #{Conf[:port]} is already in use"
|
85
78
|
end
|
86
79
|
end
|
87
80
|
|
88
81
|
|
89
|
-
#
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
argv << ["--daemonize"] if [1, true].include? Settings.daemonize
|
82
|
+
# Thin: override with cmdline then defaults
|
83
|
+
Conf[:daemonize] = cmd_daemonize unless cmd_daemonize.nil?
|
84
|
+
Conf[:port] = cmd_port unless cmd_port.nil?
|
85
|
+
Conf[:user] = cmd_user unless cmd_user.nil?
|
86
|
+
Conf[:group] = cmd_group unless cmd_group.nil?
|
87
|
+
Conf[:pidfile] = cmd_pidfile unless cmd_pidfile.nil?
|
96
88
|
|
89
|
+
Conf[:pidfile] ||= Conf.gen_pidfile
|
97
90
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
91
|
+
|
92
|
+
# Thin: basic options
|
93
|
+
thin_logfile = Conf.at(:logs, :thin)
|
94
|
+
argv = []
|
95
|
+
argv << ["-e", Conf.app_env]
|
96
|
+
argv << ["-p", Conf[:port].to_s]
|
97
|
+
argv << ["--pid", Conf[:pidfile].to_s]
|
98
|
+
argv << ["--tag", "#{Conf.app_name}/#{Conf.app_env}"]
|
99
|
+
argv << ["--daemonize"] if ([1, true].include? Conf[:daemonize])
|
100
|
+
argv << ["--log", thin_logfile] if thin_logfile
|
101
|
+
|
102
|
+
# Thin: user and group
|
103
|
+
if Conf[:user] && Conf[:group]
|
104
|
+
argv << ["--user", Conf[:user].to_s]
|
105
|
+
argv << ["--group", Conf[:group].to_s]
|
105
106
|
end
|
107
|
+
|
108
|
+
# Thin: command
|
106
109
|
argv << command unless command.nil?
|
107
110
|
|
108
111
|
|
109
|
-
# Display final configuration
|
110
|
-
puts "--- #{
|
111
|
-
puts "
|
112
|
-
puts "
|
113
|
-
puts "
|
114
|
-
puts "
|
115
|
-
puts "
|
116
|
-
puts
|
117
|
-
puts "
|
118
|
-
puts "
|
119
|
-
puts "
|
120
|
-
#
|
112
|
+
# Display final configuration, quit if config dump requested
|
113
|
+
puts "--- #{Conf.app_name} #{Conf.app_ver}"
|
114
|
+
puts "Environment \t #{Conf.app_env}"
|
115
|
+
puts "Config files \t #{Conf.files}"
|
116
|
+
puts "Started at \t #{Conf.app_started}"
|
117
|
+
puts "Loging to file \t #{Conf[:log][:file]}" if Conf[:log].is_a? Enumerable
|
118
|
+
puts "Host \t #{Conf.host}"
|
119
|
+
puts
|
120
|
+
puts "Daemonize \t #{Conf[:daemonize]}"
|
121
|
+
puts "Network port \t #{Conf[:port]}"
|
122
|
+
puts "User:group \t #{Conf[:user]}:#{Conf[:group]}" if Conf[:user] && Conf[:group]
|
123
|
+
puts "Newrelic \t #{Conf.newrelic_enabled? ? Conf.at(:newrelic, :licence) : "no"}"
|
124
|
+
puts "PID file \t #{Conf[:pidfile]}"
|
125
|
+
puts
|
126
|
+
puts Conf.dump
|
121
127
|
puts
|
122
128
|
puts "--- Thin ARGV"
|
123
129
|
puts argv.flatten.join(" ")
|
@@ -126,8 +132,7 @@ puts
|
|
126
132
|
|
127
133
|
# Start Thin with this rackup configuration, changing to app_root first
|
128
134
|
begin
|
129
|
-
|
130
|
-
Dir.chdir app_root
|
135
|
+
Dir.chdir Conf.app_root
|
131
136
|
Thin::Runner.new(argv.flatten).run!
|
132
137
|
rescue RuntimeError => e
|
133
138
|
puts "FAILED: RuntimeError: #{e.message}"
|
@@ -137,18 +142,19 @@ rescue Thin::PidFileNotFound
|
|
137
142
|
puts "FAILED: daemon was not running (Thin::PidFileNotFound)"
|
138
143
|
rescue Errno::ENOENT => e
|
139
144
|
puts "FAILED: daemon cannot access files: #{e.message}"
|
145
|
+
rescue ArgumentError => e
|
146
|
+
puts "FAILED: argument error: #{e.message}"
|
140
147
|
rescue SystemExit
|
141
148
|
# Leave some time for the daemon to launch
|
142
|
-
|
143
|
-
|
144
|
-
until File.file?(pidfile) do
|
149
|
+
print "Waiting for pidfile "
|
150
|
+
until File.file?(Conf[:pidfile]) do
|
145
151
|
print "."
|
146
152
|
sleep 0.25
|
147
153
|
end
|
148
154
|
puts
|
149
155
|
|
150
156
|
# Check that this process is running
|
151
|
-
pid = File.read(pidfile).to_i
|
157
|
+
pid = File.read(Conf[:pidfile]).to_i
|
152
158
|
begin
|
153
159
|
Process.kill(0, pid)
|
154
160
|
puts "Process ##{pid} is running"
|
data/config.ru
CHANGED
@@ -13,20 +13,20 @@ $counters = RestFtpDaemon::Counters.new
|
|
13
13
|
$pool = RestFtpDaemon::WorkerPool.new
|
14
14
|
|
15
15
|
# Rack authent
|
16
|
-
unless
|
16
|
+
unless Conf[:adminpwd].nil?
|
17
17
|
use Rack::Auth::Basic, "Restricted Area" do |username, password|
|
18
|
-
[username, password] == ["admin",
|
18
|
+
[username, password] == ["admin", Conf[:adminpwd]]
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
# NewRelic profiling
|
23
|
-
GC::Profiler.enable if
|
23
|
+
# GC::Profiler.enable if Conf.newrelic_enabled?
|
24
24
|
|
25
25
|
# Serve static assets
|
26
|
-
use Rack::Static, urls: ["/css", "/js", "/images"], root: "#{
|
26
|
+
use Rack::Static, urls: ["/css", "/js", "/images"], root: "#{Conf.app_libs}/static/"
|
27
27
|
|
28
28
|
# Rack reloader and mini-profiler
|
29
|
-
unless
|
29
|
+
unless Conf.app_env == "production"
|
30
30
|
# use Rack::Reloader, 1
|
31
31
|
# use Rack::MiniProfiler
|
32
32
|
end
|
data/defaults.yml
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
daemonize: true
|
2
|
+
port: 3000
|
3
|
+
nick: rftpd
|
4
|
+
user: rftpd
|
5
|
+
# group: rftpd
|
6
|
+
# host: "myhost"
|
7
|
+
|
8
|
+
pools:
|
9
|
+
default: 2
|
10
|
+
|
11
|
+
transfer:
|
12
|
+
# notify_after_sec: 5 # wait at least X seconds between HTTP notifications
|
13
|
+
# mkdir: true # build directory tree if missing
|
14
|
+
# tempfile: true # transfer to temporary file, rename after sucessful transfer
|
15
|
+
# overwrite: false # overwrite any target file with the same name
|
16
|
+
timeout: 1800 # jobs running for longer than X seconds will be killed
|
17
|
+
|
18
|
+
retry:
|
19
|
+
# on_errors:
|
20
|
+
# - ftp_perm_error
|
21
|
+
# - net_temp_error
|
22
|
+
# - conn_reset_by_peer
|
23
|
+
# - conn_timed_out
|
24
|
+
# - conn_refused
|
25
|
+
# - sftp_auth_failed
|
26
|
+
# - conn_host_is_down
|
27
|
+
# - conn_unreachable
|
28
|
+
# - conn_failed
|
29
|
+
# - conn_openssl_error
|
30
|
+
# max_runs: 5
|
31
|
+
# max_age: 1800
|
32
|
+
# delay: 10
|
33
|
+
|
34
|
+
conchita:
|
35
|
+
# timer: 60
|
36
|
+
# garbage_collector: true
|
37
|
+
# clean_failed: 3600
|
38
|
+
# clean_finished: 3600
|
39
|
+
# clean_queued: 86400
|
40
|
+
|
41
|
+
newrelic:
|
42
|
+
# licence: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
43
|
+
prefix: "rftpd" # app prefix
|
44
|
+
# platform: "bigbusiness" # app platform name
|
45
|
+
# app_name: "rftpd-bigbusiness-dev" # nickname used for naming app
|
46
|
+
|
47
|
+
debug:
|
48
|
+
ftp: false
|
49
|
+
sftp: false
|
50
|
+
conchita: false
|
51
|
+
reporter: fakse
|
52
|
+
allow_reload: false
|
53
|
+
|
54
|
+
logs:
|
55
|
+
thin: "/var/log/rftpd-environment-thin.log"
|
56
|
+
queue: "/var/log/rftpd-environment-core.log"
|
57
|
+
api: "/var/log/rftpd-environment-core.log"
|
58
|
+
workers: "/var/log/rftpd-environment-work.log"
|
59
|
+
jobs: "/var/log/rftpd-environment-work.log"
|
60
|
+
notify: "/var/log/rftpd-environment-work.log"
|
61
|
+
newrelic: "/var/log/rftpd-environment-newrelic.log"
|