I'm trying to write a solaris SMF file to launch the ferret drb server. The goal is to get ferret working and reboot ready on a joyent dedicated accelerator. That's a lot of acronyms, and i'm not vary familiar with most of them, but I'm forging ahead... I almost have things working, but I've run into a small snag that I hope someone can eduction me about. Ferret's 'server_manager.rb' file contains these two lines of code: #require(File.join(File.dirname(__FILE__), '../../../../config/environment')) require(File.join(File.dirname(ENV['_']), '../config/environment')) The problem is that when I run ferret from my SMF file ENV['_'] is nil, and so it crashes on startup. If I comment that line, and uncomment the above line everything works great. So my question is where is ENV['_'] supposed to be assigned. I can define it ahead of time in my SMF file, but I'm wondering if ENV['_'] not being present is a symptom of a larger config problem that I don't know about. Thanks for your help.
on 01.12.2007 18:41
on 02.12.2007 06:19
Jesse Grosjean wrote: > I'm trying to write a solaris SMF file to launch the ferret drb server. Hmm, I think I've hit a similar problem. I've just upgraded to the latest ferret trunk from an old aaf stable where the script/ferret_start and script/ferret_stop scripts were still in use. now if I call the old script... RAILS_ENV=production script/ferret_start script/ferret_start:25:in `load': wrong number of arguments (0 for 1) (ArgumentError) from script/ferret_start:25 but if I call the new script... ruby script/ferret_server -e production stop no such file to load -- /usr/bin/../config/environment so I am confused! Pretty sure the latest aaf drb server is not compatible with the info in http://projects.jkraemer.net/acts_as_ferret/wiki/DrbServer . Happy to help edit that when we figure this out. Sam
on 02.12.2007 14:58
Hi! On Sun, Dec 02, 2007 at 06:19:33AM +0100, Sam Giffney wrote: > script/ferret_start:25:in `load': wrong number of arguments (0 for 1) > (ArgumentError) > from script/ferret_start:25 > > but if I call the new script... > > ruby script/ferret_server -e production stop > no such file to load -- /usr/bin/../config/environment yeah, this happens because I use ENV['_'] to determine the location of the Rails environment file. When calling the script as argument to the ruby binary, ENV['_'] points there and not to the script. So if you make script/ferret_server executable and ensure the first line points to your ruby binary it should work. Or edit aaf's server_manager.rb and use __FILE__ instead of ENV['_'] - this will work as long as you have aaf installed in your project and don't use the acts_as_ferret gem. I'll happily apply a patch which will help get around these annoying problems and make the script work under all circumstances (using aaf gem or not, calling with explicit Ruby interpreter or not). Cheers, Jens -- Jens Krämer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database
on 14.12.2007 22:52
Jens,
Would using $0 work?
$ cat boo.rb
#!/usr/bin/env ruby
puts "I am #{$0}"
$ ruby boo.rb
I am boo.rb
$ ./boo.rb
I am ./boo.rb
Jens Krämer wrote:
>
> I'll happily apply a patch which will help get around these annoying
> problems and make the script work under all circumstances (using aaf gem
> or not, calling with explicit Ruby interpreter or not).
>
on 03.03.2008 06:18
Thanks Jens. changing server_manager.rb in plugin's lib directory did the magic for me. I had a tough time to get our drb ferret server up and running. It'll be good if you apply these modifications to the gem/plugin. keep up the good work, and thanks for aaf. regards, Anuj. Jens Krämer wrote: > Hi! > > On Sun, Dec 02, 2007 at 06:19:33AM +0100, Sam Giffney wrote: >> script/ferret_start:25:in `load': wrong number of arguments (0 for 1) >> (ArgumentError) >> from script/ferret_start:25 >> >> but if I call the new script... >> >> ruby script/ferret_server -e production stop >> no such file to load -- /usr/bin/../config/environment > > yeah, this happens because I use ENV['_'] to determine the location of > the Rails environment file. When calling the script as argument to the > ruby binary, ENV['_'] points there and not to the script. > > So if you make script/ferret_server executable and ensure the first line > points to your ruby binary it should work. > > Or edit aaf's server_manager.rb and use __FILE__ instead of ENV['_'] - > this will work as long as you have aaf installed in your project and > don't use the acts_as_ferret gem. > > I'll happily apply a patch which will help get around these annoying > problems and make the script work under all circumstances (using aaf gem > or not, calling with explicit Ruby interpreter or not). > > > Cheers, > Jens > > -- > Jens Kr�mer > http://www.jkraemer.net/ - Blog > http://www.omdb.org/ - The new free film database
on 12.12.2008 10:39
Anuj Luthra wrote: > Thanks Jens. > > changing server_manager.rb in plugin's lib directory did the magic for > me. I had a tough time to get our drb ferret server up and running. > It'll be good if you apply these modifications to the gem/plugin. > > keep up the good work, and thanks for aaf. > > regards, > Anuj. Hi, This helped, but didnt say what you actually did! We were getting when we tried to start ferret: "can't convert nil into String" I edited the server_manager.rb (find the one thats appropriate) - in live or production directories with: find . -name 'server_manager.rb' then edit the file and hash out the line below as I have done: #require(File.join(File.dirname(ENV['_']), '../config/environment')) Then add the following below it: require(File.join(Dir.pwd, './config/environment')) Then start ferret - usually by: ruby scripts/ferret_server -e production start That worked for me!