How to deploy a Rails app to Dreamhost?
Asked Answered
S

1

6

I'm kind of lost, I try to deploy my application on a shared dreamhost server. Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together.

On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that makes sense.

So what do I have to do to make it run?

I enabled fastcgi support and mod_rails.

Now, how do I get the app constantly running?

I keep reading about having to do things to .htaccess and to dispatch.fcgi.

But I can't find any dispatch file in my rails app (2.3.2).

Do I have to create that one manually? Doesn't really feeld very rails-like to me. I didn't really manage to find out what this dispatch file does, and why it's needed.

Any help would be greatly appreciated.

I looked at the DH Wiki, but couldn't figure it out (http://wiki.dreamhost.com/Rails)

Additions:

I enabled mod_rails and pointed to the public directory (I had already done that). I keep getting an error: screencast.com/t/KamqVawk

Hm, server logs look like there is actually no request, so this might be a problem on dreamhosts end. It's strange I see that the access.log show a new change date, when I try to access the page, but there is no request noted, error.log is empty too.

screenshot of configuration

Dreamhost Support Answer:

The server was up to date, so that wasn't the problem. They proposed freezing the Gems, which I did (see: http://wiki.dreamhost.com/Freezing_Gems) But it didn't help. I guess I'm giving up, and looking into hosting which is specialized for rails.

Thx for all your help!

Changed to hostingrails.com

I got the app working on hostingrails.com, passenger on hostingrails.com showed me errors, which weren't shown by dreamhost or mongrel. By correcting these errors, I got the app working.

Sergius answered 12/6, 2009 at 14:46 Comment(0)
E
8

Dreamhost won't let you use webrick if you're using shared hosting. You can either use FastCGI or Passenger to host Rails on shared DH (mongrel is an option if you upgrade to DreamhostPS, but that's obviously more expensive).

For FastCGI, you will need a dispatch.fcgi file (older versions of Rails would generate one when you created a new Rails app, but that stopped around 2.2 if I remember correctly) as well as code in your .htaccess to send requests to the dispatcher. See the Dreamhost Ruby on Rails wiki page for details about setting up FastCGI.

The more preferable option is to set up your application to run on Phusion Passenger (aka mod_rails). It should be pretty simple through your Dreamhost panel, you just need to enable the domain to use mod_rails, and then set the directory for the domain to the public directory of your application. See the Passenger wiki page for more details.

Easily answered 12/6, 2009 at 14:55 Comment(7)
well, that's what I actually did. I enabled mod_rails and pointed to the public directory. I keep getting an error screencast.com/t/KamqVawkSergius
What gets added to your log file when you try to access your site?Easily
as you see in my edit of the question, actually nothing gets recorded.Sergius
It is possible that your account is not yet set up for mod_rails. I would contact DH support, because as far as I can see (could you add a screenshot of the domain edit page?), you've done everything correctly.Easily
I'll do that. Thanx a lot for your help.Sergius
As I assumed, the options in the screenshot look right to me. I'm sure DH support can take it from here :)Easily
I'm not sure, what to do. The answer seems to be right, but didn't help me with my specific problem. So I'm not sure, if I should mark it as correct.Sergius

© 2022 - 2024 — McMap. All rights reserved.