Missing Source File when deploying

18 views
Skip to first unread message

Dr_Gavin

unread,
Jan 13, 2009, 2:14:25 PM1/13/09
to Deploying Ruby on Rails
I have an app I've just managed to lauch but when I visit the homepage
I get an error 500 message

On my production log I can see :

"MissingSourceFile (no such file to load -- mysql)"

I've downloaded the MySQL gem using the means provided by my host by
that hasn't helped.

does anybody have a clue how to fix this?

the app was built in Rails 2.1 but launched in Rails 2.2 if that
helps?
I updated rails on my machine and all of my tests pass. The app runs
fine on my machine in rails 2.2.2

This is my first time deploying and I'd really appeciate some help if
anybody can spare a few minutes?

Thanks,

Gavin

Alex Malinovich

unread,
Jan 13, 2009, 2:43:20 PM1/13/09
to Deploying Ruby on Rails
A 500 message typically means that your mongrels are not responding.
How did you go about installing the gem? (anything other than "gem
install" isn't going to work since the mysql gem requires platform-
specific bindings to build properly).

--
Alex Malinovich
Director of Deployment Services

PLANET ARGON, LLC
design // development // hosting

http://www.planetargon.com
http://www.the-love-shack.net [blog]

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

Dr_Gavin

unread,
Jan 13, 2009, 3:22:18 PM1/13/09
to Deploying Ruby on Rails
Hi Alex

My host - 600host offers a system wherby you install gems directly by
selecting from a list.
The gem then appears on my list of gems.

On closer inspection though, my gems are installed in a specific
folder:
------
Ruby Gems are are collections of functions that allow you to perform
tasks in Ruby. You will need to install a Gem before you can use it
inside a Ruby program.

Note: Gems are installed directly from the RubyForge repository.

Location of Your Ruby Gem(s)

Path: /home/thinkers/ruby/gems

Using Your Ruby Gem(s)

You will need to add /home/thinkers/ruby/gems to the include path.
You can do this by adding the following code to your script:

$:.push("/home/thinkers/ruby/gems")

--------

any idea where in my script I would add "$:.push("/home/thinkers/ruby/
gems")" ? You reckon this would solve the problem?


On 13 Jan, 19:43, Alex Malinovich <alex.malinov...@planetargon.com>
wrote:
> A 500 message typically means that your mongrels are not responding.
> How did you go about installing the gem? (anything other than "gem
> install" isn't going to work since the mysql gem requires platform-
> specific bindings to build properly).
>
> --
> Alex Malinovich
> Director of Deployment Services
>
> PLANET ARGON, LLC
> design // development // hosting
>
> http://www.planetargon.comhttp://www.the-love-shack.net[blog]

Dr_Gavin

unread,
Jan 13, 2009, 3:58:02 PM1/13/09
to Deploying Ruby on Rails
Hi Alex - Thanks for replying

My host, 600host.net, require that you install gems using their online
facilities.

They also state that all gems are installed in a specific 'Ruby'
folder, in my case:

"/home/thinkers/ruby/gems" (thinkers is the app name)

They explain that I should add this code to my script:
$:.push("/home/thinkers/ruby/gems")

any idea where I would add it?

thanks

On 13 Jan, 19:43, Alex Malinovich <alex.malinov...@planetargon.com>
wrote:
> A 500 message typically means that your mongrels are not responding.
> How did you go about installing the gem? (anything other than "gem
> install" isn't going to work since the mysql gem requires platform-
> specific bindings to build properly).
>
> --
> Alex Malinovich
> Director of Deployment Services
>
> PLANET ARGON, LLC
> design // development // hosting
>
> http://www.planetargon.comhttp://www.the-love-shack.net[blog]

Alex Malinovich

unread,
Jan 13, 2009, 7:44:36 PM1/13/09
to Deploying Ruby on Rails
This looks like it probably would solve your problem. I've never seen
a Rails host require users to do that, though I'd imagine that some of
the one-size-fits-all hosts out there might suggest it. In general,
anything that loads gems should typically go into your environment.rb
file. The "correct" way of doing that is by adding any additional
paths to config.load_paths in your environment.rb. For example, to
include any gems in vendor/gems/ you would do something like:

config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
File.directory?(lib = "#{dir}/lib") ? lib : dir
end

Assuming that the code your host has provided you works, and assuming
that they build the gem properly (as I said before, the mysql gem has
to be built on the platform that it's going to be used on), then
getting rails to load it via environment.rb make it get loaded.

But judging by the error you've been getting in your logs, the problem
is definitely that your project can't find the mysql gem. And without
it, it can't connect to the database, so your mongrels just die
immediately after starting. (And you get the 500 gateway error that so
many Rails admins are so familiar with. :) )

Hope that helps.

--
Alex Malinovich
Director of Deployment Services

PLANET ARGON, LLC
design // development // hosting

http://www.planetargon.com
http://www.the-love-shack.net [blog]

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

Dr_Gavin

unread,
Jan 14, 2009, 5:05:41 AM1/14/09
to Deploying Ruby on Rails
Hi again Alex

I'm sorry if I sound like a complete noob here but, isn't .push() a
public instance method?

If so, shouln'd it have an object prefix? Is '$:' an object?

I tried adding $:.push("/home/thinkers/ruby/gems") to environment.rb
and rebooting but it had no effect.

Is there something really stupid I've missed out here?

Gavin

On 14 Jan, 00:44, Alex Malinovich <alex.malinov...@planetargon.com>
wrote:
Reply all
Reply to author
Forward
0 new messages