t/lib.perl: fix Perl integration tests w/o installation
[unicorn.git] / Documentation / unicorn.1
blobb2c5e700460804441372f563163436b911fc8ddf
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
101 .B \-e, \-\-eval LINE
102 Evaluate a LINE of Ruby code.  This evaluation happens
103 immediately as the command\-line is being parsed.
107 .B \-d, \-\-debug
108 Turn on debug mode, the $DEBUG variable is set to true.
112 .B \-w, \-\-warn
113 Turn on verbose warnings, the $VERBOSE variable is set to true.
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.
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.
132 .SH SIGNALS
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
157 See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
158 full description of all signals used by Unicorn.
159 .SH RACK ENVIRONMENT
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
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.
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.
179 Note the Rack::ContentLength middleware is 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
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.
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).
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://yhbt.net/unicorn/Unicorn/Configurator.html
209 .IP \[bu] 2
210 unicorn RDoc
211 .UR https://yhbt.net/unicorn/
213 .IP \[bu] 2
214 Rack RDoc
215 .UR https://www.rubydoc.info/github/rack/rack/
217 .IP \[bu] 2
218 Rackup HowTo
219 .UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
221 .SH AUTHORS
222 The Unicorn Community <unicorn-public@yhbt.net>.