.TH zbatery 1 "December 9, 2009" "Zbatery User Manual" .SH NAME .PP zbatery - rackup-like command to launch Zbatery .SH SYNOPSIS .PP zbatery [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE] .SH DESCRIPTION .PP A rackup(1)-like command to launch Rack applications using Zbatery. It is expected to be started in your application root (APP_ROOT), but the \[lq]working_directory\[rq] directive may be used in the CONFIG_FILE. .PP While Zbatery takes a myriad of command-line options for compatibility with ruby(1) and rackup(1), it is recommended to stick to the few command-line options specified in the SYNOPSIS and use the CONFIG_FILE as much as possible. .SH RACKUP FILE .PP This defaults to "config.ru" in APP_ROOT. It should be the same file used by rackup(1) and other Rack launchers, it uses the \f[I]Rack::Builder\f[] DSL. .PP Embedded command-line options are mostly parsed for compatibility with rackup(1) but strongly discouraged. .SH UNICORN OPTIONS .TP .B -c, --config-file CONFIG_FILE Path to the Unicorn-specific config file. The config file is implemented as a Ruby DSL, so Ruby code may executed. See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the full list of directives available from the DSL. .RS .RE .TP .B -D, --daemonize Run daemonized in the background. The process is detached from the controlling terminal and stdin is redirected to \[lq]/dev/null\[rq]. Unlike many common UNIX daemons, we do not chdir to "/" upon daemonization to allow more control over the startup/upgrade process. Unless specified in the CONFIG_FILE, stderr and stdout will also be redirected to \[lq]/dev/null\[rq]. .RS .RE .TP .B -E, --env RACK_ENV Run under the given RACK_ENV. See the RACK ENVIRONMENT section for more details. .RS .RE .TP .B -l, --listen ADDRESS Listens on a given ADDRESS. ADDRESS may be in the form of HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket and PATH is meant to be a path to a UNIX domain socket. Defaults to \[lq]0.0.0.0:8080\[rq] (all addresses on TCP port 8080) For production deployments, specifying the \[lq]listen\[rq] directive in CONFIG_FILE is recommended as it allows fine-tuning of socket options. .RS .RE .SH RACKUP COMPATIBILITY OPTIONS .TP .B -o, --host HOST Listen on a TCP socket belonging to HOST, default is \[lq]0.0.0.0\[rq] (all addresses). If specified multiple times on the command-line, only the last-specified value takes effect. This option only exists for compatibility with the rackup(1) command, use of \[lq]-l\[rq]/\[lq]--listen\[rq] switch is recommended instead. .RS .RE .TP .B -p, --port PORT Listen on the specified TCP PORT, default is 8080. If specified multiple times on the command-line, only the last-specified value takes effect. This option only exists for compatibility with the rackup(1) command, use of \[lq]-l\[rq]/\[lq]--listen\[rq] switch is recommended instead. .RS .RE .TP .B -s, --server SERVER No-op, this exists only for compatibility with rackup(1). .RS .RE .SH RUBY OPTIONS .TP .B -e, --eval LINE Evaluate a LINE of Ruby code. This evaluation happens immediately as the command-line is being parsed. .RS .RE .TP .B -d, --debug Turn on debug mode, the $DEBUG variable is set to true. .RS .RE .TP .B -w, --warn Turn on verbose warnings, the $VERBOSE variable is set to true. .RS .RE .TP .B -I, --include PATH specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH. The \[aq]:\[aq] character may be used to delimit multiple directories. This directive may be used more than once. Modifications to $LOAD_PATH take place immediately and in the order they were specified on the command-line. .RS .RE .TP .B -r, --require LIBRARY require a specified LIBRARY before executing the application. The "require" statement will be executed immediately and in the order they were specified on the command-line. .RS .RE .SH SIGNALS .PP The following UNIX signals may be sent to Zbatery (only supported on UNIX): .IP \[bu] 2 HUP - reexecute the binary and exit the current one .IP \[bu] 2 INT/TERM - quick shutdown, quit immediately .IP \[bu] 2 QUIT - graceful shutdown, waits for current requests before exiting .IP \[bu] 2 USR1 - reopen all logs owned by the master and all workers See Unicorn::Util.reopen_logs for what is considered a log. .IP \[bu] 2 USR2 - reexecute the running binary. A separate QUIT should be sent to the original process once the child is verified to be up and running. .SH RACK ENVIRONMENT .PP Accepted values of RACK_ENV and the middleware they automatically load (outside of RACKUP_FILE) are exactly as those in rackup(1): .IP \[bu] 2 development - loads Rack::CommonLogger, Rack::ShowExceptions, and Rack::Lint middleware .IP \[bu] 2 deployment - loads Rack::CommonLogger middleware .IP \[bu] 2 none - loads no middleware at all, relying entirely on RACKUP_FILE .PP All unrecognized values for RACK_ENV are assumed to be \[lq]none\[rq]. Production deployments are strongly encouraged to use \[lq]deployment\[rq] or \[lq]none\[rq] for maximum performance. .PP Note that the Rack::ContentLength and Rack::Chunked middlewares are never loaded by default. If needed, they should be individually specified in the RACKUP_FILE, some frameworks do not require them. .SH SEE ALSO .IP \[bu] 2 unicorn(1) .IP \[bu] 2 rainbows(1) .IP \[bu] 2 \f[I]Rack::Builder\f[] ri/RDoc .IP \[bu] 2 \f[I]Unicorn::Configurator\f[] ri/RDoc .IP \[bu] 2 Zbatery RDoc (http://zbatery.bogomip.org/) .IP \[bu] 2 Rack RDoc (http://rack.rubyforge.org/doc/) .IP \[bu] 2 Rackup HowTo (http://wiki.github.com/rack/rack/tutorial-rackup-howto) .IP \[bu] 2 Rainbows! RDoc (http://rainbows.rubyforge.org/) .SH AUTHOR Zbatery hackers