unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* running unicorn under rvm
@ 2010-08-17  1:29 Joseph McDonald
  2010-08-17  3:52 ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Joseph McDonald @ 2010-08-17  1:29 UTC (permalink / raw)
  To: mongrel-unicorn

unicorn 1.1.2 runs fine under my system ruby, but when trying to run
it using rvm, I get:


% rvm use 1.8.7
info: Using ruby 1.8.7 p299

% unicorn
/home/joe/.rvm/gems/ruby-1.8.7-p299/gems/unicorn-1.1.2/lib/unicorn/configurator.rb:494:in
`eval': undefined local variable or method `host' for main:Object
(NameError)

line 494 looks like:

 # XXX ugly as hell, WILL FIX in 2.x (along with Rainbows!/Zbatery)
    host, port, set_listener, options, daemonize =
                    eval("[ host, port, set_listener, options, daemonize ]",
                         TOPLEVEL_BINDING)

any ideas why it would have a problem when running under rvm?

thanks,
-joe
_______________________________________________
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] 5+ messages in thread

* Re: running unicorn under rvm
  2010-08-17  1:29 running unicorn under rvm Joseph McDonald
@ 2010-08-17  3:52 ` Eric Wong
  2010-08-17 22:37   ` Joseph McDonald
  2010-08-18  1:22   ` Joseph McDonald
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Wong @ 2010-08-17  3:52 UTC (permalink / raw)
  To: Joseph McDonald; +Cc: unicorn list

Joseph McDonald <superjoe@gmail.com> wrote:
> unicorn 1.1.2 runs fine under my system ruby, but when trying to run
> it using rvm, I get:
> 
> 
> % rvm use 1.8.7
> info: Using ruby 1.8.7 p299
> 
> % unicorn
> /home/joe/.rvm/gems/ruby-1.8.7-p299/gems/unicorn-1.1.2/lib/unicorn/configurator.rb:494:in
> `eval': undefined local variable or method `host' for main:Object
> (NameError)

Hi Joseph,

Is there any chance you have an older "unicorn" executable script
somewhere that gets exposed rvm switches the environment on you?  That's
the only thing I can think of right now.

> line 494 looks like:
> 
>  # XXX ugly as hell, WILL FIX in 2.x (along with Rainbows!/Zbatery)

Yes, I still need to work on 2.x and clean up a lot of the
ugly internal API bits :)


-- 
Eric Wong

P.S.: At least nowadays I'm (finally) getting some experience
developing/supporting applications using Unicorn and Rainbows! (or
Zbatery).  Things like e4d0b226391948ef433f1d0135814315e4c48535 in
unicorn.git are a direct result of that.
_______________________________________________
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] 5+ messages in thread

* Re: running unicorn under rvm
  2010-08-17  3:52 ` Eric Wong
@ 2010-08-17 22:37   ` Joseph McDonald
  2010-08-18  1:08     ` Eric Wong
  2010-08-18  1:22   ` Joseph McDonald
  1 sibling, 1 reply; 5+ messages in thread
From: Joseph McDonald @ 2010-08-17 22:37 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn list

Thanks Eric, see below:

On Mon, Aug 16, 2010 at 8:52 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Joseph McDonald <superjoe@gmail.com> wrote:
>> unicorn 1.1.2 runs fine under my system ruby, but when trying to run
>> it using rvm, I get:
>>
>>
>> % rvm use 1.8.7
>> info: Using ruby 1.8.7 p299
>>
>> % unicorn
>> /home/joe/.rvm/gems/ruby-1.8.7-p299/gems/unicorn-1.1.2/lib/unicorn/configurator.rb:494:in
>> `eval': undefined local variable or method `host' for main:Object
>> (NameError)
>
> Hi Joseph,
>
> Is there any chance you have an older "unicorn" executable script
> somewhere that gets exposed rvm switches the environment on you?  That's
> the only thing I can think of right now.

I'm sure I'm running the right version of unicorn.
what's weird is if I remove the reference to TOPLEVEL_BINDING, it works, i.e.:

 host, port, set_listener, options, daemonize =
                    eval("[ host, port, set_listener, options, daemonize ]")

works, it gets the right port from the config.ru file.

my config.ru file looks like"
#\ -w -p 4452
require './mystuff'
run Sinatra::Application

another strange thing:  I need to add the "./"  in front of mystuff,
but when i'm not using rvm (rvm use system), I don't need to do that.

I'm curious if anyone else is using unicorn with rvm and not having
this problem.  I'm guessing it's something weird with my system, but
not sure.

thanks,
-joe





