unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [RFC/PATCH] Bundler/Sandbox documentation updates
@ 2011-03-08  4:40 Eric Wong
  2011-03-08 14:22 ` Justin Giancola
  2011-03-09 10:39 ` Lawrence Pit
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Wong @ 2011-03-08  4:40 UTC (permalink / raw)
  To: mongrel-unicorn

I started playing around with Bundler 1.0.10 today and noticed it's
quite different than previous versions (based on my limited experiences)
and the out-of-the-box experience is pretty good regarding (lack of)
ENV pollution.

Can any more experienced Bundler (and possibly Capistrano) users
comment on the below changes and see if they make sense?

Thanks in advance!

diff --git a/Sandbox b/Sandbox
index d101106..46dfb91 100644
--- a/Sandbox
+++ b/Sandbox
@@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17
 
 ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com
 
+=== BUNDLE_GEMFILE for Capistrano users
+
+You may need to set or reset the BUNDLE_GEMFILE environment variable in
+the before_exec hook:
+
+        before_exec do |server|
+          ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile"
+        end
+
 === Other ENV pollution issues
 
-You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH
-environment variables in the before_exec hook as illustrated by
-http://gist.github.com/534668
+If you're using an older Bundler version (0.9.x), you may need to set or
+reset GEM_HOME, GEM_PATH and PATH environment variables in the
+before_exec hook as illustrated by http://gist.github.com/534668
 
 == Isolate
 
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-08  4:40 [RFC/PATCH] Bundler/Sandbox documentation updates Eric Wong
@ 2011-03-08 14:22 ` Justin Giancola
  2011-03-10  0:49   ` Eric Wong
  2011-03-09 10:39 ` Lawrence Pit
  1 sibling, 1 reply; 7+ messages in thread
From: Justin Giancola @ 2011-03-08 14:22 UTC (permalink / raw)
  To: unicorn list

Setting BUNDLE_GEMFILE in the before_exec hook is the only
Bundler-related Unicorn config I've needed for Bundler >= 1.0.3

For <= 1.0.2 not even this was necessary because the template
executables Bundler generates didn't fully resolve the BUNDLE_GEMFILE
path until 1.0.3


Justin

On Mon, Mar 7, 2011 at 11:40 PM, Eric Wong <normalperson@yhbt.net> wrote:
> I started playing around with Bundler 1.0.10 today and noticed it's
> quite different than previous versions (based on my limited experiences)
> and the out-of-the-box experience is pretty good regarding (lack of)
> ENV pollution.
>
> Can any more experienced Bundler (and possibly Capistrano) users
> comment on the below changes and see if they make sense?
>
> Thanks in advance!
>
> diff --git a/Sandbox b/Sandbox
> index d101106..46dfb91 100644
> --- a/Sandbox
> +++ b/Sandbox
> @@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17
>
>  ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com
>
> +=== BUNDLE_GEMFILE for Capistrano users
> +
> +You may need to set or reset the BUNDLE_GEMFILE environment variable in
> +the before_exec hook:
> +
> +        before_exec do |server|
> +          ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile"
> +        end
> +
>  === Other ENV pollution issues
>
> -You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH
> -environment variables in the before_exec hook as illustrated by
> -http://gist.github.com/534668
> +If you're using an older Bundler version (0.9.x), you may need to set or
> +reset GEM_HOME, GEM_PATH and PATH environment variables in the
> +before_exec hook as illustrated by http://gist.github.com/534668
>
>  == Isolate
>
> --
> Eric Wong
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
>
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-08  4:40 [RFC/PATCH] Bundler/Sandbox documentation updates Eric Wong
  2011-03-08 14:22 ` Justin Giancola
@ 2011-03-09 10:39 ` Lawrence Pit
  2011-03-10  0:52   ` Eric Wong
  1 sibling, 1 reply; 7+ messages in thread
From: Lawrence Pit @ 2011-03-09 10:39 UTC (permalink / raw)
  To: unicorn list

Hi Eric,

I tested this out:

- in the before_exec and after_fork I log PATH GEM_HOME GEM_PATH 
BUNDLE_GEMFILE for inspection after deployment

- deploy latest release, make sure to shutdown unicorn, then start cleanly

- prune all releases, except the last one

- deploy latest release again (which only sets the BUNDLE_GEMFILE env var)

I've tried this a few times, and everytime I get something like this:

https://gist.github.com/331b0decab62fd58483c

If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the 
before_exec it works fine.


PS. When deploying I use USR2 followed by QUIT


Cheers,
Lawrence

