unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 0850f2e6c9c6f17a18238c9562fb4da744de0246 4556 bytes (raw)
$ git show v0.2.2:README	# shows this blob on the CLI

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
 
= Unicorn: UNIX + LAN/localhost-only fork of Mongrel

Only run this behind a full-HTTP-request-buffering reverse proxy if
you're serving slow clients.  That said, nginx is the only reverse
proxy we know of that meets this requirement.

== Features

* process management: Unicorn will reap and restart workers that
  die because of broken apps and there is no need to manage
  multiple processes yourself.

* does not care if your application is thread-safe or not, workers
  all run within their own isolated address space and only serve one
  client at a time...

* able to listen on multiple interfaces, including UNIX sockets,
  each worker process can also bind to a private port via the
  after_fork hook for easy debugging.

* supports all Rack applications

* nginx-style binary re-execution without losing connections.
  You can upgrade unicorn, your entire application, libraries
  and even your Ruby interpreter as long as unicorn is
  installed in the same path.

* before_fork and after_fork hooks in case your application
  has special needs when dealing with forked processes.

* builtin log rotation via USR1 signal

* Ruby 1.9-compatible (at least the test cases all pass :>)

== License

Unicorn is copyright 2009 Eric Wong and contributors.
It is based on Mongrel and carries the same license:

Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed
under the Ruby license and the GPL2. See the include LICENSE file for
details.

== Install

The library consists of a C extension so you'll need a C compiler or at
least a friend who can build it for you.

You may download the tarball from the Mongrel project page on Rubyforge
and run setup.rb after unpacking it:

http://rubyforge.org/frs/?group_id=1306

You may also install it via Rubygems on Rubyforge:

  gem install unicorn

You can get the latest source via git from the following locations
(these versions may not be stable):

  git://git.bogomips.org/unicorn.git
  http://git.bogomips.org/unicorn.git
  git://repo.or.cz/unicorn.git (mirror)
  http://repo.or.cz/r/unicorn.git (mirror)

If you have web browser software for the World Wide Web
(on the Information Superhighway), you may browse the code from
your web browser and download the latest snapshot tarballs here:

* http://git.bogomips.org/cgit/unicorn.git (this server runs Unicorn!)
* http://repo.or.cz/w/unicorn.git (gitweb mirror)

== Usage

=== non-Rails Rack applications

Unicorn will look for the config.ru file used by rackup in APP_ROOT.
Optionally, it can use a config file for unicorn-specific options
specified by the --config-file/-c command-line switch.  See
Unicorn::Configurator for the syntax of the unicorn-specific
config options.

In APP_ROOT, just run:

  unicorn

Unicorn should be capable of running most Rack applications.  Since this
is a preforking webserver, you do not have to worry about thread-safety
of your application or libraries. However, your Rack application may use
threads internally (and should even be able to continue running threads
after the request is complete).

=== Rack-enabled versions of Rails (v2.3.2+)

In RAILS_ROOT, run:

  unicorn_rails

Most command-line options for other Rack applications (above) are also
supported.  The unicorn_rails launcher attempts to combine the best
features of the Rails-bundled "script/server" with the "rackup"-like
functionality of the `unicorn' launcher.

== Disclaimer

There are only a few instances of Unicorn deployed anywhere in the
world.  The only public site known to run Unicorn at this time is
http://git.bogomips.org/cgit which runs Unicorn::App::ExecCgi to
fork()+exec() cgit.

Be one of the first brave guinea pigs to run it on your production site!
Of course there is NO WARRANTY whatsoever if anything goes wrong, but
let us know and we'll try our best to fix it.  Unicorn is still in the
early stages and testing + feedback would be *greatly* appreciated;
maybe you'll get Rainbows as a reward!

== Known Issues

* WONTFIX: code reloading with Sinatra 0.3.2 (and likely older
  versions) apps is broken.  The workaround is to force production
  mode to disable code reloading in your Sinatra application:
    set :env, :production
  Since this is no longer an issue with Sinatra 0.9.x apps and only
  affected non-production instances, this will not be fixed on our end.
  Also remember we're capable of replacing the running binary without
  dropping any connections regardless of framework :)

== Contact

Newsgroup and mailing list maybe coming...
Email Eric Wong at normalperson@yhbt.net for now.

git clone https://yhbt.net/unicorn.git