rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Joshua Peek <josh@joshpeek.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Bootstrapping rackup with multiple rack gems installed
Date: Wed, 1 Sep 2010 12:14:20 -0700 (PDT)	[thread overview]
Message-ID: <0257a5a4-9afb-4abf-bb46-b14fbbc57c38@s9g2000yqd.googlegroups.com> (raw)

This came up as an issue in Rails 2.3 along with the release of Rack
1.2. Rails 2.3 is locked to Rack 1.0 so if Rack 1.2 is activated
before hand, Rails will fail to boot. Most people now have Rack 1.0
and 1.2 both installed. In a prefect rubygems world everything would
work fine. (This is why I don't use RG, but a ton of people are still
using Rails 2.3 and RG)

Starting Rails with `script/server` works fine because Rails boots
first. You can start Rails with `rackup` but you have to make sure you
are using the matching rack version with `rackup _1.0.1_` which is
kind of lame though. The major issue is with servers like unicorn and
passenger which have their own bootstrapping scripts.

If you boot a Rails 2.3 app with `unicorn` and Rack 1.2 is installed,
Unicorn attempts to require rack pulling in the latest version since
it doesn't know any better then boots Rails causing the gem conflict.
Similar deal with passenger.

Unicorn has a valid reason for requiring rack since it needs to load
Rack::Builder before it evals the config.ru file. The use of the
builder dsl in .ru files causes a serious fundamental problem with
loading rack. The application can never specify which version of rack
to use since it has to be chosen before its loaded.

Possible workarounds:

1) Always bootstrap with the correct version of rackup with `rackup
_1.0.0_`, `/path/to/rack/1.0.0/bin/rackup`, etc.
2) Unicorn and Passenger should allow you to specify which rack
version to use.
3) Specify a load path or environment file on boot that setups the
correct paths or activates the right version of rack. This could be
done by requiring an environment that loads Bundler or similar tools.
4) Hacky version independent version of rackup. I hacked this up to
demonstration how http://gist.github.com/560926 you can lazily
evaluate the builder dsl after the application loads.

Are there anymore workarounds? Whats the suggested fix? I'd like to
hear some opinions on the whole bootstapping matter.

             reply	other threads:[~2010-09-01 19:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01 19:14 Joshua Peek [this message]
2010-09-01 19:16 ` Bootstrapping rackup with multiple rack gems installed Steve Klabnik
2010-09-01 19:20   ` Konstantin Haase
2010-09-01 19:21     ` Steve Klabnik
2010-09-01 19:25       ` Yehuda Katz
2010-09-01 19:49         ` Konstantin Haase
2010-09-01 23:55           ` Lawrence Pit
2010-09-02  0:14             ` Randy Fischer
2010-09-01 19:23   ` Joshua Peek
2010-09-01 19:25     ` Steve Klabnik
2010-09-02  4:14 ` Eric Wong
2010-09-02 12:01 ` James Tucker

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-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0257a5a4-9afb-4abf-bb46-b14fbbc57c38@s9g2000yqd.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /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.
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).