Date | Commit message (Collapse) |
|
It makes life easier for people writing config.ru files for use
with Rails.
|
|
This makes our RACK_ENV handling like our RAILS_ENV
handling for unicorn_rails, removing the redundant
local variable.
|
|
Although not currently part of the Rack specification,
ENV["RACK_ENV"] is at least a de facto standard. Some of the
popular Rack servers (Thin, Passenger) and frameworks (Merb,
Sinatra) already set or use it.
ML-Ref: <C7A9411D-CD40-4DA4-9CB3-6AA959D2D127@larsen.st>
Acked-by: Eric Wong <normalperson@yhbt.net>
[ew: setenv always, not just on CLI + commit message]
|
|
..but keep -P deprecated. --path is still useful for testing
ad-hoc changes when you don't want to commit your changes
permanently to a configuration file.
|
|
Since Unicorn config files are written in Ruby, setting
RAILS_RELATIVE_URL_ROOT should be possible (and even encouraged)
in the config file if it is done at all.
|
|
This matches the manpage and the rest of the documentation.
|
|
`unicorn` tries to mimic `rackup` on the command-line to ease
adoption. `unicorn_rails` tries to be somewhat like `rackup` as
well, but then also tries to be consistent with `script/server`
resulting some amount of confusion with regard to the
-P/(--path|--pid) switch. Outright removal of these switches
will probably not happen any time soon because we have
command-lines inherited across processes, but we can stop
advertising them.
Since our (Unicorn) config file format is fortunately consistent
between Rails and !Rails, recommend the "pid" directive be used
instead.
User interfaces are really, really tough to get right...
|
|
|
|
This ensures any string literals that pop up in *our* code will
just be a bag of bytes. This shouldn't affect/fix/break
existing apps in most cases, but most constants will always have
the "correct" encoding (none!) to be consistent with HTTP/socket
expectations. Since this comment affects things only on a
per-source basis, it won't affect existing apps with the
exception of strings we pass to the Rack application.
This will eventually allow us to get rid of that Unicorn::Z
constant, too.
|
|
Rack is autoload-based and so are we.
|
|
I've noticed rackup has been __END__-aware as of
7b6046b764eafd332b3b2d9d93b3915c425fae54 in Rack upstream
|
|
I've experienced occasional problems with this so it's
probably best to stay on the safe side.
|
|
It's pointless to support multiple instances of it since
this is per-process. However, the constant itself is now
modifiable if anybody needs to tweak things for reexecution
using a before_exec hook.
|
|
We can get by with one less lambda in the loader
|
|
There were some unnecessary lambdas in there
along with some repeated checks.
|
|
Just use the RAILS_RELATIVE_URL_ROOT variable to support it
since probably works on more versions of Rails. Since no
application I've ever deployed has ever used it, I'm not going
to bother supporting it for Rails <2.3, either.
|
|
This removes half-implemented support to disable static file
serving. People interested enough can provide their own
config.ru file to save some stat(2) syscalls, but extra
command-config options just complicate things.
|
|
Makes problems easier to solve if we dump the
exception...
|
|
This allows config.ru to specify listener and
stuff before we setup the application.
|
|
Combining command-line and config file options in a reasonable
manner has and always will be a painful experience.
|
|
This resurrects old code from Mongrel to wrap the Rails
Dispatcher for older versions of Rails. It seems that
Rails >= 2.2.0 support Rack, but only >=2.3 requires it.
I'd like to support Rails 1.2.x for a while, too.
|
|
Loading Rails (or at least config/environment)
will already load its version of Rack, duh!
This also prevents a double-require of Rack
causing redefined Rack::VERSION errors.
|
|
This was broken in the last commit (d1ff8c5):
start libifying common launcher code
|
|
The daemonization logic between unicorn and unicorn_rails
scripts can definitely be shared.
Again: our daemonization logic is slightly non-standard since
our executables are designed to run in APP_ROOT/RAILS_ROOT and
not "/" like "normal" UNIX daemons.
|
|
This should just run inside RAILS_ROOT out-of-the-box. No
config.ru is needed (but we'll use one if it's detected).
This has slightly different semantics than script/server
and the normal "unicorn" script (which has "rackup"-like)
semantics. It tries to combine the best of both worlds,
but do not consider the command-line option interface
to be stable by any means.
|
|
This allows config.ru files to be shared by rackup and
unicorn without errors.
|
|
This reverts commit 4414d9bf34f162a604d2aacc765ab1ca2fc90404.
|
|
This reverts commit e66ab79b8b5bc5311c750bf03868a7b2574f4ea1.
Conflicts:
bin/unicorn
|
|
Unicorn will always continue to run in the directory it started
in, it does not chdir to "/". Since the default start_ctx[:cwd]
is symlink-aware, this should not be a problem for
Capistrano-deployed applications.
|
|
This is a followup to 11172f9bdcc7c57c9ae857a8088e49527a953fa1
|
|
This allows LOAD_PATH modifications via the command-line
(via -I or -rubygems on the command-line).
|
|
As opposed to doing this in the shell, this allows the files to
be reopened reliably after rotation.
While we're at it, use $stderr/$stdout instead of STDERR/STDOUT
since they seem to be more favored.
|
|
Some applications do not handle loading before forking
out-of-the-box very gracefully, this starts adding support
to build the Rack(-ish) application later in the process.
|
|
Doesn't seem to make a difference for 1.8
but shows up in 1.9...
|
|
It's confusing with the lowercase "-p" option which is more
common for developers to use. PID files are only needed for
production deployments, and those should be using config files
anyways.
|
|
Ensure the output fits in a standard ANSI terminal so it's easy
to read for all users regardless of what interface they're
working from.
|
|
Since not all rackup command-line options can be supported by
Unicorn, disable this gross hack to avoid potentially
unpredictable or undefined behavior. config.ru will not be able
to specify the config file for unicorn-specific options; but the
unicorn-specific config files themselves will be allowed to
override the default config.ru location.
|
|
This allows Unicorn to be constantly started in symlink
paths such as the ones Capistrano creates
(e.g. "/u/apps/$app/current")
|
|
This adds a bunch of execution tests that require the "unicorn"
binary to be in PATH as well as rack being directly
"require"-able ("rubygems" will not be loaded for you). The
tester is responsible for setting up PATH and RUBYLIB
appropriately.
|
|
|
|
This allows changing certain variables without restarting the
master process or code reload. Currently, only the following
variables are supported: @timeout, @nr_workers, @hot_config_file.
Any other config changes will/should require re-executing the
running binary. This config file is run through eval(); so it
really users plenty of rope to hang themselves with. Of course,
it requires valid Ruby syntax:
------------------------- 8< ------------------------
@nr_workers = 8
@timeout = 15
@hot_config_file = "/var/tmp/new_hot_config_file"
------------------------- 8< ------------------------
Lowering the timeout will trigger all existing workers to be
gracefully stopped and restarted.
This file is loaded at startup, and overrides any config
settings that may already be loaded.
|
|
Daemonization only happens once at initial startup and is less
intrusive than traditional daemonize routines: we do not chdir,
set umask, or redirect/close STDOUT/STDERR since those are
doable via other config options with Unicorn (and the Unicorn
"config file" is just Ruby).
STDIN has no business being open on a daemon (and can be
dangerous to close if using certain buggy third-party libs).
|
|
Along with worker process management. This is nginx-style
inplace upgrading (I don't know of another web server that does
this). Basically we can preserve our opened listen sockets
across entire executable upgrades.
Signals:
USR2 - Sending USR2 to the master unicorn process will cause
it to exec a new master and keep the original workers running.
This is useful to validate that the new code changes took place
are valid and don't immediately die. Once the changes are
validated (manually), you may send QUIT to the original
master process to have it gracefully exit.
HUP - Sending this to the master will make it immediately exec
a new binary and cause the old workers to gracefully exit.
Use this if you're certain the latest changes to Unicorn (and
your app) are ready and don't need validating.
Unlike nginx, re-execing a new binary will pick up any and all
configuration changes. However listener sockets cannot be
removed when exec-ing; only added (for now).
I apologize for making such a big change in one commit, but once
I got the ability to replace the entire codebase while preserving
connections, it was too tempting to continue working.
So I wrote a large chunk of this while hitting
the unicorn-hello-world app with the following loop:
while curl -vSsfN http://0:8080; do date +%N; done
_Zero_ requests lost across multiple restarts.
|
|
|
|
Breaks world.
Added option to throttle number of concurrent threads processing requests.
Conflicts:
bin/mongrel_rails
lib/mongrel.rb
lib/mongrel/configurator.rb
lib/mongrel/rails.rb
test/unit/test_ws.rb
|
|
|
|
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@1013 19e92222-5c0b-0410-8929-a290d50e31e9
|
|
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@1005 19e92222-5c0b-0410-8929-a290d50e31e9
|
|
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@1004 19e92222-5c0b-0410-8929-a290d50e31e9
|
|
Added shebang to mongrel_rails (makes latest RubyGem happier).
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@1000 19e92222-5c0b-0410-8929-a290d50e31e9
|