> I started playing around with Bundler 1.0.10 today and noticed it's
> quite different than previous versions (based on my limited experiences)
> and the out-of-the-box experience is pretty good regarding (lack of)
> ENV pollution.
>
> Can any more experienced Bundler (and possibly Capistrano) users
> comment on the below changes and see if they make sense?
>
> Thanks in advance!
>
> diff --git a/Sandbox b/Sandbox
> index d101106..46dfb91 100644
> --- a/Sandbox
> +++ b/Sandbox
> @@ -45,11 +45,20 @@ This is no longer be an issue as of bundler 0.9.17
>
>   ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com
>
> +=== BUNDLE_GEMFILE for Capistrano users
> +
> +You may need to set or reset the BUNDLE_GEMFILE environment variable in
> +the before_exec hook:
> +
> +        before_exec do |server|
> +          ENV["BUNDLE_GEMFILE"] = "/path/to/app/current/Gemfile"
> +        end
> +
>   === Other ENV pollution issues
>
> -You may need to set or reset BUNDLE_GEMFILE, GEM_HOME, GEM_PATH and PATH
> -environment variables in the before_exec hook as illustrated by
> -http://gist.github.com/534668
> +If you're using an older Bundler version (0.9.x), you may need to set or
> +reset GEM_HOME, GEM_PATH and PATH environment variables in the
> +before_exec hook as illustrated by http://gist.github.com/534668
>
>   == Isolate
>

_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-08 14:22 ` Justin Giancola
@ 2011-03-10  0:49   ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2011-03-10  0:49 UTC (permalink / raw)
  To: unicorn list

Justin Giancola <justin.giancola@gmail.com> wrote:
> Setting BUNDLE_GEMFILE in the before_exec hook is the only
> Bundler-related Unicorn config I've needed for Bundler >= 1.0.3

Thanks, that seems to match my observations, too.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-09 10:39 ` Lawrence Pit
@ 2011-03-10  0:52   ` Eric Wong
  2011-03-10  3:30     ` Lawrence Pit
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2011-03-10  0:52 UTC (permalink / raw)
  To: unicorn list

Lawrence Pit <lawrence.pit@gmail.com> wrote:
> Hi Eric,
>
> I tested this out:

Thanks for taking your time to test.

> - in the before_exec and after_fork I log PATH GEM_HOME GEM_PATH  
> BUNDLE_GEMFILE for inspection after deployment
>
> - deploy latest release, make sure to shutdown unicorn, then start cleanly
>
> - prune all releases, except the last one
>
> - deploy latest release again (which only sets the BUNDLE_GEMFILE env var)
>
> I've tried this a few times, and everytime I get something like this:
>
> https://gist.github.com/331b0decab62fd58483c

Yikes, it looks like the UNICORN_FD env is getting clobbered somehow.
Not sure what could be causing that.

> If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the  
> before_exec it works fine.

Which Bundler version is this with?

> PS. When deploying I use USR2 followed by QUIT
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-10  0:52   ` Eric Wong
@ 2011-03-10  3:30     ` Lawrence Pit
  2011-03-10 21:29       ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Lawrence Pit @ 2011-03-10  3:30 UTC (permalink / raw)
  To: unicorn list


 >  Which Bundler version is this with?

Bundler 1.0.10


Cheers,
Lawrence

> I've tried this a few times, and everytime I get something like this:
>> https://gist.github.com/331b0decab62fd58483c
> Yikes, it looks like the UNICORN_FD env is getting clobbered somehow.
> Not sure what could be causing that.
>
>> If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the
>> before_exec it works fine.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC/PATCH] Bundler/Sandbox documentation updates
  2011-03-10  3:30     ` Lawrence Pit
@ 2011-03-10 21:29       ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2011-03-10 21:29 UTC (permalink / raw)
  To: unicorn list

Lawrence Pit <lawrence.pit@gmail.com> wrote:
> Eric Wong <normalperson@yhbt.net> wrote:
>> I've tried this a few times, and everytime I get something like this:
>>> https://gist.github.com/331b0decab62fd58483c
>> Yikes, it looks like the UNICORN_FD env is getting clobbered somehow.
>> Not sure what could be causing that.
>>
>>> If I revert back to setting the GEM_HOME, GEM_PATH and PATH in the
>>> before_exec it works fine.

> >  Which Bundler version is this with?
>
> Bundler 1.0.10

Odd, I actually used this in my Rainbows! config file to switch an
Isolate deploy to Bundler (1.0.10) yesterday.   Everything for Rainbows!
applies to Unicorn, too).

  # switching from Isolate to Bundler:
  if ENV["GEM_HOME"] =~ %r{/isolate/}
    ENV.delete "GEM_HOME"
    ENV.delete "GEM_PATH"
    # don't need anything else in $PATH for a web server
    ENV["PATH"] = "/home/ew/ruby-1.9.2/bin"

    # START_CTX is considered a stable interface in Unicorn
    start_ctx = Unicorn::HttpServer::START_CTX
    start_ctx[0] = "bundle"

    # it's even possible to use USR2 to switch between Unicorn and
    # Rainbows! without any downtime :)
    start_ctx[:argv] = %w(exec rainbows).concat(start_ctx[:argv])
  end

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-10 21:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08  4:40 [RFC/PATCH] Bundler/Sandbox documentation updates Eric Wong
2011-03-08 14:22 ` Justin Giancola
2011-03-10  0:49   ` Eric Wong
2011-03-09 10:39 ` Lawrence Pit
2011-03-10  0:52   ` Eric Wong
2011-03-10  3:30     ` Lawrence Pit
2011-03-10 21:29       ` Eric Wong

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).