Moving Rails apps from Windows to Linux

I’m having a really strange problem. I’ve developed some rails aps on
windows, and they work fine.

  • I go to linux box where they will be deployed.
  • I export out of subversion.
  • I add a new virtual host on the web server (Litespeed) and point it to
    the new folder.
  • Any request to a rails method throws a 503 at the browser. static
    content is fine.
  • if I create a new rails app on the linux server, and then copy my
    application over the new one, it works fine.

I verified all the file permissions too. Pretty odd. What do you guys
think?

Thanks for your time.

Brandon C. wrote:

  • Any request to a rails method throws a 503 at the browser. static
    content is fine.

I ran into this last night actually and it ended up being two things:
In the Litespeed admin interface I didn’t set the environment setting to
match that of my Rail’s app. Second, Litespeed by default points to a
different location for the Ruby bin, I had mine installed in
/usr/local/ruby so I had to modify that setting too. Then it worked.
FYI - I was on Mac OS X so your mileage may vary.

Thanks for the pointers. I checked everything out and it looks correct.
however I am dealing with two new things at one…rails and linux. It’s
been fairly smooth sailing so far, so I was bound to run into trouble.

I’m pretty sure the path is correct because both the broken rails app
and the working rails app are running off the same vitrual host. I
created one virtual host, and then added two Rails contexts to it. So it
seems Litespeed knows where the ruby bin is.

I still don’t understand why copying the complete application copied
over a locally created skeleton works.

Which particular rails settings should I be looking out for in
Litespeed?

I had the exact same problem. After a bit of research I found that the
dispatch file hashbangs (in all three dispatch.* files) were incorrect

  • they were pointing at my Windown install of Ruby!

1: If you create Rails projects on a Windows machine, you’ll have to
copy the hashbangs over from another project. You can copy the whole
files if you like.
2: You’ll have to set them as ‘execute’ as well as ‘read/write’ chmod
750 IIRC
3: If you create your Rails project on the deployment machine, you
should be OK. Subversion my easily screw up the perms though.

Hope that’s it! :slight_smile:

What are the advantages of Litespeed? I’m on Apache and Mongrels…

Brandon C. wrote:

I still don’t understand why copying the complete application copied
over a locally created skeleton works.

This is baffling to me as well. Seems like it shouldn’t work either…

Which particular rails settings should I be looking out for in
Litespeed?

There is a “Rails” tab in the Litespeed admin interface. Still make
sure the Ruby Bin your pointing at is at least Ruby 1.82. I know some
Linux distros ship with old versions of Ruby.

Ah. For a price.

I may look into this when the money starts rolling in…

Ben,

The #! were all wrong. I made the changes, restarted the web server and
still there no change.

Will,
I verified the Ruby path in Litespeed (/usr/lib/ruby). /ruby/lib/ruby is
a link to a /lib/ruby/ruby1.8 executable. I’m using Ubuntu and the
package manager says it’s Ruby 1.8.2.

I tried again I copied my rails applicaiton from the syn repo, over a
default rails app and it works. This is so strange.

Is there any kind of system profiler in linux that could give me a clue?

Ben wrote:

What are the advantages of Litespeed? I’m on Apache and Mongrels…

Very fast to setup and get going. Very easy to admin.

http://i.nfectio.us/litespeed2/litespeed2.html
(Litespeed up and running in 4 minutes)

I’d try 3 things:

script/console
does it work?

script/about
what does it say?

script/server webrick
does it work?

-Dan

On 11/8/06, Brandon C. [email protected] wrote:

package manager says it’s Ruby 1.8.2.


[email protected]

Litespeed logs?
Rails logs?

The log directory may give you some clues. Anything interesting in
there?

Did you do the CHMOD?

Also, the video showing Litespeed install says that the dispatch files
no longer need to be copied after a certain version. Have you got old
code, needing a dispatch file copy?

It appears a gem install did the trick.

Just do you know I’m new to linux. I decided to go with Ubuntu becuase
to me it offered an advanced path and a novice path equally well. For
the most part, the package mnager on Ubuntu is pretty good, but
installed Ruby and Rails was a bit of a wild goose hunt. When I was
installed the rails/ruby packages I noticed it wanted to install two
versions of Ruby, and I thought it was pointing out some really odd
dependencies, but I assumed it knew what it was doing. The package
manager is well and good, but for certain things I guess your better off
just hitting the command line.

So lesson learned…don’t use the package manager for rails. Try gems
first, and if you really must have it your way then
download/build/install parts as needed.

Litespeed logs?
Nothing there but my web request

Rails logs?
nothing…

The log directory may give you some clues. Anything interesting in
there?
You mean the operating system log files?

Did you do the CHMOD?
In one scenario yes. In another I tried Litespeed’s SuEXEc. Both worked
equally well on the “good” applications, and had do difference on the
bad.

Also, the video showing Litespeed install says that the dispatch files
no longer need to be copied after a certain version. Have you got old
code, needing a dispatch file copy?

I watched the same video. I have the latest Litespeed and I didn’t not
add a new dispatcher.

I’m taking a crap shoot here. I saw some odd ball stuff going on with
rails. it complained when I went to executre a few of the commands Dan
mentiones (I should have thought to try that a while ago).

So right now I’m decided to try a gem install rails, and it’s finding
some stuff that was missing.

…and I just pulled my project out of SVN to the linux box, pointed a
virtual host at it and it works like magic. I didn’t have to change the
#!'s either. I’m not sure why, but since I’m using Litespeed the ruby
scripts might be getting executed in a different kind of environment.