Questions tagged [unicorn]

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. http://unicorn.bogomips.org/

Unicorn

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. Slow clients should only be served by placing a reverse proxy capable of fully buffering both the the request and response in between Unicorn and slow clients

Features

  • Designed for Rack, Unix, fast clients, and ease-of-debugging. We cut out everything that is better supported by the operating system, nginx or Rack.
  • Compatible with both Ruby 1.8 and 1.9. Rubinius support is in-progress.
  • Process management: Unicorn will reap and restart workers that die from broken apps. There is no need to manage multiple processes or ports yourself. Unicorn can spawn and manage any number of worker processes you choose to scale to your backend.
  • Load balancing is done entirely by the operating system kernel. Requests never pile up behind a busy worker process.
  • 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 for maximum robustness.
  • Supports all Rack applications, along with pre-Rack versions of Ruby on Rails via a Rack wrapper.
  • Builtin reopening of all log files in your application via USR1 signal. This allows logrotate to rotate files atomically and quickly via rename instead of the racy and slow copytruncate method. Unicorn also takes steps to ensure multi-line log entries from one request all stay within the same file.
  • nginx-style binary upgrades without losing connections. You can upgrade Unicorn, your entire application, libraries and even your Ruby interpreter without dropping clients. before_fork and after_fork hooks in case your application has special needs when dealing with forked processes. These should not be needed when the “preload_app” directive is false (the default).
  • Can be used with copy-on-write-friendly memory management to save memory (by setting “preload_app” to true).
  • 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.
  • Simple and easy Ruby DSL for configuration.
  • Decodes chunked transfers on-the-fly, thus allowing upload progress notification to be implemented as well as being able to tunnel arbitrary stream-based protocols over HTTP.

License

  • Unicorn is copyright 2009 by all contributors (see logs in git). It is based on Mongrel 1.1.5 and carries the same license.

  • Mongrel is copyright 2007 Zed A. Shaw and contributors. It is tri-licensed under (your choice) of the GPLv3, GPLv2 or Ruby-specific terms. See the included LICENSE file for details.

  • Unicorn is 100% Free Software.

Used by...

GitHub uses unicorn and has a great tech document about it. They also use Thin and Passenger, not only unicorn!

Questions

Configuration, installation, deployment, performance, optimization.... But please first read unicorn documentation!

125 questions
0
votes
1 answer

How can I setup nginx to serve virtualhosts with rails(unicorn/passenger) and php-fpm

I would like to serve multiple sites on one instance. I install nginx, php-fpm, and a rails app. I use sites like this to guide me. I configure php-fpm to listen to a local socket listen = /var/run/php-fpm/php-fpm.sock I configure ngnix with…
New Alexandria
  • 159
  • 3
  • 9
0
votes
1 answer

Nginx + Unicorn subdomain virtual hosting failure (timeouts)

I have a server set on a VPS serving up a production Rails app via Nginx + Unicorn. Presently this works fine with the following conf files: nginx.conf unicorn.conf However the added subdomain of staging.appname.tld ends up yielding the following…
ylluminate
  • 1,001
  • 2
  • 15
  • 29
0
votes
1 answer

Permission denied when starting Unicorn on Ubuntu

I'm not familiar with Ubuntu and some problem with server settings for my Rails app. I've created deployer user in admin group (%admin ALL=(ALL) ALL). It was all ok, but when I'm trying to start Unicorn service, getting Permission denied…
Oleg Pasko
  • 65
  • 2
  • 8
0
votes
1 answer

memory tuning with rails/unicorn running on ubuntu

I am running unicorn on Ubuntu 11, Rails 3.0, and Ruby 1.8.7. It is an 8 core ec2 box, and I am running 15 workers. CPU never seems to get pinned, and I seem to be handling requests pretty nicely. My question concerns memory usage, and what concerns…
Geremy
  • 103
  • 4
0
votes
1 answer

unicorn/rails server errors in production, but doesn't write to log or stderr

Where is my stack trace? I have a small Rails 3.2 app that I am trying to get running under unicorn proxied to an Apache vhost on a Linode server. In development mode locally, and on the linode, it works as expected. But as soon as I throw the -E…
sbeam
  • 177
  • 3
  • 10
0
votes
1 answer

Multiple Unicorns/Rails Apps, Nginx, One User

I successfully deployed a Rails app using Capistrano, Unicorn, Nginx using the following unicorn configuration: env = ENV["RAILS_ENV"] || "development" worker_processes 4 listen "/tmp/app_one.socket", :backlog => 64 preload_app true timeout…
Micah Alcorn
  • 123
  • 6
0
votes
1 answer

Should I create a system user for unicorn server?

When running a Unicorn server on Linux I am debating whether to run the service under a system or normal user. Which one should I use and why?
mr_ffloyd
  • 3
  • 1
0
votes
1 answer

Nginx unicorn: firefox is redirected to proxy_pass

I have the following setup to process certain domains with rails via unicorn: http { # ... upstream unicorn_server { # This is the socket we configured in app's config unicorn.rb server…
Mikulas Dite
  • 298
  • 3
  • 11
0
votes
1 answer

Debian + Nginx + Unicorn Rails 3 project permissions

Is there a security risk in running a web server like Unicorn as root? The Nginx master process runs as root, the Nginx worker runs as the limited www-data user, but I can't set another user like www-data to run the Unicorn master/workers without…
clem
  • 113
  • 6
0
votes
2 answers

Unicorn retains same PID when receives USR2?

So, I've been playing with a unicorn deployment on my personal server. There are a variety of reasons behind this - one of them being that I didn't particularly want to have to compile my own version of nginx in order to get phusion passenger. (I…
Matt Farmer
  • 141
  • 8
0
votes
1 answer

unicorn_rails throwing memory corruption error

I've been running a nginx+unicorn rails application successfully on EC2 for a while but I decided to get a test server up in one of my VPS servers. I just installed nginx in my VPS, got the gems all going, changed the config files accordingly and…
DallaRosa
  • 111
  • 6
0
votes
2 answers

Unicorn installation error on Debian 5

I am running ruby1.9 on Debian 5, and did not manage to install 'unicorn' with rubygems. I got this error and do not really know how to solve it. Do you have any idea of the possible root cause ? > gem install unicorn Building native extensions. …
Luc
  • 518
  • 3
  • 5
  • 20
0
votes
1 answer

Unicorn Worker Pool going idle and slowing down a lot after a period of time

I'm running Teambox community edition on an Ubuntu Server machine, with 600Mhz and 358MB of RAM. I know it's not much and that's probably the cause of all the trouble I'm having, but maybe someone knows another solution. The thing is, I'm running…
Ian
  • 113
  • 8
0
votes
2 answers

Unicorn 3.3.1 and Rack 1.1.0 issues?

I'm upgrading from the Ruby Enterprise Edition 1.8.6 to the latest 1.8.7 version with Unicorn to facilitate an upgrade to Rails 2.3.10, and am running into some issues. Should I uninstall the older versions of these gems? Here's the log messages:…
user41422
  • 131
  • 2
  • 6
0
votes
1 answer

Unicorn 3 throwing tons of errors (Rails 3.0.3, Unicorn 3.0)

I just tried to upgrade to Unicorn 3.0. I changed my Gemfile and did a bundle install. When restarting my Unicorn I got tons of errors beginning with: Unhandled listen loop exception #
Ulf Klose
  • 387
  • 1
  • 5
  • 18
1 2 3
8
9