views:

832

answers:

2

I am trying to deploy my first Rails app. I copied all files to ~/mysite.com and set up MySql.

Here's my configuration at Dreamhost.

Now when I visit mysite.com I get a 404 error (which isn't my custom 404 error). It seems that Passenger does not run!

What should I do? Do I need to start Passenger? (touch tmp/restart.txt does nothing)

A: 

4 things to check first:

  1. You enabled Ruby on Rails Passenger (mod_rails) for the domain name
  2. You point your domain name configuration to the public directory of your application.
  3. Your Rails Version (As of 8/5/2009 Rails is up to 2.3.3 but Dreamhost is at 2.2.2)
  4. All your gem dependencies are available at Dreamhost, in your home folder, or are unpacked in your rails application.

If passenger is giving you an error message then your rails app isn't starting, but passenger will put something in the apache logs.

These are in: ~/logs/domain.name/http/

Usually this is because of the wrong rails version or a missing gem or some other mismatch between the dreamhost environment and your development machine.

danivovich
Now you can see the configuration following the link above.
collimarco
I am having trouble viewing that, I will try again later.
danivovich
Now I get an error from Passenger: http://www.foto-fiori.com/But I can't understand what the problem is: the log says nothing :(
collimarco
I just edited the post with some info about what to check if you see the passenger error screen.
danivovich
+1  A: 

Based on your stack trace at http://www.foto-fiori.com/ it looks like there's a gem missing on your production server. Check the gem list in your environment.rb config file and ensure all gems are installed. You can also ssh into your application and run rake gems.

rake gems RAILS_ENV=production

You may want to freeze the gems if Dreamhost does not allow you to install them.

rake rails:freeze:gems
ryanb
$ rake gems(in /mnt/local/home/collimarco/foto-fiori.com) - [I] mysql - [I] mini_exiftool I = Installed
collimarco
Can you run "script/console production" in your rails app on dreamhost?
ryanb
$ script/console productionLoading production environment (Rails 2.3.3)>> User.count=> 7
collimarco
Interesting, and that is done when you ssh into your dreamhost server? I'm not too familiar with how Dreamhost is setup, but is it possible that there are multiple versions of Ruby installed? Perhaps Passenger is using a different one than your account is. A different version will likely have a different set of rubygems installed.
ryanb
Also take a look at the wiki page: http://wiki.dreamhost.com/Passenger. Try specifying the gem path as they show there. It's the 4th point down in the Technical Notes section.
ryanb
Thanks @ryanb! script/console runs with my user configuration, while Passenger runs as another user on DH (and so it didn't read my user config). I changed ENV variable in environment.rb and now everything works.
collimarco