Rakefile: kill raa_update task
[unicorn.git] / Documentation / unicorn.1.txt
bloba42dfffe028737238cbb4e8e1373e0b84573dbe6
1 % UNICORN(1) Unicorn User Manual
2 % The Unicorn Community <mongrel-unicorn@rubyforge.org>
3 % September 15, 2009
5 # NAME
7 unicorn - a rackup-like command to launch the Unicorn HTTP server
9 # SYNOPSIS
11 unicorn [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE]
13 # DESCRIPTION
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.
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.
24 # RACKUP FILE
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.
30 Embedded command-line options are mostly parsed for compatibility
31 with rackup(1) but strongly discouraged.
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.
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".
52 -E, \--env RACK_ENV
53 :   Run under the given RACK_ENV.  See the RACK ENVIRONMENT section
54     for more details.
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.
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.
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.
85 -s, \--server SERVER
86 :   No-op, this exists only for compatibility with rackup(1).
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.
93 -d, \--debug
94 :   Turn on debug mode, the $DEBUG variable is set to true.
96 -w, \--warn
97 :   Turn on verbose warnings, the $VERBOSE variable is set to true.
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.
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.
111 # SIGNALS
113 The following UNIX signals may be sent to the master process:
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
129 See the [SIGNALS][4] document for full description of all signals
130 used by Unicorn.
132 #  RACK ENVIRONMENT
134 Accepted values of RACK_ENV and the middleware they automatically load
135 (outside of RACKUP_FILE) are exactly as those in rackup(1):
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
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.
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.
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.
156 # ENVIRONMENT VARIABLES
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.
166 # SEE ALSO
168 * unicorn_rails(1)
169 * *Rack::Builder* ri/RDoc
170 * *Unicorn::Configurator* ri/RDoc
171 * [Unicorn RDoc][1]
172 * [Rack RDoc][2]
173 * [Rackup HowTo][3]
175 [1]: http://unicorn.bogomips.org/
176 [2]: http://rack.rubyforge.org/doc/
177 [3]: http://wiki.github.com/rack/rack/tutorial-rackup-howto
178 [4]: http://unicorn.bogomips.org/SIGNALS.html