From: "Lin Jen-Shin (aka godfat 真常)" <godfat@godfat.org>
To: Eric Wong <normalperson@yhbt.net>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: About Unicorn Rack handler
Date: Thu, 5 Nov 2009 12:43:33 +0800 [thread overview]
Message-ID: <15d206ce0911042043x34d29e8fp28b982c359252b4e@mail.gmail.com> (raw)
In-Reply-To: <20091104170714.GC5282@dcvr.yhbt.net>
On Thu, Nov 5, 2009 at 1:07 AM, Eric Wong <normalperson@yhbt.net> wrote:
> I think making Unicorn.run add to :listeners if :Host or :Port are set
> will work. I'm not sure if launching Unicorn directly from `rackup' can
> ever work right without being too intrusive to the other servers, so
> having a Unicorn Rack handler in distributed with Rack would't make
> sense. Unicorn needs to capture ARGV (before option parsing) and parse
> its own config file, neither of which is doable out-of-the-box with
> rackup.
I see. On the other hand, it would be great if `rackup' could work with
Unicorn directly. Perhaps something like:
rackup -r config/unicorn.rb -s unicorn -p 12345 config.ru
This would require unicorn config to change to something like:
Unicorn::Configurator.instance.instance_eval{
# original config content
}
Then `Unicorn.run' should check if Configurator
singleton has been configured, and use it instead.
I would want this because I have a rackup cluster script.
If this would work, then I don't have to change the existing
script to adapt to Unicorn with a -c option, along with
changing `rackup' to `unicorn'.
Here's the script:
http://github.com/godfat/app-deploy/blob/master/lib/app-deploy/rack_cluster.rb
Here's an example config for `rack_cluster':
http://github.com/godfat/app-deploy/blob/master/example/rack_cluster.yaml
I know I won't need rack "cluster" once I switch to Unicorn.
Perhaps what I should do is just drop rack cluster support,
then many things could be simplified.
> Does something like this work? (not tested).
>
> diff --git a/lib/unicorn.rb b/lib/unicorn.rb
> index 0f2b597..d4a00e0 100644
> --- a/lib/unicorn.rb
> +++ b/lib/unicorn.rb
> @@ -17,6 +17,14 @@ module Unicorn
>
> class << self
> def run(app, options = {})
> + # compatibility with other interfaces (Ramaze)
> + host = options.delete(:Host)
> + port = options.delete(:Port)
> + if host || port
> + port ||= Const::DEFAULT_PORT
> + host ||= Const::DEFAULT_HOST
> + (options[:listeners] ||= []) << "#{host}:#{port}"
> + end
> HttpServer.new(app, options).start.join
> end
> end
Yes, work fine at first try. Many thanks for your work!
The working `start.rb' for Ramaze is:
require 'unicorn'
Rack::Handler.register('unicorn', 'Unicorn')
Ramaze.start(:adapter => 'unicorn', :port => 7000)
> On the other hand, does Innate make it possible to do transparent
> upgrades (since rackup does not)? I'll look into it a bit more later...
I am not sure what do you mean transparent here,
_______________________________________________
mongrel-unicorn mailing list
mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
next prev parent reply other threads:[~2009-11-05 4:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 12:37 About Unicorn Rack handler Lin Jen-Shin (aka godfat 真常)
2009-11-04 17:07 ` Eric Wong
2009-11-05 4:43 ` Lin Jen-Shin (aka godfat 真常) [this message]
2009-11-05 4:47 ` Lin Jen-Shin (aka godfat 真常)
2009-11-05 7:29 ` Eric Wong
2009-11-05 7:28 ` Eric Wong
2009-11-05 15:13 ` Lin Jen-Shin (aka godfat 真常)
2009-11-05 23:19 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15d206ce0911042043x34d29e8fp28b982c359252b4e@mail.gmail.com \
--to=godfat@godfat.org \
--cc=mongrel-unicorn@rubyforge.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).