about summary refs log tree commit homepage
path: root/lib/unicorn/configurator.rb
DateCommit message (Collapse)
2010-12-21configurator: RDoc cleanups and improvements
This is the most important part of Unicorn documentation for end users.
2010-12-21http: hook up "trust_x_forwarded" to configurator
More config bloat, sadly this is necessary for Rainbows! :<
2010-12-10unicorn 3.1.0 - client_buffer_body_size tuning v3.1.0
This release enables tuning the client_buffer_body_size to raise or lower the threshold for buffering request bodies to disk. This only applies to users who have not disabled rewindable input. There is also a TeeInput bugfix for uncommon usage patterns and Configurator examples in the FAQ should be fixed
2010-12-09allow client_buffer_body_size to be tuned
Since modern machines have more memory these days and clients are sending more data, avoiding potentially slow filesystem operations for larger uploads can be useful for some applications.
2010-12-09configurator: ensure examples in FAQ still work
This has been broken since 2.0.x Internal cleanups sometimes have unintended consequences :<
2010-11-11configurator: enable "rewindable_input" directive
This allows users to override the current Rack spec and disable the rewindable input requirement. This can allow applications to use less I/O to minimize the performance impact when processing uploads.
2010-10-27configurator: reloading with unset values restores default
If a configuration directive is set at startup and later unset, it correctly restores the original default value as if it had never been set in the first place. This applies to the majority of the configuration values with a few exceptions: * This only applies to stderr_path and stdout_path when daemonized (the usual case, they'll be redirected to "/dev/null"). When NOT daemonized, we cannot easily redirect back to the original stdout/stderr destinations. * Unsetting working_directory does not restore the original working directory where Unicorn was started. As far as we can tell unsetting this after setting it is rarely desirable and greatly increases the probability of user error.
2010-10-27configurator: use "__send__" instead of "send"
It's less ambiguous since this is a network server after all.
2010-10-27configurator: switch to normal class
No point in using a Struct for (1.8) space-efficiency if there's only one of them.
2010-08-30remove nasty ugly hacks at startup
These nasty hacks were breaking Rubinius compatibility. This can be further cleaned up, too.
2010-07-06configurator: cleanup RDoc, un-indent
No point in redeclaring the Unicorn module in here.
2010-07-06configurator: documentation for new accept options
The defaults should be reasonable, but there may be folks who want to experiment.
2010-06-10docs: hopefully clarify preload_app=false behavior
While we're at it, inform people of why they might use a symlink
2010-06-10configurator: remove debugging output
2010-06-10fix alt-working_directory behavior for Rails 3
2010-06-10respect "working_directory" wrt config.ru
Since we added support for the "working_directory" parameter, it often became unclear where/when certain paths would be bound. There are some extremely nasty dependencies and ordering issues when doing this. It's all pretty fragile, but works for now and we even have a full integration test to keep it working. I plan on cleaning this up 2.x.x to be less offensive to look at (Rainbows! and Zbatery are a bit tied to this at the moment). Thanks to Pierre Baillet for reporting this. ref: http://mid.gmane.org/AANLkTimKb7JARr_69nfVrJLvMZH3Gvs1o_KwZFLKfuxy@mail.gmail.com
2010-06-05File.readable? and File.writable? are more readable
...than "test ?r" and "test ?w" Not everybody comes from a Unix shell programming background, even though they *should* ;)
2010-06-04configurator: logger: drop "close" requirement
Rack::Lint in Rack 1.1.0 does not require a "close" method for env["rack.logger"], and we never explicitly close our logger, either. This more easily allows the use of alternative Logger-like implementations such as SyslogLogger.
2010-06-04doc: emphasize the importance of stderr_path
While second nature to myself, stderr_path may be an overlooked configuration parameter for some users. Also, add a minimal sample configuration file that is shorter and hopefully less intimidating to new users.
2010-03-01configurator "user" directive outside of after_fork
Allowing the "user" directive outside of after_fork reduces the cognitive overhead for folks that do not need the complexity of *_fork hooks. Using Worker#user remains supported as it offers fine-grained control of user switching.
2010-02-25unicorn_rails: make this "working_directory"-aware
The temporary paths we create to mimic script/server-emulation did not work when working_directory was used. Now we defer path creation until after working_directory is bound.
2009-11-23configurator: shorten rdoc, link to examples instead
No point in repeating ourselves and having to deal with nested comments + indentation in RDoc. It's also easier for users to just download the file than to copy-and-paste out of a typical web browser.
2009-11-18Do not expand paths given on the shell
Shells already expand '~' before the executables see it, and relative paths inside symlinks can get set incorrectly to the actual directory name, and not the (usually desired) symlink name for things like Capistrano. Since our paths are now unexpanded, we must now check the "working_directory" directive and raise an error if the user specifies the config file in a way that makes the config file unreloadable.
2009-11-14configurator: listen :umask parameter for UNIX sockets
Typically UNIX domain sockets are created with more liberal file permissions than the rest of the application. By default, we create UNIX domain sockets to be readable and writable by all local users to give them the same accessibility as locally-bound TCP listeners. This only has an effect on UNIX domain sockets. This was inspired by Suraj Kurapati in cfbcd2f00911121536rd0582b8u961f7f2a8c6e546a@mail.gmail.com
2009-11-13configurator: update RDoc and comments in examples
Some of this based on Suraj Kurapati's comments on the mailing list.
2009-11-04worker: user/group switching for after_fork hooks
This must be called in the after_fork hook because there may be Ruby modules that'll allow things such as CPU affinity and scheduling class/priority to be set on a per-worker basis. So we give the user the ability to change users at any time during the after_fork hook.
2009-11-03configurator: update documentation for working_directory
We follow the principle of least surprise now, so less documentation is better documentation.
2009-11-03configurator: working_directory affects pid, std{err,out}_paths
It makes more sense this way since users usually expect config file directives to be order-independent.
2009-11-03configurator: set ENV["PWD"] with working_directory, too
Just in case anything depends on it, we'll have it set correctly because it's usually set by the $SHELL
2009-11-03configurator: working_directory is expanded
Allow people to use "~" and relative paths, like all of our other paths.
2009-11-01configurator: add "working_directory" directive
This basically a prettier way of saying: Dir.chdir(Unicorn::HttpServer::START_CTX[:cwd] = path) In the config file. Unfortunately, this is configuration directive where order matters and you should specify it before any other path[1] directives if you're using relative paths (relative paths are not recommended anyways) [1] pid, stderr_path, stdout_path
2009-10-24configurator: fix broken example in RDoc
Thanks to Greg Melton for reporting.
2009-10-13show configuration file path in errors instead of '(eval)'
also __FILE__ did not reflect configuration file path
2009-10-09configurator: update with nginx fail_timeout=0 example
It has come to our attention that this setting is not very well-known to the rest of the world...
2009-10-02configurator: listen :delay must be Numeric
:delay may be a Float to represent fractional seconds.
2009-10-02configurator: update some migration examples
We now give an example of how a before_fork hook can be used to incrementally migrate off the old code base without hitting a thundering herd (especially in the "preload_app false") case. Also comment on the per-worker listen usage in the RDoc, not just a hidden comment.
2009-09-28configurator: remove DEFAULT_LOGGER constant
We no longer have external lookups for it so just stick it in the DEFAULTS hash for now. Since the Configurator::DEFAULTS hash can be considered a stable interface for other modules to interact with, they can eventually just use it instead of relying on another constant.
2009-09-28configurator: add colons in front of listen() options
Hopefuly make it more obvious that they're Ruby symbols and not strings. While we're at it, fix ordering of :{rcv,snd}buf descriptions to (logically) match the order of mention.
2009-09-28configurator: update and modernize examples
* Use the new :tries and :default parameters for listen() instead of the ugly and less-effective "rescue nil" * ActiveRecord connection management examples for hooks when using for "preload_app true" * combine "preload_app true" example with REE COW-friendly optimization for memory savings Some of these are based on Chris Wanstrath's configuration posted here: http://gist.github.com/189623
2009-09-27configurator: move initialization stuff to #initialize
Avoids making the #listen method any noisier than it should be.
2009-09-27Use Configurator#expand_addr in HttpServer#listen
This may be redundant for the "normal" configuration file directive, but allows the same syntax to be used in after_fork hooks where HttpServer#listen() may be called.
2009-09-27HttpServer#listen accepts :tries and :delay parameters
This allows per-worker listeners to be configured to retry and and not continue until the equivalent worker belonging to a previous master (or even another server) has released the socket. In the Configurator RDoc, include better examples for per-worker server.listen calls using these :tries == -1. Inspired by an example by Chris Wanstrath.
2009-09-22configurator: fix user switch example in RDoc
We changed this in 97e469fc3afb751618b8b9a7b364cb447aaf90dd but never updated the example.
2009-09-08"encoding: binary" comments for all sources (1.9)
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.
2009-07-04Favor Struct members to instance variables
There's a small memory reduction to be had when forking oodles of processes and the Perl hacker in me still gets confused into thinking those are arrays...
2009-07-01Force streaming input onto apps by default
This change gives applications full control to deny clients from uploading unwanted message bodies. This also paves the way for doing things like upload progress notification within applications in a Rack::Lint-compatible manner. Since we don't support HTTP keepalive, so we have more freedom here by being able to close TCP connections and deny clients the ability to write to us (and thus wasting our bandwidth). While I could've left this feature off by default indefinitely for maximum backwards compatibility (for arguably broken applications), Unicorn is not and has never been about supporting the lowest common denominator.
2009-07-01Re-add support for non-portable socket options
Now that we support tunnelling arbitrary protocols over HTTP as well as "100 Continue" responses, TCP_NODELAY actually becomes useful to us. TCP_NODELAY is actually reasonably portable nowadays; even. While we're adding non-portable options, TCP_CORK/TCP_NOPUSH can be enabled, too. Unlike some other servers, these can't be disabled explicitly/intelligently to force a flush, however. However, these may still improve performance with "normal" HTTP applications (Mongrel has always had TCP_CORK enabled in Linux). While we're adding OS-specific features, we might as well support TCP_DEFER_ACCEPT in Linux and FreeBSD the "httpready" accept filter to prevent abuse. These options can all be enabled on a per-listener basis.
2009-06-29configurator: provide stream_input (true|false) option
The default is false because some applications were not written to handle partial reads (even though IO#read allows it, not just IO#readpartial).
2009-05-10Enforce minimum timeout at 3 seconds
2 seconds is still prone to race conditions under high load. We're intentionally less accurate than we could be in order to reduce syscall and method dispatch overhead.
2009-05-10configurator: fix rdoc formatting