unicorn 5.5.1 → 5.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Documentation/.gitignore +1 -3
- data/Documentation/unicorn.1 +222 -0
- data/Documentation/unicorn_rails.1 +207 -0
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +13 -3
- data/examples/unicorn@.service +7 -0
- data/lib/unicorn/tmpio.rb +8 -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/unit/test_util.rb +1 -1
- metadata +7 -5
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -187
- data/Documentation/unicorn_rails.1.txt +0 -173
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de6d231854c78743f6e065253eaaea6209b09ad9a09a7153e1c4d9d8eeaedf3d
|
4
|
+
data.tar.gz: ddf83ee5a57ba96bb18124de1331d7763e019e5c686ced6f4164dd07a9277e68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424332fd70af2e67f34c59cc78b374263126e8fd4516477b44ec0fe0ae27f25d3a537a26fb8748d0920d1354001e124906315ff1f8eb06db86ac79b341e4e770
|
7
|
+
data.tar.gz: 36b3b0adbbfc9ebdf9450cfb928474a7ab6c56bf4f4957a1ad0cfb3ed665ee27b829b5349ec0de2423e8d0bd745c94676192cd48dfe18cfe64abce6ce6a2dbf2
|
data/Documentation/.gitignore
CHANGED
@@ -0,0 +1,222 @@
|
|
1
|
+
.TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
|
2
|
+
.hy
|
3
|
+
.SH NAME
|
4
|
+
.PP
|
5
|
+
unicorn \- a rackup\-like command to launch the Unicorn HTTP server
|
6
|
+
.SH SYNOPSIS
|
7
|
+
.PP
|
8
|
+
unicorn [\-c CONFIG_FILE] [\-E RACK_ENV] [\-D] [RACKUP_FILE]
|
9
|
+
.SH DESCRIPTION
|
10
|
+
.PP
|
11
|
+
A rackup(1)\-like command to launch Rack applications using Unicorn.
|
12
|
+
It is expected to be started in your application root (APP_ROOT),
|
13
|
+
but the "working_directory" directive may be used in the CONFIG_FILE.
|
14
|
+
.PP
|
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
|
+
.SH RACKUP FILE
|
20
|
+
.PP
|
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
|
+
.PP
|
25
|
+
Embedded command\-line options are mostly parsed for compatibility
|
26
|
+
with rackup(1) but strongly discouraged.
|
27
|
+
.SH UNICORN OPTIONS
|
28
|
+
.TP
|
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.
|
34
|
+
Using an absolute path for for CONFIG_FILE is recommended as it
|
35
|
+
makes multiple instances of Unicorn easily distinguishable when
|
36
|
+
viewing ps(1) output.
|
37
|
+
.RS
|
38
|
+
.RE
|
39
|
+
.TP
|
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
|
45
|
+
process.
|
46
|
+
Unless specified in the CONFIG_FILE, stderr and stdout will
|
47
|
+
also be redirected to "/dev/null".
|
48
|
+
.RS
|
49
|
+
.RE
|
50
|
+
.TP
|
51
|
+
.B \-E, \-\-env RACK_ENV
|
52
|
+
Run under the given RACK_ENV. See the RACK ENVIRONMENT section
|
53
|
+
for more details.
|
54
|
+
.RS
|
55
|
+
.RE
|
56
|
+
.TP
|
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.
|
65
|
+
.RS
|
66
|
+
.RE
|
67
|
+
.TP
|
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.
|
72
|
+
.RS
|
73
|
+
.RE
|
74
|
+
.SH RACKUP COMPATIBILITY OPTIONS
|
75
|
+
.TP
|
76
|
+
.B \-o, \-\-host HOST
|
77
|
+
Listen on a TCP socket belonging to HOST, default is
|
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.
|
83
|
+
.RS
|
84
|
+
.RE
|
85
|
+
.TP
|
86
|
+
.B \-p, \-\-port PORT
|
87
|
+
Listen on the specified TCP PORT, default is 8080.
|
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.
|
92
|
+
.RS
|
93
|
+
.RE
|
94
|
+
.TP
|
95
|
+
.B \-s, \-\-server SERVER
|
96
|
+
No\-op, this exists only for compatibility with rackup(1).
|
97
|
+
.RS
|
98
|
+
.RE
|
99
|
+
.SH RUBY OPTIONS
|
100
|
+
.TP
|
101
|
+
.B \-e, \-\-eval LINE
|
102
|
+
Evaluate a LINE of Ruby code. This evaluation happens
|
103
|
+
immediately as the command\-line is being parsed.
|
104
|
+
.RS
|
105
|
+
.RE
|
106
|
+
.TP
|
107
|
+
.B \-d, \-\-debug
|
108
|
+
Turn on debug mode, the $DEBUG variable is set to true.
|
109
|
+
.RS
|
110
|
+
.RE
|
111
|
+
.TP
|
112
|
+
.B \-w, \-\-warn
|
113
|
+
Turn on verbose warnings, the $VERBOSE variable is set to true.
|
114
|
+
.RS
|
115
|
+
.RE
|
116
|
+
.TP
|
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.
|
123
|
+
.RS
|
124
|
+
.RE
|
125
|
+
.TP
|
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.
|
130
|
+
.RS
|
131
|
+
.RE
|
132
|
+
.SH SIGNALS
|
133
|
+
.PP
|
134
|
+
The following UNIX signals may be sent to the master process:
|
135
|
+
.IP \[bu] 2
|
136
|
+
HUP \- reload config file, app, and gracefully restart all workers
|
137
|
+
.IP \[bu] 2
|
138
|
+
INT/TERM \- quick shutdown, kills all workers immediately
|
139
|
+
.IP \[bu] 2
|
140
|
+
QUIT \- graceful shutdown, waits for workers to finish their
|
141
|
+
current request before finishing.
|
142
|
+
.IP \[bu] 2
|
143
|
+
USR1 \- reopen all logs owned by the master and all workers
|
144
|
+
See Unicorn::Util.reopen_logs for what is considered a log.
|
145
|
+
.IP \[bu] 2
|
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.
|
149
|
+
.IP \[bu] 2
|
150
|
+
WINCH \- gracefully stops workers but keep the master running.
|
151
|
+
This will only work for daemonized processes.
|
152
|
+
.IP \[bu] 2
|
153
|
+
TTIN \- increment the number of worker processes by one
|
154
|
+
.IP \[bu] 2
|
155
|
+
TTOU \- decrement the number of worker processes by one
|
156
|
+
.PP
|
157
|
+
See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
|
158
|
+
full description of all signals used by Unicorn.
|
159
|
+
.SH RACK ENVIRONMENT
|
160
|
+
.PP
|
161
|
+
Accepted values of RACK_ENV and the middleware they automatically load
|
162
|
+
(outside of RACKUP_FILE) are exactly as those in rackup(1):
|
163
|
+
.IP \[bu] 2
|
164
|
+
development \- loads Rack::CommonLogger, Rack::ShowExceptions, and
|
165
|
+
Rack::Lint middleware
|
166
|
+
.IP \[bu] 2
|
167
|
+
deployment \- loads Rack::CommonLogger middleware
|
168
|
+
.IP \[bu] 2
|
169
|
+
none \- loads no middleware at all, relying entirely on RACKUP_FILE
|
170
|
+
.PP
|
171
|
+
All unrecognized values for RACK_ENV are assumed to be
|
172
|
+
"none". Production deployments are strongly encouraged to use
|
173
|
+
"deployment" or "none" for maximum performance.
|
174
|
+
.PP
|
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.
|
178
|
+
.PP
|
179
|
+
Note the Rack::ContentLength and Rack::Chunked middlewares are also
|
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.
|
183
|
+
.SH ENVIRONMENT VARIABLES
|
184
|
+
.PP
|
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.
|
190
|
+
Unicorn only uses (and will overwrite) the UNICORN_FD environment
|
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.
|
202
|
+
.SH SEE ALSO
|
203
|
+
.IP \[bu] 2
|
204
|
+
\f[I]Rack::Builder\f[] ri/RDoc
|
205
|
+
.IP \[bu] 2
|
206
|
+
\f[I]Unicorn::Configurator\f[] ri/RDoc
|
207
|
+
.UR https://bogomips.org/unicorn/Unicorn/Configurator.html
|
208
|
+
.UE
|
209
|
+
.IP \[bu] 2
|
210
|
+
unicorn RDoc
|
211
|
+
.UR https://bogomips.org/unicorn/
|
212
|
+
.UE
|
213
|
+
.IP \[bu] 2
|
214
|
+
Rack RDoc
|
215
|
+
.UR https://www.rubydoc.info/github/rack/rack/
|
216
|
+
.UE
|
217
|
+
.IP \[bu] 2
|
218
|
+
Rackup HowTo
|
219
|
+
.UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
|
220
|
+
.UE
|
221
|
+
.SH AUTHORS
|
222
|
+
The Unicorn Community <unicorn-public@bogomips.org>.
|
@@ -0,0 +1,207 @@
|
|
1
|
+
.TH "UNICORN_RAILS" "1" "September 17, 2009" "Unicorn User Manual" ""
|
2
|
+
.hy
|
3
|
+
.SH NAME
|
4
|
+
.PP
|
5
|
+
unicorn_rails \- unicorn launcher for Rails 1.x and 2.x users
|
6
|
+
.SH SYNOPSIS
|
7
|
+
.PP
|
8
|
+
unicorn_rails [\-c CONFIG_FILE] [\-E RAILS_ENV] [\-D] [RACKUP_FILE]
|
9
|
+
.SH DESCRIPTION
|
10
|
+
.PP
|
11
|
+
A rackup(1)\-like command to launch ancient Rails (2.x and earlier)
|
12
|
+
applications using Unicorn. Rails 3 (and later) support Rack natively,
|
13
|
+
so users are encouraged to use unicorn(1) instead of unicorn_rails(1).
|
14
|
+
.PP
|
15
|
+
It is expected to be started in your Rails application root (RAILS_ROOT),
|
16
|
+
but the "working_directory" directive may be used in the CONFIG_FILE.
|
17
|
+
.PP
|
18
|
+
The outward interface resembles rackup(1), the internals and default
|
19
|
+
middleware loading is designed like the \f[C]script/server\f[] command
|
20
|
+
distributed with Rails.
|
21
|
+
.PP
|
22
|
+
While Unicorn takes a myriad of command\-line options for compatibility
|
23
|
+
with ruby(1) and rackup(1), it is recommended to stick to the few
|
24
|
+
command\-line options specified in the SYNOPSIS and use the CONFIG_FILE
|
25
|
+
as much as possible.
|
26
|
+
.SH UNICORN OPTIONS
|
27
|
+
.TP
|
28
|
+
.B \-c, \-\-config\-file CONFIG_FILE
|
29
|
+
Path to the Unicorn\-specific config file. The config file is
|
30
|
+
implemented as a Ruby DSL, so Ruby code may executed.
|
31
|
+
See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the full
|
32
|
+
list of directives available from the DSL.
|
33
|
+
Using an absolute path for for CONFIG_FILE is recommended as it
|
34
|
+
makes multiple instances of Unicorn easily distinguishable when
|
35
|
+
viewing ps(1) output.
|
36
|
+
.RS
|
37
|
+
.RE
|
38
|
+
.TP
|
39
|
+
.B \-D, \-\-daemonize
|
40
|
+
Run daemonized in the background. The process is detached from
|
41
|
+
the controlling terminal and stdin is redirected to "/dev/null".
|
42
|
+
Unlike many common UNIX daemons, we do not chdir to "/" upon
|
43
|
+
daemonization to allow more control over the startup/upgrade
|
44
|
+
process.
|
45
|
+
Unless specified in the CONFIG_FILE, stderr and stdout will
|
46
|
+
also be redirected to "/dev/null".
|
47
|
+
Daemonization will \f[I]skip\f[] loading of the
|
48
|
+
\f[I]Rails::Rack::LogTailer\f[]
|
49
|
+
middleware under Rails >= 2.3.x.
|
50
|
+
By default, unicorn_rails(1) will create a PID file in
|
51
|
+
\f[I]"RAILS_ROOT/tmp/pids/unicorn.pid"\f[]. You may override this
|
52
|
+
by specifying the "pid" directive to override this Unicorn config file.
|
53
|
+
.RS
|
54
|
+
.RE
|
55
|
+
.TP
|
56
|
+
.B \-E, \-\-env RAILS_ENV
|
57
|
+
Run under the given RAILS_ENV. This sets the RAILS_ENV environment
|
58
|
+
variable. Acceptable values are exactly those you expect in your Rails
|
59
|
+
application, typically "development" or "production".
|
60
|
+
.RS
|
61
|
+
.RE
|
62
|
+
.TP
|
63
|
+
.B \-l, \-\-listen ADDRESS
|
64
|
+
Listens on a given ADDRESS. ADDRESS may be in the form of
|
65
|
+
HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
|
66
|
+
and PATH is meant to be a path to a UNIX domain socket.
|
67
|
+
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080).
|
68
|
+
For production deployments, specifying the "listen" directive in
|
69
|
+
CONFIG_FILE is recommended as it allows fine\-tuning of socket
|
70
|
+
options.
|
71
|
+
.RS
|
72
|
+
.RE
|
73
|
+
.SH RACKUP COMPATIBILITY OPTIONS
|
74
|
+
.TP
|
75
|
+
.B \-o, \-\-host HOST
|
76
|
+
Listen on a TCP socket belonging to HOST, default is
|
77
|
+
"0.0.0.0" (all addresses).
|
78
|
+
If specified multiple times on the command\-line, only the
|
79
|
+
last\-specified value takes effect.
|
80
|
+
This option only exists for compatibility with the rackup(1) command,
|
81
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
82
|
+
.RS
|
83
|
+
.RE
|
84
|
+
.TP
|
85
|
+
.B \-p, \-\-port PORT
|
86
|
+
Listen on the specified TCP PORT, default is 8080.
|
87
|
+
If specified multiple times on the command\-line, only the last\-specified
|
88
|
+
value takes effect.
|
89
|
+
This option only exists for compatibility with the rackup(1) command,
|
90
|
+
use of "\-l"/"\-\-listen" switch is recommended instead.
|
91
|
+
.RS
|
92
|
+
.RE
|
93
|
+
.TP
|
94
|
+
.B \-\-path PATH
|
95
|
+
Mounts the Rails application at the given PATH (instead of "/").
|
96
|
+
This is equivalent to setting the RAILS_RELATIVE_URL_ROOT
|
97
|
+
environment variable. This is only supported under Rails 2.3
|
98
|
+
or later at the moment.
|
99
|
+
.RS
|
100
|
+
.RE
|
101
|
+
.SH RUBY OPTIONS
|
102
|
+
.TP
|
103
|
+
.B \-e, \-\-eval LINE
|
104
|
+
Evaluate a LINE of Ruby code. This evaluation happens
|
105
|
+
immediately as the command\-line is being parsed.
|
106
|
+
.RS
|
107
|
+
.RE
|
108
|
+
.TP
|
109
|
+
.B \-d, \-\-debug
|
110
|
+
Turn on debug mode, the $DEBUG variable is set to true.
|
111
|
+
For Rails >= 2.3.x, this loads the \f[I]Rails::Rack::Debugger\f[]
|
112
|
+
middleware.
|
113
|
+
.RS
|
114
|
+
.RE
|
115
|
+
.TP
|
116
|
+
.B \-w, \-\-warn
|
117
|
+
Turn on verbose warnings, the $VERBOSE variable is set to true.
|
118
|
+
.RS
|
119
|
+
.RE
|
120
|
+
.TP
|
121
|
+
.B \-I, \-\-include PATH
|
122
|
+
specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
|
123
|
+
The \[aq]:\[aq] character may be used to delimit multiple directories.
|
124
|
+
This directive may be used more than once. Modifications to
|
125
|
+
$LOAD_PATH take place immediately and in the order they were
|
126
|
+
specified on the command\-line.
|
127
|
+
.RS
|
128
|
+
.RE
|
129
|
+
.TP
|
130
|
+
.B \-r, \-\-require LIBRARY
|
131
|
+
require a specified LIBRARY before executing the application. The
|
132
|
+
"require" statement will be executed immediately and in the order
|
133
|
+
they were specified on the command\-line.
|
134
|
+
.RS
|
135
|
+
.RE
|
136
|
+
.SH RACKUP FILE
|
137
|
+
.PP
|
138
|
+
This defaults to "config.ru" in RAILS_ROOT. It should be the same
|
139
|
+
file used by rackup(1) and other Rack launchers, it uses the
|
140
|
+
\f[I]Rack::Builder\f[] DSL. Unlike many other Rack applications, RACKUP_FILE
|
141
|
+
is completely \f[I]optional\f[] for Rails, but may be used to disable
|
142
|
+
some of the default middleware for performance.
|
143
|
+
.PP
|
144
|
+
Embedded command\-line options are mostly parsed for compatibility
|
145
|
+
with rackup(1) but strongly discouraged.
|
146
|
+
.SH ENVIRONMENT VARIABLES
|
147
|
+
.PP
|
148
|
+
The RAILS_ENV variable is set by the aforementioned \-E switch. The
|
149
|
+
RAILS_RELATIVE_URL_ROOT is set by the aforementioned \-\-path switch.
|
150
|
+
Either of these variables may also be set in the shell or the Unicorn
|
151
|
+
CONFIG_FILE. All application or library\-specific environment variables
|
152
|
+
(e.g. TMPDIR, RAILS_ASSET_ID) may always be set in the Unicorn
|
153
|
+
CONFIG_FILE in addition to the spawning shell. When transparently
|
154
|
+
upgrading Unicorn, all environment variables set in the old master
|
155
|
+
process are inherited by the new master process. Unicorn only uses (and
|
156
|
+
will overwrite) the UNICORN_FD environment variable internally when
|
157
|
+
doing transparent upgrades.
|
158
|
+
.SH SIGNALS
|
159
|
+
.PP
|
160
|
+
The following UNIX signals may be sent to the master process:
|
161
|
+
.IP \[bu] 2
|
162
|
+
HUP \- reload config file, app, and gracefully restart all workers
|
163
|
+
.IP \[bu] 2
|
164
|
+
INT/TERM \- quick shutdown, kills all workers immediately
|
165
|
+
.IP \[bu] 2
|
166
|
+
QUIT \- graceful shutdown, waits for workers to finish their current
|
167
|
+
request before finishing.
|
168
|
+
.IP \[bu] 2
|
169
|
+
USR1 \- reopen all logs owned by the master and all workers
|
170
|
+
See Unicorn::Util.reopen_logs for what is considered a log.
|
171
|
+
.IP \[bu] 2
|
172
|
+
USR2 \- reexecute the running binary. A separate QUIT
|
173
|
+
should be sent to the original process once the child is verified to
|
174
|
+
be up and running.
|
175
|
+
.IP \[bu] 2
|
176
|
+
WINCH \- gracefully stops workers but keep the master running.
|
177
|
+
This will only work for daemonized processes.
|
178
|
+
.IP \[bu] 2
|
179
|
+
TTIN \- increment the number of worker processes by one
|
180
|
+
.IP \[bu] 2
|
181
|
+
TTOU \- decrement the number of worker processes by one
|
182
|
+
.PP
|
183
|
+
See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
|
184
|
+
full description of all signals used by Unicorn.
|
185
|
+
.SH SEE ALSO
|
186
|
+
.IP \[bu] 2
|
187
|
+
unicorn(1)
|
188
|
+
.IP \[bu] 2
|
189
|
+
\f[I]Rack::Builder\f[] ri/RDoc
|
190
|
+
.IP \[bu] 2
|
191
|
+
\f[I]Unicorn::Configurator\f[] ri/RDoc
|
192
|
+
.UR https://bogomips.org/unicorn/Unicorn/Configurator.html
|
193
|
+
.UE
|
194
|
+
.IP \[bu] 2
|
195
|
+
unicorn RDoc
|
196
|
+
.UR https://bogomips.org/unicorn/
|
197
|
+
.UE
|
198
|
+
.IP \[bu] 2
|
199
|
+
Rack RDoc
|
200
|
+
.UR https://www.rubydoc.info/github/rack/rack/
|
201
|
+
.UE
|
202
|
+
.IP \[bu] 2
|
203
|
+
Rackup HowTo
|
204
|
+
.UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
|
205
|
+
.UE
|
206
|
+
.SH AUTHORS
|
207
|
+
The Unicorn Community <unicorn-public@bogomips.org>.
|
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
@@ -150,13 +150,23 @@ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
|
|
150
150
|
|
151
151
|
clean:
|
152
152
|
-$(MAKE) -C $(ext) clean
|
153
|
-
-$(MAKE) -C Documentation clean
|
154
153
|
$(RM) $(ext)/Makefile
|
155
154
|
$(RM) $(setup_rb_files) $(t_log)
|
156
155
|
$(RM) -r $(test_prefix) man
|
156
|
+
$(RM) $(man1) $(html1)
|
157
157
|
|
158
|
-
|
159
|
-
|
158
|
+
man1 := $(addprefix Documentation/, unicorn.1 unicorn_rails.1)
|
159
|
+
html1 := $(addsuffix .html, $(man1))
|
160
|
+
man :
|
161
|
+
mkdir -p man/man1
|
162
|
+
install -m 644 $(man1) man/man1
|
163
|
+
|
164
|
+
html : $(html1)
|
165
|
+
mkdir -p doc/man1
|
166
|
+
install -m 644 $(html1) doc/man1
|
167
|
+
|
168
|
+
%.1.html: %.1
|
169
|
+
$(OLDDOC) man2html -o $@ ./$<
|
160
170
|
|
161
171
|
pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \
|
162
172
|
$(ext)/unicorn_http.c $(man1_paths)
|
data/examples/unicorn@.service
CHANGED
@@ -14,7 +14,14 @@ After = unicorn.socket
|
|
14
14
|
# bundler users must use the "--keep-file-descriptors" switch, here:
|
15
15
|
# ExecStart = bundle exec --keep-file-descriptors unicorn -c ...
|
16
16
|
ExecStart = /usr/bin/unicorn -c /path/to/unicorn.conf.rb /path/to/config.ru
|
17
|
+
|
18
|
+
# NonBlocking MUST be true if using socket activation with unicorn.
|
19
|
+
# Otherwise, there's a small window in-between when the non-blocking
|
20
|
+
# flag is set by us and our accept4 call where systemd can momentarily
|
21
|
+
# make the socket blocking, causing us to block on accept4:
|
22
|
+
NonBlocking = true
|
17
23
|
Sockets = unicorn.socket
|
24
|
+
|
18
25
|
KillSignal = SIGQUIT
|
19
26
|
User = nobody
|
20
27
|
Group = nogroup
|
data/lib/unicorn/tmpio.rb
CHANGED
@@ -11,12 +11,18 @@ class Unicorn::TmpIO < File
|
|
11
11
|
# immediately, switched to binary mode, and userspace output
|
12
12
|
# buffering is disabled
|
13
13
|
def self.new
|
14
|
+
path = nil
|
15
|
+
|
16
|
+
# workaround File#path being tainted:
|
17
|
+
# https://bugs.ruby-lang.org/issues/14485
|
14
18
|
fp = begin
|
15
|
-
|
19
|
+
path = "#{Dir::tmpdir}/#{rand}"
|
20
|
+
super(path, RDWR|CREAT|EXCL, 0600)
|
16
21
|
rescue Errno::EEXIST
|
17
22
|
retry
|
18
23
|
end
|
19
|
-
|
24
|
+
|
25
|
+
unlink(path)
|
20
26
|
fp.binmode
|
21
27
|
fp.sync = true
|
22
28
|
fp
|
data/test/benchmark/README
CHANGED
@@ -42,9 +42,19 @@ The benchmark client is usually httperf.
|
|
42
42
|
Another gentle reminder: performance with slow networks/clients
|
43
43
|
is NOT our problem. That is the job of nginx (or similar).
|
44
44
|
|
45
|
+
== ddstream.ru
|
46
|
+
|
47
|
+
Standalone Rack app intended to show how BAD we are at slow clients.
|
48
|
+
See usage in comments.
|
49
|
+
|
50
|
+
== readinput.ru
|
51
|
+
|
52
|
+
Standalone Rack app intended to show how bad we are with slow uploaders.
|
53
|
+
See usage in comments.
|
54
|
+
|
45
55
|
== Contributors
|
46
56
|
|
47
|
-
This directory is
|
48
|
-
|
49
|
-
|
50
|
-
|
57
|
+
This directory is intended to remain stable. Do not make changes
|
58
|
+
to benchmarking code which can change performance and invalidate
|
59
|
+
results across revisions. Instead, write new benchmarks and update
|
60
|
+
coments/documentation as necessary.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This app is intended to test large HTTP responses with or without
|
2
|
+
# a fully-buffering reverse proxy such as nginx. Without a fully-buffering
|
3
|
+
# reverse proxy, unicorn will be unresponsive when client count exceeds
|
4
|
+
# worker_processes.
|
5
|
+
#
|
6
|
+
# To demonstrate how bad unicorn is at slowly reading clients:
|
7
|
+
#
|
8
|
+
# # in one terminal, start unicorn with one worker:
|
9
|
+
# unicorn -E none -l 127.0.0.1:8080 test/benchmark/ddstream.ru
|
10
|
+
#
|
11
|
+
# # in a different terminal, start more slow curl processes than
|
12
|
+
# # unicorn workers and watch time outputs
|
13
|
+
# curl --limit-rate 8K --trace-time -vsN http://127.0.0.1:8080/ >/dev/null &
|
14
|
+
# curl --limit-rate 8K --trace-time -vsN http://127.0.0.1:8080/ >/dev/null &
|
15
|
+
# wait
|
16
|
+
#
|
17
|
+
# The last client won't see a response until the first one is done reading
|
18
|
+
#
|
19
|
+
# nginx note: do not change the default "proxy_buffering" behavior.
|
20
|
+
# Setting "proxy_buffering off" prevents nginx from protecting unicorn.
|
21
|
+
|
22
|
+
# totally standalone rack app to stream a giant response
|
23
|
+
class BigResponse
|
24
|
+
def initialize(bs, count)
|
25
|
+
@buf = "#{bs.to_s(16)}\r\n#{' ' * bs}\r\n"
|
26
|
+
@count = count
|
27
|
+
@res = [ 200,
|
28
|
+
{ 'Transfer-Encoding' => -'chunked', 'Content-Type' => 'text/plain' },
|
29
|
+
self
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
# rack response body iterator
|
34
|
+
def each
|
35
|
+
(1..@count).each { yield @buf }
|
36
|
+
yield -"0\r\n\r\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
# rack app entry endpoint
|
40
|
+
def call(_env)
|
41
|
+
@res
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# default to a giant (128M) response because kernel socket buffers
|
46
|
+
# can be ridiculously large on some systems
|
47
|
+
bs = ENV['bs'] ? ENV['bs'].to_i : 65536
|
48
|
+
count = ENV['count'] ? ENV['count'].to_i : 2048
|
49
|
+
warn "serving response with bs=#{bs} count=#{count} (#{bs*count} bytes)"
|
50
|
+
run BigResponse.new(bs, count)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This app is intended to test large HTTP requests with or without
|
2
|
+
# a fully-buffering reverse proxy such as nginx. Without a fully-buffering
|
3
|
+
# reverse proxy, unicorn will be unresponsive when client count exceeds
|
4
|
+
# worker_processes.
|
5
|
+
|
6
|
+
DOC = <<DOC
|
7
|
+
To demonstrate how bad unicorn is at slowly uploading clients:
|
8
|
+
|
9
|
+
# in one terminal, start unicorn with one worker:
|
10
|
+
unicorn -E none -l 127.0.0.1:8080 test/benchmark/readinput.ru
|
11
|
+
|
12
|
+
# in a different terminal, upload 45M from multiple curl processes:
|
13
|
+
dd if=/dev/zero bs=45M count=1 | curl -T- -HExpect: --limit-rate 1M \
|
14
|
+
--trace-time -v http://127.0.0.1:8080/ &
|
15
|
+
dd if=/dev/zero bs=45M count=1 | curl -T- -HExpect: --limit-rate 1M \
|
16
|
+
--trace-time -v http://127.0.0.1:8080/ &
|
17
|
+
wait
|
18
|
+
|
19
|
+
# The last client won't see a response until the first one is done uploading
|
20
|
+
# You also won't be able to make GET requests to view this documentation
|
21
|
+
# while clients are uploading. You can also view the stderr debug output
|
22
|
+
# of unicorn (see logging code in #{__FILE__}).
|
23
|
+
DOC
|
24
|
+
|
25
|
+
run(lambda do |env|
|
26
|
+
input = env['rack.input']
|
27
|
+
buf = ''.b
|
28
|
+
|
29
|
+
# default logger contains timestamps, rely on that so users can
|
30
|
+
# see what the server is doing
|
31
|
+
l = env['rack.logger']
|
32
|
+
|
33
|
+
l.debug('BEGIN reading input ...') if l
|
34
|
+
:nop while input.read(16384, buf)
|
35
|
+
l.debug('DONE reading input ...') if l
|
36
|
+
|
37
|
+
buf.clear
|
38
|
+
[ 200, [ %W(Content-Length #{DOC.size}), %w(Content-Type text/plain) ],
|
39
|
+
[ DOC ] ]
|
40
|
+
end)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/perl -w
|
2
|
+
# Benchmark script to spawn some processes and hammer a local unicorn
|
3
|
+
# to test accept loop performance. This only does Unix sockets.
|
4
|
+
# There's plenty of TCP benchmarking tools out there, and TCP port reuse
|
5
|
+
# has predictability problems since unicorn can't do persistent connections.
|
6
|
+
# Written in Perl for the same reason: predictability.
|
7
|
+
# Ruby GC is not as predictable as Perl refcounting.
|
8
|
+
use strict;
|
9
|
+
use Socket qw(AF_UNIX SOCK_STREAM sockaddr_un);
|
10
|
+
use POSIX qw(:sys_wait_h);
|
11
|
+
use Getopt::Std;
|
12
|
+
# -c / -n switches stolen from ab(1)
|
13
|
+
my $usage = "$0 [-c CONCURRENCY] [-n NUM_REQUESTS] SOCKET_PATH\n";
|
14
|
+
our $opt_c = 2;
|
15
|
+
our $opt_n = 1000;
|
16
|
+
getopts('c:n:') or die $usage;
|
17
|
+
my $unix_path = shift or die $usage;
|
18
|
+
use constant REQ => "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n";
|
19
|
+
use constant REQ_LEN => length(REQ);
|
20
|
+
use constant BUFSIZ => 8192;
|
21
|
+
$^F = 99; # don't waste syscall time with FD_CLOEXEC
|
22
|
+
|
23
|
+
my %workers; # pid => worker num
|
24
|
+
die "-n $opt_n not evenly divisible by -c $opt_c\n" if $opt_n % $opt_c;
|
25
|
+
my $n_per_worker = $opt_n / $opt_c;
|
26
|
+
my $addr = sockaddr_un($unix_path);
|
27
|
+
|
28
|
+
for my $num (1..$opt_c) {
|
29
|
+
defined(my $pid = fork) or die "fork failed: $!\n";
|
30
|
+
if ($pid) {
|
31
|
+
$workers{$pid} = $num;
|
32
|
+
} else {
|
33
|
+
work($n_per_worker);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
reap_worker(0) while scalar keys %workers;
|
38
|
+
exit;
|
39
|
+
|
40
|
+
sub work {
|
41
|
+
my ($n) = @_;
|
42
|
+
my ($buf, $x);
|
43
|
+
for (1..$n) {
|
44
|
+
socket(S, AF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
|
45
|
+
connect(S, $addr) or die "connect: $!";
|
46
|
+
defined($x = syswrite(S, REQ)) or die "write: $!";
|
47
|
+
$x == REQ_LEN or die "short write: $x != ".REQ_LEN."\n";
|
48
|
+
do {
|
49
|
+
$x = sysread(S, $buf, BUFSIZ);
|
50
|
+
unless (defined $x) {
|
51
|
+
next if $!{EINTR};
|
52
|
+
die "sysread: $!\n";
|
53
|
+
}
|
54
|
+
} until ($x == 0);
|
55
|
+
}
|
56
|
+
exit 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
sub reap_worker {
|
60
|
+
my ($flags) = @_;
|
61
|
+
my $pid = waitpid(-1, $flags);
|
62
|
+
return if !defined $pid || $pid <= 0;
|
63
|
+
my $p = delete $workers{$pid} || '(unknown)';
|
64
|
+
warn("$pid [$p] exited with $?\n") if $?;
|
65
|
+
$p;
|
66
|
+
}
|
data/test/unit/test_util.rb
CHANGED
@@ -114,7 +114,7 @@ def test_pipe
|
|
114
114
|
f_getpipe_sz = 1032
|
115
115
|
IO.pipe do |a, b|
|
116
116
|
a_sz = a.fcntl(f_getpipe_sz)
|
117
|
-
|
117
|
+
b.fcntl(f_getpipe_sz)
|
118
118
|
assert_kind_of Integer, a_sz
|
119
119
|
r_sz = r.fcntl(f_getpipe_sz)
|
120
120
|
assert_equal Raindrops::PAGE_SIZE, r_sz
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unicorn hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -120,9 +120,8 @@ files:
|
|
120
120
|
- COPYING
|
121
121
|
- DESIGN
|
122
122
|
- Documentation/.gitignore
|
123
|
-
- Documentation/
|
124
|
-
- Documentation/
|
125
|
-
- Documentation/unicorn_rails.1.txt
|
123
|
+
- Documentation/unicorn.1
|
124
|
+
- Documentation/unicorn_rails.1
|
126
125
|
- FAQ
|
127
126
|
- GIT-VERSION-FILE
|
128
127
|
- GIT-VERSION-GEN
|
@@ -248,7 +247,10 @@ files:
|
|
248
247
|
- test/aggregate.rb
|
249
248
|
- test/benchmark/README
|
250
249
|
- test/benchmark/dd.ru
|
250
|
+
- test/benchmark/ddstream.ru
|
251
|
+
- test/benchmark/readinput.ru
|
251
252
|
- test/benchmark/stack.ru
|
253
|
+
- test/benchmark/uconnect.perl
|
252
254
|
- test/exec/README
|
253
255
|
- test/exec/test_exec.rb
|
254
256
|
- test/test_helper.rb
|
data/Documentation/GNUmakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
all::
|
2
|
-
|
3
|
-
PANDOC = pandoc
|
4
|
-
PANDOC_OPTS = -f markdown --email-obfuscation=none
|
5
|
-
pandoc = $(PANDOC) $(PANDOC_OPTS)
|
6
|
-
pandoc_html = $(pandoc) --toc -t html --no-wrap
|
7
|
-
|
8
|
-
man1 := $(addsuffix .1,unicorn unicorn_rails)
|
9
|
-
html1 := $(addsuffix .html,$(man1))
|
10
|
-
|
11
|
-
all:: html man
|
12
|
-
|
13
|
-
html: $(html1)
|
14
|
-
man: $(man1)
|
15
|
-
|
16
|
-
install-html: html
|
17
|
-
mkdir -p ../doc/man1
|
18
|
-
install -m 644 $(html1) ../doc/man1
|
19
|
-
|
20
|
-
install-man: man
|
21
|
-
mkdir -p ../man/man1
|
22
|
-
install -m 644 $(man1) ../man/man1
|
23
|
-
|
24
|
-
%.1: %.1.txt
|
25
|
-
$(pandoc) -s -t man < $< > $@+ && mv $@+ $@
|
26
|
-
%.1.html: %.1.txt
|
27
|
-
$(pandoc_html) < $< > $@+ && mv $@+ $@
|
28
|
-
|
29
|
-
clean::
|
30
|
-
$(RM) $(man1) $(html1)
|
data/Documentation/unicorn.1.txt
DELETED
@@ -1,187 +0,0 @@
|
|
1
|
-
% UNICORN(1) Unicorn User Manual
|
2
|
-
% The Unicorn Community <unicorn-public@bogomips.org>
|
3
|
-
% September 15, 2009
|
4
|
-
|
5
|
-
# NAME
|
6
|
-
|
7
|
-
unicorn - a rackup-like command to launch the Unicorn HTTP server
|
8
|
-
|
9
|
-
# SYNOPSIS
|
10
|
-
|
11
|
-
unicorn [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE]
|
12
|
-
|
13
|
-
# DESCRIPTION
|
14
|
-
|
15
|
-
A rackup(1)-like command to launch Rack applications using Unicorn.
|
16
|
-
It is expected to be started in your application root (APP_ROOT),
|
17
|
-
but the "working_directory" directive may be used in the CONFIG_FILE.
|
18
|
-
|
19
|
-
While unicorn takes a myriad of command-line options for
|
20
|
-
compatibility with ruby(1) and rackup(1), it is recommended to stick
|
21
|
-
to the few command-line options specified in the SYNOPSIS and use
|
22
|
-
the CONFIG_FILE as much as possible.
|
23
|
-
|
24
|
-
# RACKUP FILE
|
25
|
-
|
26
|
-
This defaults to \"config.ru\" in APP_ROOT. It should be the same
|
27
|
-
file used by rackup(1) and other Rack launchers, it uses the
|
28
|
-
*Rack::Builder* DSL.
|
29
|
-
|
30
|
-
Embedded command-line options are mostly parsed for compatibility
|
31
|
-
with rackup(1) but strongly discouraged.
|
32
|
-
|
33
|
-
# UNICORN OPTIONS
|
34
|
-
-c, \--config-file CONFIG_FILE
|
35
|
-
: Path to the Unicorn-specific config file. The config file is
|
36
|
-
implemented as a Ruby DSL, so Ruby code may executed.
|
37
|
-
See the RDoc/ri for the *Unicorn::Configurator* class for the full
|
38
|
-
list of directives available from the DSL.
|
39
|
-
Using an absolute path for for CONFIG_FILE is recommended as it
|
40
|
-
makes multiple instances of Unicorn easily distinguishable when
|
41
|
-
viewing ps(1) output.
|
42
|
-
|
43
|
-
-D, \--daemonize
|
44
|
-
: Run daemonized in the background. The process is detached from
|
45
|
-
the controlling terminal and stdin is redirected to "/dev/null".
|
46
|
-
Unlike many common UNIX daemons, we do not chdir to \"/\"
|
47
|
-
upon daemonization to allow more control over the startup/upgrade
|
48
|
-
process.
|
49
|
-
Unless specified in the CONFIG_FILE, stderr and stdout will
|
50
|
-
also be redirected to "/dev/null".
|
51
|
-
|
52
|
-
-E, \--env RACK_ENV
|
53
|
-
: Run under the given RACK_ENV. See the RACK ENVIRONMENT section
|
54
|
-
for more details.
|
55
|
-
|
56
|
-
-l, \--listen ADDRESS
|
57
|
-
: Listens on a given ADDRESS. ADDRESS may be in the form of
|
58
|
-
HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
|
59
|
-
and PATH is meant to be a path to a UNIX domain socket.
|
60
|
-
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080)
|
61
|
-
For production deployments, specifying the "listen" directive in
|
62
|
-
CONFIG_FILE is recommended as it allows fine-tuning of socket
|
63
|
-
options.
|
64
|
-
-N, \--no-default-middleware
|
65
|
-
: Disables loading middleware implied by RACK_ENV. This bypasses the
|
66
|
-
configuration documented in the RACK ENVIRONMENT section, but still
|
67
|
-
allows RACK_ENV to be used for application/framework-specific purposes.
|
68
|
-
|
69
|
-
# RACKUP COMPATIBILITY OPTIONS
|
70
|
-
-o, \--host HOST
|
71
|
-
: Listen on a TCP socket belonging to HOST, default is
|
72
|
-
"0.0.0.0" (all addresses).
|
73
|
-
If specified multiple times on the command-line, only the
|
74
|
-
last-specified value takes effect.
|
75
|
-
This option only exists for compatibility with the rackup(1) command,
|
76
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
77
|
-
|
78
|
-
-p, \--port PORT
|
79
|
-
: Listen on the specified TCP PORT, default is 8080.
|
80
|
-
If specified multiple times on the command-line, only the last-specified
|
81
|
-
value takes effect.
|
82
|
-
This option only exists for compatibility with the rackup(1) command,
|
83
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
84
|
-
|
85
|
-
-s, \--server SERVER
|
86
|
-
: No-op, this exists only for compatibility with rackup(1).
|
87
|
-
|
88
|
-
# RUBY OPTIONS
|
89
|
-
-e, \--eval LINE
|
90
|
-
: Evaluate a LINE of Ruby code. This evaluation happens
|
91
|
-
immediately as the command-line is being parsed.
|
92
|
-
|
93
|
-
-d, \--debug
|
94
|
-
: Turn on debug mode, the $DEBUG variable is set to true.
|
95
|
-
|
96
|
-
-w, \--warn
|
97
|
-
: Turn on verbose warnings, the $VERBOSE variable is set to true.
|
98
|
-
|
99
|
-
-I, \--include PATH
|
100
|
-
: specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
|
101
|
-
The \':\' character may be used to delimit multiple directories.
|
102
|
-
This directive may be used more than once. Modifications to
|
103
|
-
$LOAD_PATH take place immediately and in the order they were
|
104
|
-
specified on the command-line.
|
105
|
-
|
106
|
-
-r, \--require LIBRARY
|
107
|
-
: require a specified LIBRARY before executing the application. The
|
108
|
-
\"require\" statement will be executed immediately and in the order
|
109
|
-
they were specified on the command-line.
|
110
|
-
|
111
|
-
# SIGNALS
|
112
|
-
|
113
|
-
The following UNIX signals may be sent to the master process:
|
114
|
-
|
115
|
-
* HUP - reload config file, app, and gracefully restart all workers
|
116
|
-
* INT/TERM - quick shutdown, kills all workers immediately
|
117
|
-
* QUIT - graceful shutdown, waits for workers to finish their
|
118
|
-
current request before finishing.
|
119
|
-
* USR1 - reopen all logs owned by the master and all workers
|
120
|
-
See Unicorn::Util.reopen_logs for what is considered a log.
|
121
|
-
* USR2 - reexecute the running binary. A separate QUIT
|
122
|
-
should be sent to the original process once the child is verified to
|
123
|
-
be up and running.
|
124
|
-
* WINCH - gracefully stops workers but keep the master running.
|
125
|
-
This will only work for daemonized processes.
|
126
|
-
* TTIN - increment the number of worker processes by one
|
127
|
-
* TTOU - decrement the number of worker processes by one
|
128
|
-
|
129
|
-
See the [SIGNALS][4] document for full description of all signals
|
130
|
-
used by Unicorn.
|
131
|
-
|
132
|
-
# RACK ENVIRONMENT
|
133
|
-
|
134
|
-
Accepted values of RACK_ENV and the middleware they automatically load
|
135
|
-
(outside of RACKUP_FILE) are exactly as those in rackup(1):
|
136
|
-
|
137
|
-
* development - loads Rack::CommonLogger, Rack::ShowExceptions, and
|
138
|
-
Rack::Lint middleware
|
139
|
-
* deployment - loads Rack::CommonLogger middleware
|
140
|
-
* none - loads no middleware at all, relying
|
141
|
-
entirely on RACKUP_FILE
|
142
|
-
|
143
|
-
All unrecognized values for RACK_ENV are assumed to be
|
144
|
-
"none". Production deployments are strongly encouraged to use
|
145
|
-
"deployment" or "none" for maximum performance.
|
146
|
-
|
147
|
-
As of Unicorn 0.94.0, RACK_ENV is exported as a process-wide environment
|
148
|
-
variable as well. While not current a part of the Rack specification as
|
149
|
-
of Rack 1.0.1, this has become a de facto standard in the Rack world.
|
150
|
-
|
151
|
-
Note the Rack::ContentLength and Rack::Chunked middlewares are also
|
152
|
-
loaded by "deployment" and "development", but no other values of
|
153
|
-
RACK_ENV. If needed, they must be individually specified in the
|
154
|
-
RACKUP_FILE, some frameworks do not require them.
|
155
|
-
|
156
|
-
# ENVIRONMENT VARIABLES
|
157
|
-
|
158
|
-
The RACK_ENV variable is set by the aforementioned \-E switch.
|
159
|
-
All application or library-specific environment variables (e.g. TMPDIR)
|
160
|
-
may always be set in the Unicorn CONFIG_FILE in addition to the spawning
|
161
|
-
shell. When transparently upgrading Unicorn, all environment variables
|
162
|
-
set in the old master process are inherited by the new master process.
|
163
|
-
Unicorn only uses (and will overwrite) the UNICORN_FD environment
|
164
|
-
variable internally when doing transparent upgrades.
|
165
|
-
|
166
|
-
UNICORN_FD is a comma-delimited list of one or more file descriptors
|
167
|
-
used to implement USR2 upgrades. Init systems may bind listen sockets
|
168
|
-
itself and spawn unicorn with UNICORN_FD set to the file descriptor
|
169
|
-
numbers of the listen socket(s).
|
170
|
-
|
171
|
-
As of unicorn 5.0, LISTEN_PID and LISTEN_FDS are used for socket
|
172
|
-
activation as documented in the sd_listen_fds(3) manpage. Users
|
173
|
-
relying on this feature do not need to specify a listen socket in
|
174
|
-
the unicorn config file.
|
175
|
-
|
176
|
-
# SEE ALSO
|
177
|
-
|
178
|
-
* *Rack::Builder* ri/RDoc
|
179
|
-
* *Unicorn::Configurator* ri/RDoc
|
180
|
-
* [Unicorn RDoc][1]
|
181
|
-
* [Rack RDoc][2]
|
182
|
-
* [Rackup HowTo][3]
|
183
|
-
|
184
|
-
[1]: https://bogomips.org/unicorn/
|
185
|
-
[2]: https://www.rubydoc.info/github/rack/rack/
|
186
|
-
[3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
|
187
|
-
[4]: https://bogomips.org/unicorn/SIGNALS.html
|
@@ -1,173 +0,0 @@
|
|
1
|
-
% UNICORN_RAILS(1) Unicorn User Manual
|
2
|
-
% The Unicorn Community <unicorn-public@bogomips.org>
|
3
|
-
% September 17, 2009
|
4
|
-
|
5
|
-
# NAME
|
6
|
-
|
7
|
-
unicorn_rails - unicorn launcher for Rails 1.x and 2.x users
|
8
|
-
|
9
|
-
# SYNOPSIS
|
10
|
-
|
11
|
-
unicorn_rails [-c CONFIG_FILE] [-E RAILS_ENV] [-D] [RACKUP_FILE]
|
12
|
-
|
13
|
-
# DESCRIPTION
|
14
|
-
|
15
|
-
A rackup(1)-like command to launch ancient Rails (2.x and earlier)
|
16
|
-
applications using Unicorn. Rails 3 (and later) support Rack natively,
|
17
|
-
so users are encouraged to use unicorn(1) instead of unicorn_rails(1).
|
18
|
-
|
19
|
-
It is expected to be started in your Rails application root (RAILS_ROOT),
|
20
|
-
but the "working_directory" directive may be used in the CONFIG_FILE.
|
21
|
-
|
22
|
-
The outward interface resembles rackup(1), the internals and default
|
23
|
-
middleware loading is designed like the `script/server` command
|
24
|
-
distributed with Rails.
|
25
|
-
|
26
|
-
While Unicorn takes a myriad of command-line options for compatibility
|
27
|
-
with ruby(1) and rackup(1), it is recommended to stick to the few
|
28
|
-
command-line options specified in the SYNOPSIS and use the CONFIG_FILE
|
29
|
-
as much as possible.
|
30
|
-
|
31
|
-
# UNICORN OPTIONS
|
32
|
-
-c, \--config-file CONFIG_FILE
|
33
|
-
: Path to the Unicorn-specific config file. The config file is
|
34
|
-
implemented as a Ruby DSL, so Ruby code may executed.
|
35
|
-
See the RDoc/ri for the *Unicorn::Configurator* class for the full
|
36
|
-
list of directives available from the DSL.
|
37
|
-
Using an absolute path for for CONFIG_FILE is recommended as it
|
38
|
-
makes multiple instances of Unicorn easily distinguishable when
|
39
|
-
viewing ps(1) output.
|
40
|
-
|
41
|
-
-D, \--daemonize
|
42
|
-
: Run daemonized in the background. The process is detached from
|
43
|
-
the controlling terminal and stdin is redirected to "/dev/null".
|
44
|
-
Unlike many common UNIX daemons, we do not chdir to \"/\"
|
45
|
-
upon daemonization to allow more control over the startup/upgrade
|
46
|
-
process.
|
47
|
-
Unless specified in the CONFIG_FILE, stderr and stdout will
|
48
|
-
also be redirected to "/dev/null".
|
49
|
-
Daemonization will _skip_ loading of the *Rails::Rack::LogTailer*
|
50
|
-
middleware under Rails \>\= 2.3.x.
|
51
|
-
By default, unicorn\_rails(1) will create a PID file in
|
52
|
-
_\"RAILS\_ROOT/tmp/pids/unicorn.pid\"_. You may override this
|
53
|
-
by specifying the "pid" directive to override this Unicorn config file.
|
54
|
-
|
55
|
-
-E, \--env RAILS_ENV
|
56
|
-
: Run under the given RAILS_ENV. This sets the RAILS_ENV environment
|
57
|
-
variable. Acceptable values are exactly those you expect in your Rails
|
58
|
-
application, typically "development" or "production".
|
59
|
-
|
60
|
-
-l, \--listen ADDRESS
|
61
|
-
: Listens on a given ADDRESS. ADDRESS may be in the form of
|
62
|
-
HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
|
63
|
-
and PATH is meant to be a path to a UNIX domain socket.
|
64
|
-
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080).
|
65
|
-
For production deployments, specifying the "listen" directive in
|
66
|
-
CONFIG_FILE is recommended as it allows fine-tuning of socket
|
67
|
-
options.
|
68
|
-
|
69
|
-
# RACKUP COMPATIBILITY OPTIONS
|
70
|
-
-o, \--host HOST
|
71
|
-
: Listen on a TCP socket belonging to HOST, default is
|
72
|
-
"0.0.0.0" (all addresses).
|
73
|
-
If specified multiple times on the command-line, only the
|
74
|
-
last-specified value takes effect.
|
75
|
-
This option only exists for compatibility with the rackup(1) command,
|
76
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
77
|
-
|
78
|
-
-p, \--port PORT
|
79
|
-
: Listen on the specified TCP PORT, default is 8080.
|
80
|
-
If specified multiple times on the command-line, only the last-specified
|
81
|
-
value takes effect.
|
82
|
-
This option only exists for compatibility with the rackup(1) command,
|
83
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
84
|
-
|
85
|
-
\--path PATH
|
86
|
-
: Mounts the Rails application at the given PATH (instead of "/").
|
87
|
-
This is equivalent to setting the RAILS_RELATIVE_URL_ROOT
|
88
|
-
environment variable. This is only supported under Rails 2.3
|
89
|
-
or later at the moment.
|
90
|
-
|
91
|
-
# RUBY OPTIONS
|
92
|
-
-e, \--eval LINE
|
93
|
-
: Evaluate a LINE of Ruby code. This evaluation happens
|
94
|
-
immediately as the command-line is being parsed.
|
95
|
-
|
96
|
-
-d, \--debug
|
97
|
-
: Turn on debug mode, the $DEBUG variable is set to true.
|
98
|
-
For Rails \>\= 2.3.x, this loads the *Rails::Rack::Debugger*
|
99
|
-
middleware.
|
100
|
-
|
101
|
-
-w, \--warn
|
102
|
-
: Turn on verbose warnings, the $VERBOSE variable is set to true.
|
103
|
-
|
104
|
-
-I, \--include PATH
|
105
|
-
: specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
|
106
|
-
The \':\' character may be used to delimit multiple directories.
|
107
|
-
This directive may be used more than once. Modifications to
|
108
|
-
$LOAD_PATH take place immediately and in the order they were
|
109
|
-
specified on the command-line.
|
110
|
-
|
111
|
-
-r, \--require LIBRARY
|
112
|
-
: require a specified LIBRARY before executing the application. The
|
113
|
-
\"require\" statement will be executed immediately and in the order
|
114
|
-
they were specified on the command-line.
|
115
|
-
|
116
|
-
# RACKUP FILE
|
117
|
-
|
118
|
-
This defaults to \"config.ru\" in RAILS_ROOT. It should be the same
|
119
|
-
file used by rackup(1) and other Rack launchers, it uses the
|
120
|
-
*Rack::Builder* DSL. Unlike many other Rack applications, RACKUP_FILE
|
121
|
-
is completely _optional_ for Rails, but may be used to disable some
|
122
|
-
of the default middleware for performance.
|
123
|
-
|
124
|
-
Embedded command-line options are mostly parsed for compatibility
|
125
|
-
with rackup(1) but strongly discouraged.
|
126
|
-
|
127
|
-
# ENVIRONMENT VARIABLES
|
128
|
-
|
129
|
-
The RAILS_ENV variable is set by the aforementioned \-E switch. The
|
130
|
-
RAILS_RELATIVE_URL_ROOT is set by the aforementioned \--path switch.
|
131
|
-
Either of these variables may also be set in the shell or the Unicorn
|
132
|
-
CONFIG_FILE. All application or library-specific environment variables
|
133
|
-
(e.g. TMPDIR, RAILS_ASSET_ID) may always be set in the Unicorn
|
134
|
-
CONFIG_FILE in addition to the spawning shell. When transparently
|
135
|
-
upgrading Unicorn, all environment variables set in the old master
|
136
|
-
process are inherited by the new master process. Unicorn only uses (and
|
137
|
-
will overwrite) the UNICORN_FD environment variable internally when
|
138
|
-
doing transparent upgrades.
|
139
|
-
|
140
|
-
# SIGNALS
|
141
|
-
|
142
|
-
The following UNIX signals may be sent to the master process:
|
143
|
-
|
144
|
-
* HUP - reload config file, app, and gracefully restart all workers
|
145
|
-
* INT/TERM - quick shutdown, kills all workers immediately
|
146
|
-
* QUIT - graceful shutdown, waits for workers to finish their
|
147
|
-
current request before finishing.
|
148
|
-
* USR1 - reopen all logs owned by the master and all workers
|
149
|
-
See Unicorn::Util.reopen_logs for what is considered a log.
|
150
|
-
* USR2 - reexecute the running binary. A separate QUIT
|
151
|
-
should be sent to the original process once the child is verified to
|
152
|
-
be up and running.
|
153
|
-
* WINCH - gracefully stops workers but keep the master running.
|
154
|
-
This will only work for daemonized processes.
|
155
|
-
* TTIN - increment the number of worker processes by one
|
156
|
-
* TTOU - decrement the number of worker processes by one
|
157
|
-
|
158
|
-
See the [SIGNALS][4] document for full description of all signals
|
159
|
-
used by Unicorn.
|
160
|
-
|
161
|
-
# SEE ALSO
|
162
|
-
|
163
|
-
* unicorn(1)
|
164
|
-
* *Rack::Builder* ri/RDoc
|
165
|
-
* *Unicorn::Configurator* ri/RDoc
|
166
|
-
* [Unicorn RDoc][1]
|
167
|
-
* [Rack RDoc][2]
|
168
|
-
* [Rackup HowTo][3]
|
169
|
-
|
170
|
-
[1]: https://bogomips.org/unicorn/
|
171
|
-
[2]: https://www.rubydoc.info/github/rack/rack/
|
172
|
-
[3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
|
173
|
-
[4]: https://bogomips.org/unicorn/SIGNALS.html
|