>
>> line 494 looks like:
>>
>>  # XXX ugly as hell, WILL FIX in 2.x (along with Rainbows!/Zbatery)
>
> Yes, I still need to work on 2.x and clean up a lot of the
> ugly internal API bits :)
>
>
> --
> Eric Wong
>
> P.S.: At least nowadays I'm (finally) getting some experience
> developing/supporting applications using Unicorn and Rainbows! (or
> Zbatery).  Things like e4d0b226391948ef433f1d0135814315e4c48535 in
> unicorn.git are a direct result of that.
>
_______________________________________________
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] 5+ messages in thread

* Re: running unicorn under rvm
  2010-08-17 22:37   ` Joseph McDonald
@ 2010-08-18  1:08     ` Eric Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2010-08-18  1:08 UTC (permalink / raw)
  To: Joseph McDonald; +Cc: unicorn list

Joseph McDonald <superjoe@gmail.com> wrote:
> I'm sure I'm running the right version of unicorn.
> what's weird is if I remove the reference to TOPLEVEL_BINDING, it works, i.e.:
> 
>  host, port, set_listener, options, daemonize =
>                     eval("[ host, port, set_listener, options, daemonize ]")
> 
> works, it gets the right port from the config.ru file.

Hm... I'm stumped.  However, you're really encouraging me to pause other
projects, work on 2.0 and release it this week/weekend :)  I suppose
some of the crazier 2.0 stuff I proposed can wait until 3.x.

> my config.ru file looks like"
> #\ -w -p 4452
> require './mystuff'
> run Sinatra::Application
> 
> another strange thing:  I need to add the "./"  in front of mystuff,
> but when i'm not using rvm (rvm use system), I don't need to do that.

Odd... needing the './' feels like it's using Ruby 1.9.2 or later...
Can you print out RUBY_VERSION in there to be certain?

I just tried rvm for the first time with a fresh user/home directory on my
system and everything works as expected with 1.8.7 (it just picked p302, not
p299, but that shouldn't make a difference...).

> I'm curious if anyone else is using unicorn with rvm and not having
> this problem.  I'm guessing it's something weird with my system, but
> not sure.

If you have root on your machine, just try creating a new user and start
with a blank $HOME.  I often do that to narrow things down when
debugging/testing code and don't feel like going all the way with chroot
or VM.

-- 
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] 5+ messages in thread

* Re: running unicorn under rvm
  2010-08-17  3:52 ` Eric Wong
  2010-08-17 22:37   ` Joseph McDonald
@ 2010-08-18  1:22   ` Joseph McDonald
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph McDonald @ 2010-08-18  1:22 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn list

I added
TOPLEVEL_BINDING = binding
to gems/unicorn-1.1.2/bin/unicorn
and it seemed to fix it:

#!/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby
# -*- encoding: binary -*-
require 'unicorn/launcher'
require 'optparse'
# !!!!!!!!!  added the line below:
TOPLEVEL_BINDING = binding
ENV["RACK_ENV"] ||= "development"

I still have no idea why I need to do that.

thanks,
-joe


On Mon, Aug 16, 2010 at 8:52 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Joseph McDonald <superjoe@gmail.com> wrote:
>> unicorn 1.1.2 runs fine under my system ruby, but when trying to run
>> it using rvm, I get:
>>
>>
>> % rvm use 1.8.7
>> info: Using ruby 1.8.7 p299
>>
>> % unicorn
>> /home/joe/.rvm/gems/ruby-1.8.7-p299/gems/unicorn-1.1.2/lib/unicorn/configurator.rb:494:in
>> `eval': undefined local variable or method `host' for main:Object
>> (NameError)
>
> Hi Joseph,
>
> Is there any chance you have an older "unicorn" executable script
> somewhere that gets exposed rvm switches the environment on you?  That's
> the only thing I can think of right now.
>
>> line 494 looks like:
>>
>>  # XXX ugly as hell, WILL FIX in 2.x (along with Rainbows!/Zbatery)
>
> Yes, I still need to work on 2.x and clean up a lot of the
> ugly internal API bits :)
>
>
> --
> Eric Wong
>
> P.S.: At least nowadays I'm (finally) getting some experience
> developing/supporting applications using Unicorn and Rainbows! (or
> Zbatery).  Things like e4d0b226391948ef433f1d0135814315e4c48535 in
> unicorn.git are a direct result of that.
>
_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2010-08-18  1:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17  1:29 running unicorn under rvm Joseph McDonald
2010-08-17  3:52 ` Eric Wong
2010-08-17 22:37   ` Joseph McDonald
2010-08-18  1:08     ` Eric Wong
2010-08-18  1:22   ` Joseph McDonald

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