FAQ: reorder bit on Rack 1.1.x and Rails 2.3.x
[unicorn.git] / README
blobf084d0c58fbf260b9a47c67ff034e3967cf8ccd5
1 = Unicorn: Rack HTTP server for fast clients and Unix
3 \Unicorn is an HTTP server for Rack applications designed to only serve
4 fast clients on low-latency, high-bandwidth connections and take
5 advantage of features in Unix/Unix-like kernels.  Slow clients should
6 only be served by placing a reverse proxy capable of fully buffering
7 both the the request and response in between \Unicorn and slow clients.
9 == Features
11 * Designed for Rack, Unix, fast clients, and ease-of-debugging.  We
12   cut out everything that is better supported by the operating system,
13   {nginx}[http://nginx.net/] or {Rack}[http://rack.github.io/].
15 * Compatible with Ruby 1.9.3 and later.
16   unicorn 4.8.x will remain supported for Ruby 1.8 users.
18 * Process management: \Unicorn will reap and restart workers that
19   die from broken apps.  There is no need to manage multiple processes
20   or ports yourself.  \Unicorn can spawn and manage any number of
21   worker processes you choose to scale to your backend.
23 * Load balancing is done entirely by the operating system kernel.
24   Requests never pile up behind a busy worker process.
26 * Does not care if your application is thread-safe or not, workers
27   all run within their own isolated address space and only serve one
28   client at a time for maximum robustness.
30 * Supports all Rack applications, along with pre-Rack versions of
31   Ruby on Rails via a Rack wrapper.
33 * Builtin reopening of all log files in your application via
34   USR1 signal.  This allows logrotate to rotate files atomically and
35   quickly via rename instead of the racy and slow copytruncate method.
36   \Unicorn also takes steps to ensure multi-line log entries from one
37   request all stay within the same file.
39 * nginx-style binary upgrades without losing connections.
40   You can upgrade \Unicorn, your entire application, libraries
41   and even your Ruby interpreter without dropping clients.
43 * before_fork and after_fork hooks in case your application
44   has special needs when dealing with forked processes.  These
45   should not be needed when the "preload_app" directive is
46   false (the default).
48 * Can be used with copy-on-write-friendly memory management
49   to save memory (by setting "preload_app" to true).
51 * Able to listen on multiple interfaces including UNIX sockets,
52   each worker process can also bind to a private port via the
53   after_fork hook for easy debugging.
55 * Simple and easy Ruby DSL for configuration.
57 * Decodes chunked transfers on-the-fly, thus allowing upload progress
58   notification to be implemented as well as being able to tunnel
59   arbitrary stream-based protocols over HTTP.
61 == License
63 \Unicorn is copyright 2009 by all contributors (see logs in git).
64 It is based on Mongrel 1.1.5.
65 Mongrel is copyright 2007 Zed A. Shaw and contributors.
67 \Unicorn is licensed under (your choice) of the GPLv2 or later
68 (GPLv3+ preferred), or Ruby (1.8)-specific terms.
69 See the included LICENSE file for details.
71 \Unicorn is 100% Free Software.
73 == Install
75 The library consists of a C extension so you'll need a C compiler
76 and Ruby development libraries/headers.
78 You may install it via RubyGems on RubyGems.org:
80   gem install unicorn
82 You can get the latest source via git from the following locations
83 (these versions may not be stable):
85   git://bogomips.org/unicorn.git
86   git://repo.or.cz/unicorn.git (mirror)
88 You may browse the code from the web and download the latest snapshot
89 tarballs here:
91 * http://bogomips.org/unicorn.git (cgit)
92 * http://repo.or.cz/w/unicorn.git (gitweb)
94 See the HACKING guide on how to contribute and build prerelease gems
95 from git.
97 == Usage
99 === Rack (including Rails 3+) applications
101 In APP_ROOT, run:
103   unicorn
105 === Ancient Rails 1.2 - 2.x versions
107 In RAILS_ROOT, run:
109   unicorn_rails
111 \Unicorn will bind to all interfaces on TCP port 8080 by default.
112 You may use the +--listen/-l+ switch to bind to a different
113 address:port or a UNIX socket.
115 === Configuration File(s)
117 \Unicorn will look for the config.ru file used by rackup in APP_ROOT.
119 For deployments, it can use a config file for \Unicorn-specific options
120 specified by the +--config-file/-c+ command-line switch.  See
121 Unicorn::Configurator for the syntax of the \Unicorn-specific options.
122 The default settings are designed for maximum out-of-the-box
123 compatibility with existing applications.
125 Most command-line options for other Rack applications (above) are also
126 supported.  Run `unicorn -h` to see command-line options.
128 == Disclaimer
130 There is NO WARRANTY whatsoever if anything goes wrong, but
131 {let us know}[link:ISSUES.html] and we'll try our best to fix it.
133 \Unicorn is designed to only serve fast clients either on the local host
134 or a fast LAN.  See the PHILOSOPHY and DESIGN documents for more details
135 regarding this.
137 == Contact
139 All feedback (bug reports, user/development dicussion, patches, pull
140 requests) go to the mailing list/newsgroup.  See the ISSUES document for
141 information on the {mailing list}[mailto:unicorn-public@bogomips.org].
143 For the latest on \Unicorn releases, you may also finger us at
144 unicorn@bogomips.org or check our NEWS page (and subscribe to our Atom
145 feed).