unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Changing Ruby version
@ 2013-02-14 14:10 Jérémy Lecour
  2013-02-14 20:20 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Jérémy Lecour @ 2013-02-14 14:10 UTC (permalink / raw)
  To: Liste Unicorn

Hi,

I'm using Unicorn with rbenv to have different Ruby versions between projects.

This morning, I wanted to change the Ruby version used by an app.
I've updated the content of .ruby-version, then sent a USR2 signal to
the master process to restart Unicorn (as I always do).

I've noticed that it was still using the "old" Ruby binary.

If I started a new irb console, the Ruby was correct.

Then I thought that maybe the way forking works allows to change the
version of Unicorn itself and everything "below", but not the Ruby
binary.

Am I right ?
Is there a way to do a rolling restart and change the Ruby binary at
the same time?

thanks

--
Jérémy Lecour :
http://jeremy.wordpress.com - http://twitter.com/jlecour
_______________________________________________
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] 3+ messages in thread

* Re: Changing Ruby version
  2013-02-14 14:10 Changing Ruby version Jérémy Lecour
@ 2013-02-14 20:20 ` Eric Wong
  2013-02-14 21:35   ` Jérémy Lecour
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2013-02-14 20:20 UTC (permalink / raw)
  To: unicorn list

Jérémy Lecour <jeremy.lecour@gmail.com> wrote:
> Hi,
> 
> I'm using Unicorn with rbenv to have different Ruby versions between projects.
> 
> This morning, I wanted to change the Ruby version used by an app.
> I've updated the content of .ruby-version, then sent a USR2 signal to
> the master process to restart Unicorn (as I always do).
> 
> I've noticed that it was still using the "old" Ruby binary.

I'm not familiar with rbenv, but you need to use the same "unicorn"
executable script for both installations (changing the shebang (#!)
line will do.

Otherwise, you can tweak Unicorn::HttpServer::START_CTX
(ref: http://unicorn.bogomips.org/Unicorn/HttpServer.html )

> If I started a new irb console, the Ruby was correct.

This is probably because the shell you started irb from has the new
environment variables needed to find your new Ruby.  unicorn was
started from a different parent shell/process which had different
environment variables.

You may also need to modify ENV in a before_exec hook if there are
other environment variables your app depends on which a different
Ruby installation would change.

> Then I thought that maybe the way forking works allows to change the
> version of Unicorn itself and everything "below", but not the Ruby
> binary.
> 
> Am I right ?
> Is there a way to do a rolling restart and change the Ruby binary at
> the same time?

What you're doing is switching between Ruby installations (to different
paths).  unicorn still supports this, but it's a little more involved
and involves modifying START_CTX (and possibly ENV).

The "upgrade" case is easiest when a new version of Ruby is installed
over the old one (this is the common case for OS package managers
(e.g.  RPM/dpkg/ports)).
_______________________________________________
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] 3+ messages in thread

* Re: Changing Ruby version
  2013-02-14 20:20 ` Eric Wong
@ 2013-02-14 21:35   ` Jérémy Lecour
  0 siblings, 0 replies; 3+ messages in thread
From: Jérémy Lecour @ 2013-02-14 21:35 UTC (permalink / raw)
  To: unicorn list

2013/2/14 Eric Wong <normalperson@yhbt.net>:

> What you're doing is switching between Ruby installations (to different
> paths).  unicorn still supports this, but it's a little more involved
> and involves modifying START_CTX (and possibly ENV).
>
> The "upgrade" case is easiest when a new version of Ruby is installed
> over the old one (this is the common case for OS package managers
> (e.g.  RPM/dpkg/ports)).

This kind of switch is rare enough, but If I have to do this
regularly, I'll eventually try that.

Thanks


-- 
Jérémy Lecour :
http://jeremy.wordpress.com - http://twitter.com/jlecour
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2013-02-14 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-14 14:10 Changing Ruby version Jérémy Lecour
2013-02-14 20:20 ` Eric Wong
2013-02-14 21:35   ` Jérémy Lecour

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