unicorn 5.0.1 → 5.3.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/.manifest +1 -0
- data/.olddoc.yml +6 -4
- data/Documentation/unicorn.1.txt +2 -3
- data/Documentation/unicorn_rails.1.txt +3 -3
- data/FAQ +1 -1
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +3 -3
- data/HACKING +1 -2
- data/ISSUES +21 -17
- data/KNOWN_ISSUES +2 -2
- data/LATEST +82 -28
- data/Links +3 -3
- data/NEWS +270 -0
- data/README +7 -19
- data/SIGNALS +1 -1
- data/Sandbox +6 -5
- data/TODO +0 -2
- data/TUNING +19 -1
- data/examples/big_app_gc.rb +1 -1
- data/examples/init.sh +36 -8
- data/examples/logrotate.conf +16 -1
- data/examples/nginx.conf +1 -1
- data/examples/unicorn.conf.minimal.rb +2 -2
- data/examples/unicorn.conf.rb +2 -2
- data/examples/unicorn@.service +7 -0
- data/ext/unicorn_http/common_field_optimization.h +2 -2
- data/ext/unicorn_http/ext_help.h +0 -20
- data/ext/unicorn_http/extconf.rb +1 -1
- data/ext/unicorn_http/global_variables.h +2 -2
- data/ext/unicorn_http/httpdate.c +2 -2
- data/ext/unicorn_http/unicorn_http.c +673 -358
- data/ext/unicorn_http/unicorn_http.rl +32 -16
- data/ext/unicorn_http/unicorn_http_common.rl +1 -1
- data/lib/unicorn/configurator.rb +71 -12
- data/lib/unicorn/http_request.rb +89 -9
- data/lib/unicorn/http_response.rb +5 -2
- data/lib/unicorn/http_server.rb +66 -22
- data/lib/unicorn/oob_gc.rb +4 -4
- data/lib/unicorn/socket_helper.rb +19 -4
- data/lib/unicorn/stream_input.rb +5 -4
- data/lib/unicorn/tee_input.rb +8 -10
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn/worker.rb +17 -6
- data/lib/unicorn.rb +31 -20
- data/man/man1/unicorn.1 +54 -55
- data/man/man1/unicorn_rails.1 +47 -46
- data/t/t0011-active-unix-socket.sh +1 -1
- data/t/t0012-reload-empty-config.sh +2 -1
- data/t/test-lib.sh +2 -2
- data/test/exec/test_exec.rb +6 -5
- data/test/unit/test_ccc.rb +90 -0
- data/test/unit/test_http_parser.rb +31 -17
- data/test/unit/test_socket_helper.rb +8 -4
- data/test/unit/test_util.rb +2 -2
- data/unicorn.gemspec +15 -17
- metadata +6 -19
data/lib/unicorn/tee_input.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- encoding: binary -*-
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Acts like tee(1) on an input input to provide a input-like stream
|
|
4
4
|
# while providing rewindable semantics through a File/StringIO backing
|
|
5
5
|
# store. On the first pass, the input is only read on demand so your
|
|
6
6
|
# Rack application can use input notification (upload progress and
|
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
# strict interpretation of Rack::Lint::InputWrapper functionality and
|
|
10
10
|
# will not support any deviations from it.
|
|
11
11
|
#
|
|
12
|
-
# When processing uploads,
|
|
13
|
-
# "rack.input" of the Rack environment.
|
|
12
|
+
# When processing uploads, unicorn exposes a TeeInput object under
|
|
13
|
+
# "rack.input" of the Rack environment by default.
|
|
14
14
|
class Unicorn::TeeInput < Unicorn::StreamInput
|
|
15
15
|
# The maximum size (in +bytes+) to buffer in memory before
|
|
16
16
|
# resorting to a temporary file. Default is 112 kilobytes.
|
|
17
|
-
@@client_body_buffer_size = Unicorn::Const::MAX_BODY
|
|
17
|
+
@@client_body_buffer_size = Unicorn::Const::MAX_BODY # :nodoc:
|
|
18
18
|
|
|
19
19
|
# sets the maximum size of request bodies to buffer in memory,
|
|
20
20
|
# amounts larger than this are buffered to the filesystem
|
|
21
|
-
def self.client_body_buffer_size=(bytes)
|
|
21
|
+
def self.client_body_buffer_size=(bytes) # :nodoc:
|
|
22
22
|
@@client_body_buffer_size = bytes
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
# returns the maximum size of request bodies to buffer in memory,
|
|
26
26
|
# amounts larger than this are buffered to the filesystem
|
|
27
|
-
def self.client_body_buffer_size
|
|
27
|
+
def self.client_body_buffer_size # :nodoc:
|
|
28
28
|
@@client_body_buffer_size
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -37,7 +37,7 @@ class Unicorn::TeeInput < Unicorn::StreamInput
|
|
|
37
37
|
|
|
38
38
|
# Initializes a new TeeInput object. You normally do not have to call
|
|
39
39
|
# this unless you are writing an HTTP server.
|
|
40
|
-
def initialize(socket, request)
|
|
40
|
+
def initialize(socket, request) # :nodoc:
|
|
41
41
|
@len = request.content_length
|
|
42
42
|
super
|
|
43
43
|
@tmp = @len && @len <= @@client_body_buffer_size ?
|
|
@@ -125,9 +125,7 @@ private
|
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def tee(buffer)
|
|
128
|
-
|
|
129
|
-
@tmp.write(buffer)
|
|
130
|
-
end
|
|
128
|
+
@tmp.write(buffer) if buffer
|
|
131
129
|
buffer
|
|
132
130
|
end
|
|
133
131
|
end
|
data/lib/unicorn/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Unicorn::Const::UNICORN_VERSION = '5.0
|
|
1
|
+
Unicorn::Const::UNICORN_VERSION = '5.3.0'
|
data/lib/unicorn/worker.rb
CHANGED
|
@@ -12,18 +12,19 @@ class Unicorn::Worker
|
|
|
12
12
|
# :stopdoc:
|
|
13
13
|
attr_accessor :nr, :switched
|
|
14
14
|
attr_reader :to_io # IO.select-compatible
|
|
15
|
+
attr_reader :master
|
|
15
16
|
|
|
16
17
|
PER_DROP = Raindrops::PAGE_SIZE / Raindrops::SIZE
|
|
17
18
|
DROPS = []
|
|
18
19
|
|
|
19
|
-
def initialize(nr)
|
|
20
|
+
def initialize(nr, pipe=nil)
|
|
20
21
|
drop_index = nr / PER_DROP
|
|
21
22
|
@raindrop = DROPS[drop_index] ||= Raindrops.new(PER_DROP)
|
|
22
23
|
@offset = nr % PER_DROP
|
|
23
24
|
@raindrop[@offset] = 0
|
|
24
25
|
@nr = nr
|
|
25
26
|
@switched = false
|
|
26
|
-
@to_io, @master = Unicorn.pipe
|
|
27
|
+
@to_io, @master = pipe || Unicorn.pipe
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def atfork_child # :nodoc:
|
|
@@ -111,9 +112,11 @@ class Unicorn::Worker
|
|
|
111
112
|
# In most cases, you should be using the Unicorn::Configurator#user
|
|
112
113
|
# directive instead. This method should only be used if you need
|
|
113
114
|
# fine-grained control of exactly when you want to change permissions
|
|
114
|
-
# in your after_fork hooks
|
|
115
|
+
# in your after_fork or after_worker_ready hooks, or if you want to
|
|
116
|
+
# use the chroot support.
|
|
115
117
|
#
|
|
116
|
-
# Changes the worker process to the specified +user+ and +group
|
|
118
|
+
# Changes the worker process to the specified +user+ and +group+,
|
|
119
|
+
# and chroots to the current working directory if +chroot+ is set.
|
|
117
120
|
# This is only intended to be called from within the worker
|
|
118
121
|
# process from the +after_fork+ hook. This should be called in
|
|
119
122
|
# the +after_fork+ hook after any privileged functions need to be
|
|
@@ -122,8 +125,11 @@ class Unicorn::Worker
|
|
|
122
125
|
# Any and all errors raised within this method will be propagated
|
|
123
126
|
# directly back to the caller (usually the +after_fork+ hook.
|
|
124
127
|
# These errors commonly include ArgumentError for specifying an
|
|
125
|
-
# invalid user/group and Errno::EPERM for insufficient privileges
|
|
126
|
-
|
|
128
|
+
# invalid user/group and Errno::EPERM for insufficient privileges.
|
|
129
|
+
#
|
|
130
|
+
# chroot support is only available in unicorn 5.3.0+
|
|
131
|
+
# user and group switching appeared in unicorn 0.94.0 (2009-11-05)
|
|
132
|
+
def user(user, group = nil, chroot = false)
|
|
127
133
|
# we do not protect the caller, checking Process.euid == 0 is
|
|
128
134
|
# insufficient because modern systems have fine-grained
|
|
129
135
|
# capabilities. Let the caller handle any and all errors.
|
|
@@ -134,6 +140,11 @@ class Unicorn::Worker
|
|
|
134
140
|
Process.initgroups(user, gid)
|
|
135
141
|
Process::GID.change_privilege(gid)
|
|
136
142
|
end
|
|
143
|
+
if chroot
|
|
144
|
+
chroot = Dir.pwd if chroot == true
|
|
145
|
+
Dir.chroot(chroot)
|
|
146
|
+
Dir.chdir('/')
|
|
147
|
+
end
|
|
137
148
|
Process.euid != uid and Process::UID.change_privilege(uid)
|
|
138
149
|
@switched = true
|
|
139
150
|
end
|
data/lib/unicorn.rb
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# -*- encoding: binary -*-
|
|
2
2
|
require 'etc'
|
|
3
3
|
require 'stringio'
|
|
4
|
-
require 'rack'
|
|
5
4
|
require 'kgio'
|
|
6
5
|
|
|
6
|
+
begin
|
|
7
|
+
require 'rack'
|
|
8
|
+
rescue LoadError
|
|
9
|
+
warn 'rack not available, functionality reduced'
|
|
10
|
+
end
|
|
11
|
+
|
|
7
12
|
# :stopdoc:
|
|
8
13
|
# Unicorn module containing all of the classes (include C extensions) for
|
|
9
14
|
# running a Unicorn web server. It contains a minimalist HTTP server with just
|
|
@@ -20,7 +25,9 @@ module Unicorn
|
|
|
20
25
|
# application dispatch. This is always raised with an empty backtrace
|
|
21
26
|
# since there is nothing in the application stack that is responsible
|
|
22
27
|
# for client shutdowns/disconnects. This exception is visible to Rack
|
|
23
|
-
# applications unless PrereadInput middleware is loaded.
|
|
28
|
+
# applications unless PrereadInput middleware is loaded. This
|
|
29
|
+
# is a subclass of the standard EOFError class and applications should
|
|
30
|
+
# not rescue it explicitly, but rescue EOFError instead.
|
|
24
31
|
ClientShutdown = Class.new(EOFError)
|
|
25
32
|
|
|
26
33
|
# :stopdoc:
|
|
@@ -32,6 +39,9 @@ module Unicorn
|
|
|
32
39
|
def self.builder(ru, op)
|
|
33
40
|
# allow Configurator to parse cli switches embedded in the ru file
|
|
34
41
|
op = Unicorn::Configurator::RACKUP.merge!(:file => ru, :optparse => op)
|
|
42
|
+
if ru =~ /\.ru$/ && !defined?(Rack::Builder)
|
|
43
|
+
abort "rack and Rack::Builder must be available for processing #{ru}"
|
|
44
|
+
end
|
|
35
45
|
|
|
36
46
|
# Op is going to get cleared before the returned lambda is called, so
|
|
37
47
|
# save this value so that it's still there when we need it:
|
|
@@ -53,38 +63,39 @@ module Unicorn
|
|
|
53
63
|
|
|
54
64
|
return inner_app if no_default_middleware
|
|
55
65
|
|
|
66
|
+
middleware = { # order matters
|
|
67
|
+
ContentLength: nil,
|
|
68
|
+
Chunked: nil,
|
|
69
|
+
CommonLogger: [ $stderr ],
|
|
70
|
+
ShowExceptions: nil,
|
|
71
|
+
Lint: nil,
|
|
72
|
+
TempfileReaper: nil,
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
# return value, matches rackup defaults based on env
|
|
57
76
|
# Unicorn does not support persistent connections, but Rainbows!
|
|
58
77
|
# and Zbatery both do. Users accustomed to the Rack::Server default
|
|
59
78
|
# middlewares will need ContentLength/Chunked middlewares.
|
|
60
79
|
case ENV["RACK_ENV"]
|
|
61
80
|
when "development"
|
|
62
|
-
Rack::Builder.new do
|
|
63
|
-
use Rack::ContentLength
|
|
64
|
-
use Rack::Chunked
|
|
65
|
-
use Rack::CommonLogger, $stderr
|
|
66
|
-
use Rack::ShowExceptions
|
|
67
|
-
use Rack::Lint
|
|
68
|
-
use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper)
|
|
69
|
-
run inner_app
|
|
70
|
-
end.to_app
|
|
71
81
|
when "deployment"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
use Rack::Chunked
|
|
75
|
-
use Rack::CommonLogger, $stderr
|
|
76
|
-
use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper)
|
|
77
|
-
run inner_app
|
|
78
|
-
end.to_app
|
|
82
|
+
middleware.delete(:ShowExceptions)
|
|
83
|
+
middleware.delete(:Lint)
|
|
79
84
|
else
|
|
80
|
-
inner_app
|
|
85
|
+
return inner_app
|
|
81
86
|
end
|
|
87
|
+
Rack::Builder.new do
|
|
88
|
+
middleware.each do |m, args|
|
|
89
|
+
use(Rack.const_get(m), *args) if Rack.const_defined?(m)
|
|
90
|
+
end
|
|
91
|
+
run inner_app
|
|
92
|
+
end.to_app
|
|
82
93
|
end
|
|
83
94
|
end
|
|
84
95
|
|
|
85
96
|
# returns an array of strings representing TCP listen socket addresses
|
|
86
97
|
# and Unix domain socket paths. This is useful for use with
|
|
87
|
-
# Raindrops::Middleware under Linux:
|
|
98
|
+
# Raindrops::Middleware under Linux: https://bogomips.org/raindrops/
|
|
88
99
|
def self.listener_names
|
|
89
100
|
Unicorn::HttpServer::LISTENERS.map do |io|
|
|
90
101
|
Unicorn::SocketHelper.sock_name(io)
|
data/man/man1/unicorn.1
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
.TH UNICORN 1 "September 15, 2009" "Unicorn User Manual"
|
|
1
|
+
.TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
|
|
2
2
|
.SH NAME
|
|
3
3
|
.PP
|
|
4
|
-
unicorn
|
|
4
|
+
unicorn \- a rackup\-like command to launch the Unicorn HTTP server
|
|
5
5
|
.SH SYNOPSIS
|
|
6
6
|
.PP
|
|
7
|
-
unicorn [
|
|
7
|
+
unicorn [\-c CONFIG_FILE] [\-E RACK_ENV] [\-D] [RACKUP_FILE]
|
|
8
8
|
.SH DESCRIPTION
|
|
9
9
|
.PP
|
|
10
|
-
A rackup(1)
|
|
10
|
+
A rackup(1)\-like command to launch Rack applications using Unicorn.
|
|
11
11
|
It is expected to be started in your application root (APP_ROOT), but
|
|
12
12
|
the "working_directory" directive may be used in the CONFIG_FILE.
|
|
13
13
|
.PP
|
|
14
|
-
While unicorn takes a myriad of command
|
|
14
|
+
While unicorn takes a myriad of command\-line options for compatibility
|
|
15
15
|
with ruby(1) and rackup(1), it is recommended to stick to the few
|
|
16
|
-
command
|
|
16
|
+
command\-line options specified in the SYNOPSIS and use the CONFIG_FILE
|
|
17
17
|
as much as possible.
|
|
18
18
|
.SH RACKUP FILE
|
|
19
19
|
.PP
|
|
@@ -21,12 +21,12 @@ This defaults to "config.ru" in APP_ROOT.
|
|
|
21
21
|
It should be the same file used by rackup(1) and other Rack launchers,
|
|
22
22
|
it uses the \f[I]Rack::Builder\f[] DSL.
|
|
23
23
|
.PP
|
|
24
|
-
Embedded command
|
|
24
|
+
Embedded command\-line options are mostly parsed for compatibility with
|
|
25
25
|
rackup(1) but strongly discouraged.
|
|
26
26
|
.SH UNICORN OPTIONS
|
|
27
27
|
.TP
|
|
28
|
-
.B
|
|
29
|
-
Path to the Unicorn
|
|
28
|
+
.B \-c, \-\-config\-file CONFIG_FILE
|
|
29
|
+
Path to the Unicorn\-specific config file.
|
|
30
30
|
The config file is implemented as a Ruby DSL, so Ruby code may executed.
|
|
31
31
|
See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the
|
|
32
32
|
full list of directives available from the DSL.
|
|
@@ -36,7 +36,7 @@ output.
|
|
|
36
36
|
.RS
|
|
37
37
|
.RE
|
|
38
38
|
.TP
|
|
39
|
-
.B
|
|
39
|
+
.B \-D, \-\-daemonize
|
|
40
40
|
Run daemonized in the background.
|
|
41
41
|
The process is detached from the controlling terminal and stdin is
|
|
42
42
|
redirected to "/dev/null".
|
|
@@ -47,134 +47,135 @@ redirected to "/dev/null".
|
|
|
47
47
|
.RS
|
|
48
48
|
.RE
|
|
49
49
|
.TP
|
|
50
|
-
.B
|
|
50
|
+
.B \-E, \-\-env RACK_ENV
|
|
51
51
|
Run under the given RACK_ENV.
|
|
52
52
|
See the RACK ENVIRONMENT section for more details.
|
|
53
53
|
.RS
|
|
54
54
|
.RE
|
|
55
55
|
.TP
|
|
56
|
-
.B
|
|
56
|
+
.B \-l, \-\-listen ADDRESS
|
|
57
57
|
Listens on a given ADDRESS.
|
|
58
58
|
ADDRESS may be in the form of HOST:PORT or PATH, HOST:PORT is taken to
|
|
59
59
|
mean a TCP socket and PATH is meant to be a path to a UNIX domain
|
|
60
60
|
socket.
|
|
61
61
|
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080) For
|
|
62
62
|
production deployments, specifying the "listen" directive in CONFIG_FILE
|
|
63
|
-
is recommended as it allows fine
|
|
63
|
+
is recommended as it allows fine\-tuning of socket options.
|
|
64
64
|
.RS
|
|
65
65
|
.RE
|
|
66
66
|
.TP
|
|
67
|
-
.B
|
|
67
|
+
.B \-N, \-\-no\-default\-middleware
|
|
68
68
|
Disables loading middleware implied by RACK_ENV.
|
|
69
69
|
This bypasses the configuration documented in the RACK ENVIRONMENT
|
|
70
70
|
section, but still allows RACK_ENV to be used for
|
|
71
|
-
application/framework
|
|
71
|
+
application/framework\-specific purposes.
|
|
72
72
|
.RS
|
|
73
73
|
.RE
|
|
74
74
|
.SH RACKUP COMPATIBILITY OPTIONS
|
|
75
75
|
.TP
|
|
76
|
-
.B
|
|
76
|
+
.B \-o, \-\-host HOST
|
|
77
77
|
Listen on a TCP socket belonging to HOST, default is "0.0.0.0" (all
|
|
78
78
|
addresses).
|
|
79
|
-
If specified multiple times on the command
|
|
80
|
-
value takes effect.
|
|
79
|
+
If specified multiple times on the command\-line, only the
|
|
80
|
+
last\-specified value takes effect.
|
|
81
81
|
This option only exists for compatibility with the rackup(1) command,
|
|
82
|
-
use of "
|
|
82
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
|
83
83
|
.RS
|
|
84
84
|
.RE
|
|
85
85
|
.TP
|
|
86
|
-
.B
|
|
86
|
+
.B \-p, \-\-port PORT
|
|
87
87
|
Listen on the specified TCP PORT, default is 8080.
|
|
88
|
-
If specified multiple times on the command
|
|
89
|
-
value takes effect.
|
|
88
|
+
If specified multiple times on the command\-line, only the
|
|
89
|
+
last\-specified value takes effect.
|
|
90
90
|
This option only exists for compatibility with the rackup(1) command,
|
|
91
|
-
use of "
|
|
91
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
|
92
92
|
.RS
|
|
93
93
|
.RE
|
|
94
94
|
.TP
|
|
95
|
-
.B
|
|
96
|
-
No
|
|
95
|
+
.B \-s, \-\-server SERVER
|
|
96
|
+
No\-op, this exists only for compatibility with rackup(1).
|
|
97
97
|
.RS
|
|
98
98
|
.RE
|
|
99
99
|
.SH RUBY OPTIONS
|
|
100
100
|
.TP
|
|
101
|
-
.B
|
|
101
|
+
.B \-e, \-\-eval LINE
|
|
102
102
|
Evaluate a LINE of Ruby code.
|
|
103
|
-
This evaluation happens immediately as the command
|
|
103
|
+
This evaluation happens immediately as the command\-line is being
|
|
104
|
+
parsed.
|
|
104
105
|
.RS
|
|
105
106
|
.RE
|
|
106
107
|
.TP
|
|
107
|
-
.B
|
|
108
|
+
.B \-d, \-\-debug
|
|
108
109
|
Turn on debug mode, the $DEBUG variable is set to true.
|
|
109
110
|
.RS
|
|
110
111
|
.RE
|
|
111
112
|
.TP
|
|
112
|
-
.B
|
|
113
|
+
.B \-w, \-\-warn
|
|
113
114
|
Turn on verbose warnings, the $VERBOSE variable is set to true.
|
|
114
115
|
.RS
|
|
115
116
|
.RE
|
|
116
117
|
.TP
|
|
117
|
-
.B
|
|
118
|
-
specify
|
|
119
|
-
|
|
118
|
+
.B \-I, \-\-include PATH
|
|
119
|
+
specify
|
|
120
|
+
\f[I]L\f[]\f[I]O\f[]\f[I]A\f[]\f[I]D\f[]~\f[I]P\f[]~\f[I]A\f[]\f[I]T\f[]\f[I]H\f[].\f[I]P\f[]\f[I]A\f[]\f[I]T\f[]\f[I]H\f[]\f[I]w\f[]\f[I]i\f[]\f[I]l\f[]\f[I]l\f[]\f[I]b\f[]\f[I]e\f[]\f[I]p\f[]\f[I]r\f[]\f[I]e\f[]\f[I]p\f[]\f[I]e\f[]\f[I]n\f[]\f[I]d\f[]\f[I]e\f[]\f[I]d\f[]\f[I]t\f[]\f[I]o\f[]LOAD_PATH.
|
|
120
121
|
The \[aq]:\[aq] character may be used to delimit multiple directories.
|
|
121
122
|
This directive may be used more than once.
|
|
122
123
|
Modifications to $LOAD_PATH take place immediately and in the order they
|
|
123
|
-
were specified on the command
|
|
124
|
+
were specified on the command\-line.
|
|
124
125
|
.RS
|
|
125
126
|
.RE
|
|
126
127
|
.TP
|
|
127
|
-
.B
|
|
128
|
+
.B \-r, \-\-require LIBRARY
|
|
128
129
|
require a specified LIBRARY before executing the application.
|
|
129
130
|
The "require" statement will be executed immediately and in the order
|
|
130
|
-
they were specified on the command
|
|
131
|
+
they were specified on the command\-line.
|
|
131
132
|
.RS
|
|
132
133
|
.RE
|
|
133
134
|
.SH SIGNALS
|
|
134
135
|
.PP
|
|
135
136
|
The following UNIX signals may be sent to the master process:
|
|
136
137
|
.IP \[bu] 2
|
|
137
|
-
HUP
|
|
138
|
+
HUP \- reload config file, app, and gracefully restart all workers
|
|
138
139
|
.IP \[bu] 2
|
|
139
|
-
INT/TERM
|
|
140
|
+
INT/TERM \- quick shutdown, kills all workers immediately
|
|
140
141
|
.IP \[bu] 2
|
|
141
|
-
QUIT
|
|
142
|
+
QUIT \- graceful shutdown, waits for workers to finish their current
|
|
142
143
|
request before finishing.
|
|
143
144
|
.IP \[bu] 2
|
|
144
|
-
USR1
|
|
145
|
+
USR1 \- reopen all logs owned by the master and all workers See
|
|
145
146
|
Unicorn::Util.reopen_logs for what is considered a log.
|
|
146
147
|
.IP \[bu] 2
|
|
147
|
-
USR2
|
|
148
|
+
USR2 \- reexecute the running binary.
|
|
148
149
|
A separate QUIT should be sent to the original process once the child is
|
|
149
150
|
verified to be up and running.
|
|
150
151
|
.IP \[bu] 2
|
|
151
|
-
WINCH
|
|
152
|
+
WINCH \- gracefully stops workers but keep the master running.
|
|
152
153
|
This will only work for daemonized processes.
|
|
153
154
|
.IP \[bu] 2
|
|
154
|
-
TTIN
|
|
155
|
+
TTIN \- increment the number of worker processes by one
|
|
155
156
|
.IP \[bu] 2
|
|
156
|
-
TTOU
|
|
157
|
+
TTOU \- decrement the number of worker processes by one
|
|
157
158
|
.PP
|
|
158
|
-
See the SIGNALS (
|
|
159
|
+
See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
|
|
159
160
|
full description of all signals used by Unicorn.
|
|
160
161
|
.SH RACK ENVIRONMENT
|
|
161
162
|
.PP
|
|
162
163
|
Accepted values of RACK_ENV and the middleware they automatically load
|
|
163
164
|
(outside of RACKUP_FILE) are exactly as those in rackup(1):
|
|
164
165
|
.IP \[bu] 2
|
|
165
|
-
development
|
|
166
|
+
development \- loads Rack::CommonLogger, Rack::ShowExceptions, and
|
|
166
167
|
Rack::Lint middleware
|
|
167
168
|
.IP \[bu] 2
|
|
168
|
-
deployment
|
|
169
|
+
deployment \- loads Rack::CommonLogger middleware
|
|
169
170
|
.IP \[bu] 2
|
|
170
|
-
none
|
|
171
|
+
none \- loads no middleware at all, relying entirely on RACKUP_FILE
|
|
171
172
|
.PP
|
|
172
173
|
All unrecognized values for RACK_ENV are assumed to be "none".
|
|
173
174
|
Production deployments are strongly encouraged to use "deployment" or
|
|
174
175
|
"none" for maximum performance.
|
|
175
176
|
.PP
|
|
176
|
-
As of Unicorn 0.94.0, RACK_ENV is exported as a process
|
|
177
|
-
variable as well.
|
|
177
|
+
As of Unicorn 0.94.0, RACK_ENV is exported as a process\-wide
|
|
178
|
+
environment variable as well.
|
|
178
179
|
While not current a part of the Rack specification as of Rack 1.0.1,
|
|
179
180
|
this has become a de facto standard in the Rack world.
|
|
180
181
|
.PP
|
|
@@ -185,8 +186,8 @@ If needed, they must be individually specified in the RACKUP_FILE, some
|
|
|
185
186
|
frameworks do not require them.
|
|
186
187
|
.SH ENVIRONMENT VARIABLES
|
|
187
188
|
.PP
|
|
188
|
-
The RACK_ENV variable is set by the aforementioned
|
|
189
|
-
All application or library
|
|
189
|
+
The RACK_ENV variable is set by the aforementioned \-E switch.
|
|
190
|
+
All application or library\-specific environment variables (e.g.
|
|
190
191
|
TMPDIR) may always be set in the Unicorn CONFIG_FILE in addition to the
|
|
191
192
|
spawning shell.
|
|
192
193
|
When transparently upgrading Unicorn, all environment variables set in
|
|
@@ -194,7 +195,7 @@ the old master process are inherited by the new master process.
|
|
|
194
195
|
Unicorn only uses (and will overwrite) the UNICORN_FD environment
|
|
195
196
|
variable internally when doing transparent upgrades.
|
|
196
197
|
.PP
|
|
197
|
-
UNICORN_FD is a comma
|
|
198
|
+
UNICORN_FD is a comma\-delimited list of one or more file descriptors
|
|
198
199
|
used to implement USR2 upgrades.
|
|
199
200
|
Init systems may bind listen sockets itself and spawn unicorn with
|
|
200
201
|
UNICORN_FD set to the file descriptor numbers of the listen socket(s).
|
|
@@ -205,13 +206,11 @@ Users relying on this feature do not need to specify a listen socket in
|
|
|
205
206
|
the unicorn config file.
|
|
206
207
|
.SH SEE ALSO
|
|
207
208
|
.IP \[bu] 2
|
|
208
|
-
unicorn_rails(1)
|
|
209
|
-
.IP \[bu] 2
|
|
210
209
|
\f[I]Rack::Builder\f[] ri/RDoc
|
|
211
210
|
.IP \[bu] 2
|
|
212
211
|
\f[I]Unicorn::Configurator\f[] ri/RDoc
|
|
213
212
|
.IP \[bu] 2
|
|
214
|
-
Unicorn RDoc (
|
|
213
|
+
Unicorn RDoc (https://bogomips.org/unicorn/)
|
|
215
214
|
.IP \[bu] 2
|
|
216
215
|
Rack RDoc (http://www.rubydoc.info/github/rack/rack/)
|
|
217
216
|
.IP \[bu] 2
|