unicorn 4.7.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +0 -1
- data/.gitattributes +5 -0
- data/.gitignore +2 -2
- data/.manifest +14 -21
- data/.olddoc.yml +22 -0
- data/Application_Timeouts +7 -7
- data/DESIGN +2 -4
- data/Documentation/.gitignore +1 -3
- data/Documentation/unicorn.1 +222 -0
- data/Documentation/unicorn_rails.1 +207 -0
- data/FAQ +23 -6
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +139 -92
- data/HACKING +13 -28
- data/ISSUES +82 -19
- data/KNOWN_ISSUES +18 -18
- data/LATEST +22 -44
- data/LICENSE +2 -2
- data/Links +24 -22
- data/NEWS +729 -0
- data/PHILOSOPHY +0 -6
- data/README +50 -48
- data/Rakefile +0 -44
- data/SIGNALS +12 -3
- data/Sandbox +11 -10
- data/TODO +0 -2
- data/TUNING +30 -9
- data/archive/.gitignore +3 -0
- data/archive/slrnpull.conf +4 -0
- data/bin/unicorn +4 -2
- data/bin/unicorn_rails +3 -3
- data/examples/big_app_gc.rb +1 -1
- data/examples/init.sh +36 -8
- data/examples/logrotate.conf +17 -2
- data/examples/nginx.conf +14 -14
- data/examples/unicorn.conf.minimal.rb +2 -2
- data/examples/unicorn.conf.rb +14 -6
- data/examples/unicorn.socket +11 -0
- data/examples/unicorn@.service +40 -0
- data/ext/unicorn_http/common_field_optimization.h +23 -5
- data/ext/unicorn_http/ext_help.h +0 -20
- data/ext/unicorn_http/extconf.rb +37 -1
- data/ext/unicorn_http/global_variables.h +1 -1
- data/ext/unicorn_http/httpdate.c +2 -2
- data/ext/unicorn_http/unicorn_http.c +940 -644
- data/ext/unicorn_http/unicorn_http.rl +167 -170
- data/ext/unicorn_http/unicorn_http_common.rl +1 -1
- data/lib/unicorn/configurator.rb +110 -46
- data/lib/unicorn/const.rb +2 -25
- data/lib/unicorn/http_request.rb +110 -31
- data/lib/unicorn/http_response.rb +17 -31
- data/lib/unicorn/http_server.rb +292 -199
- data/lib/unicorn/launcher.rb +1 -1
- data/lib/unicorn/oob_gc.rb +16 -6
- data/lib/unicorn/socket_helper.rb +58 -78
- data/lib/unicorn/stream_input.rb +9 -11
- data/lib/unicorn/tee_input.rb +16 -11
- data/lib/unicorn/tmpio.rb +10 -6
- data/lib/unicorn/util.rb +5 -4
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn/worker.rb +99 -22
- data/lib/unicorn.rb +69 -42
- data/man/man1/unicorn.1 +124 -122
- data/man/man1/unicorn_rails.1 +113 -127
- data/t/.gitignore +0 -1
- data/t/GNUmakefile +3 -80
- data/t/README +4 -4
- data/t/t0002-parser-error.sh +3 -3
- data/t/t0011-active-unix-socket.sh +1 -1
- data/t/t0012-reload-empty-config.sh +2 -1
- data/t/t0300-no-default-middleware.sh +6 -1
- data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
- data/t/t0301.ru +13 -0
- data/t/test-lib.sh +2 -2
- data/test/benchmark/README +14 -4
- data/test/benchmark/ddstream.ru +50 -0
- data/test/benchmark/readinput.ru +40 -0
- data/test/benchmark/uconnect.perl +66 -0
- data/test/exec/test_exec.rb +74 -20
- data/test/test_helper.rb +42 -33
- data/test/unit/test_ccc.rb +91 -0
- data/test/unit/test_droplet.rb +1 -1
- data/test/unit/test_http_parser.rb +49 -19
- data/test/unit/test_http_parser_ng.rb +98 -115
- data/test/unit/test_request.rb +11 -11
- data/test/unit/test_response.rb +31 -19
- data/test/unit/test_server.rb +89 -15
- data/test/unit/test_signals.rb +9 -9
- data/test/unit/test_socket_helper.rb +20 -14
- data/test/unit/test_tee_input.rb +10 -0
- data/test/unit/test_upload.rb +10 -15
- data/test/unit/test_util.rb +28 -3
- data/unicorn.gemspec +28 -23
- data/unicorn_1 +1 -0
- data/unicorn_rails_1 +1 -0
- metadata +64 -134
- data/.wrongdoc.yml +0 -10
- data/ChangeLog +0 -4694
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -178
- data/Documentation/unicorn_rails.1.txt +0 -175
- data/examples/git.ru +0 -13
- data/lib/unicorn/app/exec_cgi.rb +0 -154
- data/lib/unicorn/app/inetd.rb +0 -109
- data/lib/unicorn/ssl_client.rb +0 -11
- data/lib/unicorn/ssl_configurator.rb +0 -104
- data/lib/unicorn/ssl_server.rb +0 -42
- data/local.mk.sample +0 -59
- data/script/isolate_for_tests +0 -32
- data/t/hijack.ru +0 -42
- data/t/sslgen.sh +0 -71
- data/t/t0016-trust-x-forwarded-false.sh +0 -30
- data/t/t0017-trust-x-forwarded-true.sh +0 -30
- data/t/t0200-rack-hijack.sh +0 -27
- data/t/t0600-https-server-basic.sh +0 -48
- data/test/unit/test_http_parser_xftrust.rb +0 -38
- data/test/unit/test_sni_hostnames.rb +0 -47
data/lib/unicorn.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
-
require 'fcntl'
|
3
2
|
require 'etc'
|
4
3
|
require 'stringio'
|
5
|
-
require 'rack'
|
6
4
|
require 'kgio'
|
5
|
+
require 'raindrops'
|
6
|
+
require 'io/wait'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'rack'
|
10
|
+
rescue LoadError
|
11
|
+
warn 'rack not available, functionality reduced'
|
12
|
+
end
|
7
13
|
|
8
14
|
# :stopdoc:
|
9
15
|
# Unicorn module containing all of the classes (include C extensions) for
|
@@ -11,19 +17,20 @@ require 'kgio'
|
|
11
17
|
# enough functionality to service web application requests fast as possible.
|
12
18
|
# :startdoc:
|
13
19
|
|
14
|
-
#
|
15
|
-
# internals are subject to change.
|
20
|
+
# unicorn exposes very little of an user-visible API and most of its
|
21
|
+
# internals are subject to change. unicorn is designed to host Rack
|
16
22
|
# applications, so applications should be written against the Rack SPEC
|
17
|
-
# and not
|
23
|
+
# and not unicorn internals.
|
18
24
|
module Unicorn
|
19
25
|
|
20
26
|
# Raised inside TeeInput when a client closes the socket inside the
|
21
27
|
# application dispatch. This is always raised with an empty backtrace
|
22
28
|
# since there is nothing in the application stack that is responsible
|
23
29
|
# for client shutdowns/disconnects. This exception is visible to Rack
|
24
|
-
# applications unless PrereadInput middleware is loaded.
|
25
|
-
class
|
26
|
-
|
30
|
+
# applications unless PrereadInput middleware is loaded. This
|
31
|
+
# is a subclass of the standard EOFError class and applications should
|
32
|
+
# not rescue it explicitly, but rescue EOFError instead.
|
33
|
+
ClientShutdown = Class.new(EOFError)
|
27
34
|
|
28
35
|
# :stopdoc:
|
29
36
|
|
@@ -34,13 +41,12 @@ module Unicorn
|
|
34
41
|
def self.builder(ru, op)
|
35
42
|
# allow Configurator to parse cli switches embedded in the ru file
|
36
43
|
op = Unicorn::Configurator::RACKUP.merge!(:file => ru, :optparse => op)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
no_default_middleware = op[:no_default_middleware]
|
44
|
+
if ru =~ /\.ru$/ && !defined?(Rack::Builder)
|
45
|
+
abort "rack and Rack::Builder must be available for processing #{ru}"
|
46
|
+
end
|
41
47
|
|
42
48
|
# always called after config file parsing, may be called after forking
|
43
|
-
lambda do
|
49
|
+
lambda do |_, server|
|
44
50
|
inner_app = case ru
|
45
51
|
when /\.ru$/
|
46
52
|
raw = File.read(ru)
|
@@ -51,9 +57,21 @@ module Unicorn
|
|
51
57
|
Object.const_get(File.basename(ru, '.rb').capitalize)
|
52
58
|
end
|
53
59
|
|
54
|
-
|
60
|
+
if $DEBUG
|
61
|
+
require 'pp'
|
62
|
+
pp({ :inner_app => inner_app })
|
63
|
+
end
|
64
|
+
|
65
|
+
return inner_app unless server.default_middleware
|
55
66
|
|
56
|
-
|
67
|
+
middleware = { # order matters
|
68
|
+
ContentLength: nil,
|
69
|
+
Chunked: nil,
|
70
|
+
CommonLogger: [ $stderr ],
|
71
|
+
ShowExceptions: nil,
|
72
|
+
Lint: nil,
|
73
|
+
TempfileReaper: nil,
|
74
|
+
}
|
57
75
|
|
58
76
|
# return value, matches rackup defaults based on env
|
59
77
|
# Unicorn does not support persistent connections, but Rainbows!
|
@@ -61,30 +79,24 @@ module Unicorn
|
|
61
79
|
# middlewares will need ContentLength/Chunked middlewares.
|
62
80
|
case ENV["RACK_ENV"]
|
63
81
|
when "development"
|
64
|
-
Rack::Builder.new do
|
65
|
-
use Rack::ContentLength
|
66
|
-
use Rack::Chunked
|
67
|
-
use Rack::CommonLogger, $stderr
|
68
|
-
use Rack::ShowExceptions
|
69
|
-
use Rack::Lint
|
70
|
-
run inner_app
|
71
|
-
end.to_app
|
72
82
|
when "deployment"
|
73
|
-
|
74
|
-
|
75
|
-
use Rack::Chunked
|
76
|
-
use Rack::CommonLogger, $stderr
|
77
|
-
run inner_app
|
78
|
-
end.to_app
|
83
|
+
middleware.delete(:ShowExceptions)
|
84
|
+
middleware.delete(:Lint)
|
79
85
|
else
|
80
|
-
inner_app
|
86
|
+
return inner_app
|
81
87
|
end
|
88
|
+
Rack::Builder.new do
|
89
|
+
middleware.each do |m, args|
|
90
|
+
use(Rack.const_get(m), *args) if Rack.const_defined?(m)
|
91
|
+
end
|
92
|
+
run inner_app
|
93
|
+
end.to_app
|
82
94
|
end
|
83
95
|
end
|
84
96
|
|
85
97
|
# returns an array of strings representing TCP listen socket addresses
|
86
98
|
# and Unix domain socket paths. This is useful for use with
|
87
|
-
# Raindrops::Middleware under Linux:
|
99
|
+
# Raindrops::Middleware under Linux: https://yhbt.net/raindrops/
|
88
100
|
def self.listener_names
|
89
101
|
Unicorn::HttpServer::LISTENERS.map do |io|
|
90
102
|
Unicorn::SocketHelper.sock_name(io)
|
@@ -97,17 +109,32 @@ module Unicorn
|
|
97
109
|
logger.error "#{prefix}: #{message} (#{exc.class})"
|
98
110
|
exc.backtrace.each { |line| logger.error(line) }
|
99
111
|
end
|
112
|
+
|
113
|
+
F_SETPIPE_SZ = 1031 if RUBY_PLATFORM =~ /linux/
|
114
|
+
|
115
|
+
def self.pipe # :nodoc:
|
116
|
+
Kgio::Pipe.new.each do |io|
|
117
|
+
io.close_on_exec = true # remove this when we only support Ruby >= 2.0
|
118
|
+
|
119
|
+
# shrink pipes to minimize impact on /proc/sys/fs/pipe-user-pages-soft
|
120
|
+
# limits.
|
121
|
+
if defined?(F_SETPIPE_SZ)
|
122
|
+
begin
|
123
|
+
io.fcntl(F_SETPIPE_SZ, Raindrops::PAGE_SIZE)
|
124
|
+
rescue Errno::EINVAL
|
125
|
+
# old kernel
|
126
|
+
rescue Errno::EPERM
|
127
|
+
# resizes fail if Linux is close to the pipe limit for the user
|
128
|
+
# or if the user does not have permissions to resize
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
100
133
|
# :startdoc:
|
101
134
|
end
|
102
135
|
# :enddoc:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
require 'unicorn/configurator'
|
109
|
-
require 'unicorn/tmpio'
|
110
|
-
require 'unicorn/util'
|
111
|
-
require 'unicorn/http_response'
|
112
|
-
require 'unicorn/worker'
|
113
|
-
require 'unicorn/http_server'
|
136
|
+
|
137
|
+
%w(const socket_helper stream_input tee_input http_request configurator
|
138
|
+
tmpio util http_response worker http_server).each do |s|
|
139
|
+
require_relative "unicorn/#{s}"
|
140
|
+
end
|
data/man/man1/unicorn.1
CHANGED
@@ -1,220 +1,222 @@
|
|
1
|
-
.TH UNICORN 1 "September 15, 2009" "Unicorn User Manual"
|
1
|
+
.TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
|
2
|
+
.hy
|
2
3
|
.SH NAME
|
3
4
|
.PP
|
4
|
-
unicorn
|
5
|
+
unicorn \- a rackup\-like command to launch the Unicorn HTTP server
|
5
6
|
.SH SYNOPSIS
|
6
7
|
.PP
|
7
|
-
unicorn [
|
8
|
+
unicorn [\-c CONFIG_FILE] [\-E RACK_ENV] [\-D] [RACKUP_FILE]
|
8
9
|
.SH DESCRIPTION
|
9
10
|
.PP
|
10
|
-
A rackup(1)
|
11
|
+
A rackup(1)\-like command to launch Rack applications using Unicorn.
|
11
12
|
It is expected to be started in your application root (APP_ROOT),
|
12
|
-
but the
|
13
|
-
CONFIG_FILE.
|
13
|
+
but the "working_directory" directive may be used in the CONFIG_FILE.
|
14
14
|
.PP
|
15
|
-
While unicorn takes a myriad of command
|
16
|
-
compatibility with ruby(1) and rackup(1), it is recommended to
|
17
|
-
|
18
|
-
|
15
|
+
While unicorn takes a myriad of command\-line options for
|
16
|
+
compatibility with ruby(1) and rackup(1), it is recommended to stick
|
17
|
+
to the few command\-line options specified in the SYNOPSIS and use
|
18
|
+
the CONFIG_FILE as much as possible.
|
19
19
|
.SH RACKUP FILE
|
20
20
|
.PP
|
21
|
-
This defaults to "config.ru" in APP_ROOT.
|
22
|
-
|
23
|
-
|
21
|
+
This defaults to "config.ru" in APP_ROOT. It should be the same
|
22
|
+
file used by rackup(1) and other Rack launchers, it uses the
|
23
|
+
\f[I]Rack::Builder\f[] DSL.
|
24
24
|
.PP
|
25
|
-
Embedded command
|
25
|
+
Embedded command\-line options are mostly parsed for compatibility
|
26
26
|
with rackup(1) but strongly discouraged.
|
27
27
|
.SH UNICORN OPTIONS
|
28
28
|
.TP
|
29
|
-
.B
|
30
|
-
Path to the Unicorn
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
the full list of directives available from the DSL.
|
29
|
+
.B \-c, \-\-config\-file CONFIG_FILE
|
30
|
+
Path to the Unicorn\-specific config file. The config file is
|
31
|
+
implemented as a Ruby DSL, so Ruby code may executed.
|
32
|
+
See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the full
|
33
|
+
list of directives available from the DSL.
|
35
34
|
Using an absolute path for for CONFIG_FILE is recommended as it
|
36
35
|
makes multiple instances of Unicorn easily distinguishable when
|
37
36
|
viewing ps(1) output.
|
38
37
|
.RS
|
39
38
|
.RE
|
40
39
|
.TP
|
41
|
-
.B
|
42
|
-
Run daemonized in the background.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
daemonization to allow more control over the startup/upgrade
|
40
|
+
.B \-D, \-\-daemonize
|
41
|
+
Run daemonized in the background. The process is detached from
|
42
|
+
the controlling terminal and stdin is redirected to "/dev/null".
|
43
|
+
Unlike many common UNIX daemons, we do not chdir to "/"
|
44
|
+
upon daemonization to allow more control over the startup/upgrade
|
47
45
|
process.
|
48
|
-
Unless specified in the CONFIG_FILE, stderr and stdout will
|
49
|
-
redirected to
|
46
|
+
Unless specified in the CONFIG_FILE, stderr and stdout will
|
47
|
+
also be redirected to "/dev/null".
|
50
48
|
.RS
|
51
49
|
.RE
|
52
50
|
.TP
|
53
|
-
.B
|
54
|
-
Run under the given RACK_ENV.
|
55
|
-
|
51
|
+
.B \-E, \-\-env RACK_ENV
|
52
|
+
Run under the given RACK_ENV. See the RACK ENVIRONMENT section
|
53
|
+
for more details.
|
56
54
|
.RS
|
57
55
|
.RE
|
58
56
|
.TP
|
59
|
-
.B
|
60
|
-
Listens on a given ADDRESS.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
socket options.
|
57
|
+
.B \-l, \-\-listen ADDRESS
|
58
|
+
Listens on a given ADDRESS. ADDRESS may be in the form of
|
59
|
+
HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
|
60
|
+
and PATH is meant to be a path to a UNIX domain socket.
|
61
|
+
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080)
|
62
|
+
For production deployments, specifying the "listen" directive in
|
63
|
+
CONFIG_FILE is recommended as it allows fine\-tuning of socket
|
64
|
+
options.
|
68
65
|
.RS
|
69
66
|
.RE
|
70
67
|
.TP
|
71
|
-
.B
|
72
|
-
Disables loading middleware implied by RACK_ENV.
|
73
|
-
|
74
|
-
|
75
|
-
application/framework-specific purposes.
|
68
|
+
.B \-N, \-\-no\-default\-middleware
|
69
|
+
Disables loading middleware implied by RACK_ENV. This bypasses the
|
70
|
+
configuration documented in the RACK ENVIRONMENT section, but still
|
71
|
+
allows RACK_ENV to be used for application/framework\-specific purposes.
|
76
72
|
.RS
|
77
73
|
.RE
|
78
74
|
.SH RACKUP COMPATIBILITY OPTIONS
|
79
75
|
.TP
|
80
|
-
.B
|
76
|
+
.B \-o, \-\-host HOST
|
81
77
|
Listen on a TCP socket belonging to HOST, default is
|
82
|
-
|
83
|
-
If specified multiple times on the command
|
84
|
-
last
|
85
|
-
This option only exists for compatibility with the rackup(1)
|
86
|
-
|
87
|
-
recommended instead.
|
78
|
+
"0.0.0.0" (all addresses).
|
79
|
+
If specified multiple times on the command\-line, only the
|
80
|
+
last\-specified value takes effect.
|
81
|
+
This option only exists for compatibility with the rackup(1) command,
|
82
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
88
83
|
.RS
|
89
84
|
.RE
|
90
85
|
.TP
|
91
|
-
.B
|
86
|
+
.B \-p, \-\-port PORT
|
92
87
|
Listen on the specified TCP PORT, default is 8080.
|
93
|
-
If specified multiple times on the command
|
94
|
-
|
95
|
-
This option only exists for compatibility with the rackup(1)
|
96
|
-
|
97
|
-
recommended instead.
|
88
|
+
If specified multiple times on the command\-line, only the last\-specified
|
89
|
+
value takes effect.
|
90
|
+
This option only exists for compatibility with the rackup(1) command,
|
91
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
98
92
|
.RS
|
99
93
|
.RE
|
100
94
|
.TP
|
101
|
-
.B
|
102
|
-
No
|
95
|
+
.B \-s, \-\-server SERVER
|
96
|
+
No\-op, this exists only for compatibility with rackup(1).
|
103
97
|
.RS
|
104
98
|
.RE
|
105
99
|
.SH RUBY OPTIONS
|
106
100
|
.TP
|
107
|
-
.B
|
108
|
-
Evaluate a LINE of Ruby code.
|
109
|
-
|
110
|
-
parsed.
|
101
|
+
.B \-e, \-\-eval LINE
|
102
|
+
Evaluate a LINE of Ruby code. This evaluation happens
|
103
|
+
immediately as the command\-line is being parsed.
|
111
104
|
.RS
|
112
105
|
.RE
|
113
106
|
.TP
|
114
|
-
.B
|
107
|
+
.B \-d, \-\-debug
|
115
108
|
Turn on debug mode, the $DEBUG variable is set to true.
|
116
109
|
.RS
|
117
110
|
.RE
|
118
111
|
.TP
|
119
|
-
.B
|
112
|
+
.B \-w, \-\-warn
|
120
113
|
Turn on verbose warnings, the $VERBOSE variable is set to true.
|
121
114
|
.RS
|
122
115
|
.RE
|
123
116
|
.TP
|
124
|
-
.B
|
125
|
-
specify $LOAD_PATH.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
Modifications to $LOAD_PATH take place immediately and in the order
|
131
|
-
they were specified on the command-line.
|
117
|
+
.B \-I, \-\-include PATH
|
118
|
+
specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
|
119
|
+
The \[aq]:\[aq] character may be used to delimit multiple directories.
|
120
|
+
This directive may be used more than once. Modifications to
|
121
|
+
$LOAD_PATH take place immediately and in the order they were
|
122
|
+
specified on the command\-line.
|
132
123
|
.RS
|
133
124
|
.RE
|
134
125
|
.TP
|
135
|
-
.B
|
136
|
-
require a specified LIBRARY before executing the application.
|
137
|
-
|
138
|
-
|
126
|
+
.B \-r, \-\-require LIBRARY
|
127
|
+
require a specified LIBRARY before executing the application. The
|
128
|
+
"require" statement will be executed immediately and in the order
|
129
|
+
they were specified on the command\-line.
|
139
130
|
.RS
|
140
131
|
.RE
|
141
132
|
.SH SIGNALS
|
142
133
|
.PP
|
143
134
|
The following UNIX signals may be sent to the master process:
|
144
135
|
.IP \[bu] 2
|
145
|
-
HUP
|
136
|
+
HUP \- reload config file, app, and gracefully restart all workers
|
146
137
|
.IP \[bu] 2
|
147
|
-
INT/TERM
|
138
|
+
INT/TERM \- quick shutdown, kills all workers immediately
|
148
139
|
.IP \[bu] 2
|
149
|
-
QUIT
|
150
|
-
request before finishing.
|
140
|
+
QUIT \- graceful shutdown, waits for workers to finish their
|
141
|
+
current request before finishing.
|
151
142
|
.IP \[bu] 2
|
152
|
-
USR1
|
153
|
-
Unicorn::Util.reopen_logs for what is considered a log.
|
143
|
+
USR1 \- reopen all logs owned by the master and all workers
|
144
|
+
See Unicorn::Util.reopen_logs for what is considered a log.
|
154
145
|
.IP \[bu] 2
|
155
|
-
USR2
|
156
|
-
|
157
|
-
|
146
|
+
USR2 \- reexecute the running binary. A separate QUIT
|
147
|
+
should be sent to the original process once the child is verified to
|
148
|
+
be up and running.
|
158
149
|
.IP \[bu] 2
|
159
|
-
WINCH
|
150
|
+
WINCH \- gracefully stops workers but keep the master running.
|
160
151
|
This will only work for daemonized processes.
|
161
152
|
.IP \[bu] 2
|
162
|
-
TTIN
|
153
|
+
TTIN \- increment the number of worker processes by one
|
163
154
|
.IP \[bu] 2
|
164
|
-
TTOU
|
155
|
+
TTOU \- decrement the number of worker processes by one
|
165
156
|
.PP
|
166
|
-
See the SIGNALS (
|
167
|
-
|
157
|
+
See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
|
158
|
+
full description of all signals used by Unicorn.
|
168
159
|
.SH RACK ENVIRONMENT
|
169
160
|
.PP
|
170
|
-
Accepted values of RACK_ENV and the middleware they automatically
|
171
|
-
|
161
|
+
Accepted values of RACK_ENV and the middleware they automatically load
|
162
|
+
(outside of RACKUP_FILE) are exactly as those in rackup(1):
|
172
163
|
.IP \[bu] 2
|
173
|
-
development
|
174
|
-
Rack::Lint middleware
|
164
|
+
development \- loads Rack::CommonLogger, Rack::ShowExceptions, and
|
165
|
+
Rack::Lint middleware
|
175
166
|
.IP \[bu] 2
|
176
|
-
deployment
|
167
|
+
deployment \- loads Rack::CommonLogger middleware
|
177
168
|
.IP \[bu] 2
|
178
|
-
none
|
169
|
+
none \- loads no middleware at all, relying entirely on RACKUP_FILE
|
179
170
|
.PP
|
180
171
|
All unrecognized values for RACK_ENV are assumed to be
|
181
|
-
|
182
|
-
|
183
|
-
\[lq]deployment\[rq] or \[lq]none\[rq] for maximum performance.
|
172
|
+
"none". Production deployments are strongly encouraged to use
|
173
|
+
"deployment" or "none" for maximum performance.
|
184
174
|
.PP
|
185
|
-
As of Unicorn 0.94.0, RACK_ENV is exported as a process
|
186
|
-
|
187
|
-
|
188
|
-
1.0.1, this has become a de facto standard in the Rack world.
|
175
|
+
As of Unicorn 0.94.0, RACK_ENV is exported as a process\-wide environment
|
176
|
+
variable as well. While not current a part of the Rack specification as
|
177
|
+
of Rack 1.0.1, this has become a de facto standard in the Rack world.
|
189
178
|
.PP
|
190
179
|
Note the Rack::ContentLength and Rack::Chunked middlewares are also
|
191
|
-
loaded by
|
192
|
-
|
193
|
-
|
194
|
-
some frameworks do not require them.
|
180
|
+
loaded by "deployment" and "development", but no other values of
|
181
|
+
RACK_ENV. If needed, they must be individually specified in the
|
182
|
+
RACKUP_FILE, some frameworks do not require them.
|
195
183
|
.SH ENVIRONMENT VARIABLES
|
196
184
|
.PP
|
197
|
-
The RACK_ENV variable is set by the aforementioned
|
198
|
-
All application or library
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
in the old master process are inherited by the new master process.
|
185
|
+
The RACK_ENV variable is set by the aforementioned \-E switch.
|
186
|
+
All application or library\-specific environment variables (e.g. TMPDIR)
|
187
|
+
may always be set in the Unicorn CONFIG_FILE in addition to the spawning
|
188
|
+
shell. When transparently upgrading Unicorn, all environment variables
|
189
|
+
set in the old master process are inherited by the new master process.
|
203
190
|
Unicorn only uses (and will overwrite) the UNICORN_FD environment
|
204
191
|
variable internally when doing transparent upgrades.
|
192
|
+
.PP
|
193
|
+
UNICORN_FD is a comma\-delimited list of one or more file descriptors
|
194
|
+
used to implement USR2 upgrades. Init systems may bind listen sockets
|
195
|
+
itself and spawn unicorn with UNICORN_FD set to the file descriptor
|
196
|
+
numbers of the listen socket(s).
|
197
|
+
.PP
|
198
|
+
As of unicorn 5.0, LISTEN_PID and LISTEN_FDS are used for socket
|
199
|
+
activation as documented in the sd_listen_fds(3) manpage. Users
|
200
|
+
relying on this feature do not need to specify a listen socket in
|
201
|
+
the unicorn config file.
|
205
202
|
.SH SEE ALSO
|
206
203
|
.IP \[bu] 2
|
207
|
-
unicorn_rails(1)
|
208
|
-
.IP \[bu] 2
|
209
204
|
\f[I]Rack::Builder\f[] ri/RDoc
|
210
205
|
.IP \[bu] 2
|
211
206
|
\f[I]Unicorn::Configurator\f[] ri/RDoc
|
207
|
+
.UR https://yhbt.net/unicorn/Unicorn/Configurator.html
|
208
|
+
.UE
|
212
209
|
.IP \[bu] 2
|
213
|
-
|
210
|
+
unicorn RDoc
|
211
|
+
.UR https://yhbt.net/unicorn/
|
212
|
+
.UE
|
214
213
|
.IP \[bu] 2
|
215
|
-
Rack RDoc
|
214
|
+
Rack RDoc
|
215
|
+
.UR https://www.rubydoc.info/github/rack/rack/
|
216
|
+
.UE
|
216
217
|
.IP \[bu] 2
|
217
|
-
Rackup HowTo
|
218
|
+
Rackup HowTo
|
219
|
+
.UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
|
220
|
+
.UE
|
218
221
|
.SH AUTHORS
|
219
|
-
The Unicorn Community <
|
220
|
-
|
222
|
+
The Unicorn Community <unicorn-public@yhbt.net>.
|