Fix a warning about @pid being uninitialized
[unicorn.git] / README
blobc12dbf2af94f55b05a7bdd5171e6abed8329c9cc
1 = Unicorn: Unix + LAN/localhost-only fork of Mongrel
3 == Features
5 * Designed for Rack, Unix, fast clients, and ease-of-debugging.  We
6   cut out all things that are better-supported by nginx or Rack.
8 * Mostly written in Ruby, only the HTTP parser (stolen and trimmed
9   down from Mongrel) is written in C.  Unicorn is compatible with
10   both Ruby 1.8 and 1.9.  A pure-Ruby (but still Unix-only) version
11   is planned.
13 * Process management: Unicorn will reap and restart workers that
14   die from broken apps.  There is no need to manage multiple processes
15   or ports yourself.  Unicorn can spawn and manage any fixed number of
16   worker processes you choose to scale to your backend.
18 * Load balancing is done entirely by the operating system kernel.
19   Requests never pile up behind a busy worker process.
21 * Does not care if your application is thread-safe or not, workers
22   all run within their own isolated address space and only serve one
23   client at a time.
25 * Supports all Rack applications, along with pre-Rack versions of
26   Ruby on Rails via a Rack wrapper.
28 * Builtin reopening of all log files in your application via
29   USR1 signal.  This allows logrotate to rotate files atomically and
30   quickly via rename instead of the racy and slow copytruncate method.
31   Unicorn also takes steps to ensure multi-line log entries from one
32   request all stay within the same file.
34 * nginx-style binary re-execution without losing connections.
35   You can upgrade Unicorn, your entire application, libraries
36   and even your Ruby interpreter as long as Unicorn is
37   installed in the same path.
39 * before_fork and after_fork hooks in case your application
40   has special needs when dealing with forked processes.  These
41   should not be needed when the "preload_app" directive is
42   false (the default).
44 * Can be used with copy-on-write-friendly memory management
45   to save memory (by setting "preload_app" to true).
47 * Able to listen on multiple interfaces including UNIX sockets,
48   each worker process can also bind to a private port via the
49   after_fork hook for easy debugging.
51 == License
53 Unicorn is copyright 2009 Eric Wong and contributors.
54 It is based on Mongrel and carries the same license:
56 Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed
57 under the Ruby license and the GPL2. See the included LICENSE file for
58 details.
60 Unicorn is 100% Free Software.
62 == Install
64 The library consists of a C extension so you'll need a C compiler or at
65 least a friend who can build it for you.
67 You may download the tarball from the Mongrel project page on Rubyforge
68 and run setup.rb after unpacking it:
70 http://rubyforge.org/frs/?group_id=1306
72 You may also install it via Rubygems on Rubyforge:
74   gem install unicorn
76 You can get the latest source via git from the following locations
77 (these versions may not be stable):
79   git://git.bogomips.org/unicorn.git
80   http://git.bogomips.org/unicorn.git
81   git://repo.or.cz/unicorn.git (mirror)
82   http://repo.or.cz/r/unicorn.git (mirror)
84 If you have web browser software for the World Wide Web
85 (on the Information Superhighway), you may browse the code from
86 your web browser and download the latest snapshot tarballs here:
88 * http://git.bogomips.org/cgit/unicorn.git (cgit)
89 * http://repo.or.cz/w/unicorn.git (gitweb)
91 == Usage
93 === non-Rails Rack applications
95 In APP_ROOT, run:
97   unicorn
99 === for Rails applications (should work for all 1.2 or later versions)
101 In RAILS_ROOT, run:
103   unicorn_rails
105 Unicorn will bind to all interfaces TCP port 8080 by default.
106 You may use the '-l/--listen' switch to bind to a different
107 address:port or a UNIX socket.
109 === Configuration File(s)
111 Unicorn will look for the config.ru file used by rackup in APP_ROOT.
113 For deployments, it can use a config file for Unicorn-specific options
114 specified by the --config-file/-c command-line switch.  See
115 Unicorn::Configurator for the syntax of the Unicorn-specific options.
116 The default settings are designed for maximum out-of-the-box
117 compatibility with existing applications.
119 Most command-line options for other Rack applications (above) are also
120 supported.  Run `unicorn -h` or `unicorn_rails -h` to see command-line
121 options.
123 == Disclaimer
125 Like the creatures themselves, production deployments of Unicorn are
126 rare or even non-existent.  There is NO WARRANTY whatsoever if anything
127 goes wrong, but let us know and we'll try our best to fix it.
129 Unicorn is designed to only serve fast clients.  See the PHILOSOPHY
130 and DESIGN documents for more details regarding this.
132 Rainbows are NOT included.
134 == Known Issues
136 * WONTFIX: code reloading with Sinatra 0.3.2 (and likely older
137   versions) apps is broken.  The workaround is to force production
138   mode to disable code reloading in your Sinatra application:
139     set :env, :production
140   Since this is no longer an issue with Sinatra 0.9.x apps and only
141   affected non-production instances, this will not be fixed on our end.
142   Also remember we're capable of replacing the running binary without
143   dropping any connections regardless of framework :)
145 == Contact
147 Email Eric Wong at normalperson@yhbt.net for now.
148 Newsgroup and mailing list maybe coming...