Question

I'd like to deploy a small Rails 3 app on dreamhost (just for testing purposes, nothing serious) and I am wondering if anyone has done it already... Please choose one of the following:

  1. I did it and it's super easy, here's how: ...
  2. Though I didn't try it, it should be easy, here's how: ...
  3. It's quite complicated, but this should get you started: ....
  4. NO WAI!!!1!one!1 Set it up on slicehost or another non-shared hosting or you'll die a painful death trying to force it on DH

Thoughts?

Was it helpful?

Solution

Unfortunately, I think it heavily depends on Dreamhost installing the gems for you, and allowing access to them through the shared environment. You could contact their support department for more information on if and when they plan on deploying Rails 3 to their shared servers.

On the other hand, you could do what your fourth option implies and just go ahead and get a slice somewhere (doesn't necessarily need to be with SliceHost; you could deploy cheaply with Heroku) which allows you to deploy your own gems.

Hope this helps!

OTHER TIPS

You can do this but it requires advanced sysadm skills.

In order to use Rails 3 on DreamHost you need to:

  • install Ruby 1.8.7
  • install RubyGems
  • install Rails 3

all in your own home directory because you don't have privileges to install everything elsewhere.

Also, this isn't guarantee to work with the existing Dreamhost Passenger configuration.

I just received an email from dreamhost. I emailed them about 2 months ago regarding rails 3.0, they are starting to push it onto their servers as we speak. Assuming things work out, rails 3 should be supported within the month.

The dreamhost machine I have allocated space on, pisces, appears to have upgraded to Rails 3.0.3 yesterday. I only noticed because a Redmine instance broke horribly :(

As of today, here are what's my dreamhost machine:

    $ rails -v
    Rails 3.0.3

    $ ruby -v
    ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

    $ gem list

    *** LOCAL GEMS ***

    abstract (1.0.0)
    actionmailer (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    actionpack (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    actionwebservice (1.2.6, 1.2.3)
    activemodel (3.0.3)
    activerecord (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    activeresource (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    activesupport (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    acts_as_taggable (2.0.2, 1.0.4)
    ajax_scaffold_generator (3.1.11, 2.2.1)
    archive-tar-minitar (0.5.2, 0.5.1)
    arel (2.0.4)
    auth_generator (2.0.1, 1.5.3)
    Bloglines4R (0.1.0)
    BlueCloth (1.0.0)
    builder (2.1.2, 2.0.0)
    bundler (1.0.7)
    camping (1.5.180, 1.5)
    capistrano (2.5.1, 2.1.0, 1.4.1)
    classifier (1.3.1)
    cmdparse (2.0.2, 2.0.0)
    curb (0.1.4)
    daemons (1.0.10, 1.0.9)
    dbd-mysql (0.4.3)
    dbi (0.4.3)
    deprecated (2.0.1)
    erubis (2.6.6)
    eventmachine (0.12.10, 0.12.8)
    facets (2.2.1, 1.8.54)
    fastthread (1.0.7, 1.0.1)
    feedtools (0.2.29, 0.2.28)
    ferret (0.11.6, 0.11.4)
    flickr (1.0.2)
    gd2 (1.1.1, 1.1)
    gen (0.41.0)
    geoip (0.6.1)
    gettext (1.90.0)
    glue (0.41.0)
    gnuplot (2.2)
    gravtastic (2.0.0)
    gruff (0.3.1)
    haml (2.0.3)
    hoe (1.5.1)
    hpricot (0.6)
    htmltools (1.10)
    i18n (0.4.2, 0.4.1)
    localization_generator (1.0.8)
    login_generator (1.2.2)
    madeleine (0.7.3)
    mail (2.2.15)
    markaby (0.5)
    mechanize (0.7.6)
    metaid (1.0)
    mime-types (1.16)
    mini_magick (1.2.3)
    mysql (2.7)
    needle (1.3.0)
    net-sftp (1.1.1)
    net-ssh (2.0.23, 1.1.2)
    nitro (0.41.0)
    nokogiri (1.4.4)
    og (0.41.0)
    oniguruma (1.1.0)
    packet (0.1.14)
    PageTemplate (2.2.0)
    ParseTree (2.1.1)
    payment (1.0.1)
    pdf-writer (1.1.8)
    podcast (0.0.4)
    polyglot (0.3.1)
    rack (1.2.1, 1.1.0, 1.0.1, 1.0.0)
    rack-mount (0.6.13)
    rack-test (0.5.6)
    radiant (0.6.9)
    rails (3.0.3, 2.3.8, 2.3.5, 2.3.4, 2.3.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.2)
    railties (3.0.3)
    rake (0.8.7, 0.8.3, 0.8.2)
    RedCloth (3.0.4)
    rfacebook (0.9.8)
    rmagick (1.15.14)
    rspec (1.1.3)
    ruby-breakpoint (0.5.1)
    ruby-debug (0.10.0)
    ruby-openid (2.1.7)
    ruby-yadis (0.3.4)
    ruby_odeum (0.4.1)
    rubyforge (0.4.5)
    RubyInline (3.6.7)
    rubypants (0.2.0)
    rubyzip (0.9.1)
    ruport (1.6.0)
    ruport-util (0.14.0)
    ruwiki (0.9.3)
    salted_login_generator (2.0.2)
    shipping (1.5.1)
    SimpleSearch (0.5.0)
    sqlite3-ruby (1.2.1)
    stemmer (1.0.1)
    switchtower (1.0.1)
    syntax (1.0.0)
    tagtools (0.0.3)
    thor (0.14.6, 0.14.4)
    tidy (1.1.2)
    treetop (1.4.9)
    tzinfo (0.3.23)
    unicode (0.1)
    uuidtools (1.0.3)
    webgen (0.4.7)
    wee (0.10.0)
    xhtmldiff (1.0.0)
    xml-simple (1.0.11)
    ym4r (0.6.1)
    youtube-g (0.4.9.9)

From Passenger documentation: http://www.modrails.com/documentation/Users%20guide%20Apache.html#bundler_support

Create a file config/setup_load_paths.rb in your app and add this line:

$: << "<path-where-bundler-gem-was-installed>/lib"

I unpacked bundler gem in vendor/bundle path with this command:

gem unpack bundler --target=vendor/bundle

And the others gems with:

bundle install --deployment

This should work with Dreamhost and Passenger >= 2.2.14

I was able to get this to work by using rvm and fastcgi

My .htaccess file looked like this:

<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>

Options +FollowSymLinks +ExecCGI 

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] 

ErrorDocument 500 "Rails application failed to start properly for your rails app"

And my dispatch.fcgi looked like (note you need to fill in ):

#!/usr/bin/env /home/<MY_HOME_DIR>/.rvm/bin/ruby-1.9.3-p0@awesome

require 'rubygems'
require 'fcgi'

ENV['RAILS_ENV'] ||= 'production' 
#ENV['RAILS_ENV'] = 'development'


# Set GEM_PATH and GEM_HOME ("user" is your dreamhost user)
ENV['GEM_HOME'] ||= '/home/<MY_HOMEDIR>/.rvm/gems/ruby-1.9.3-p0@awesome'
ENV['GEM_PATH'] ||= '/home/<MY_HOMEDIR>/.rvm/gems/ruby-1.9.3-p0@awesome:/home/<MY_HOMEDIR>/.rvm/gems/ruby-1.9.3-p0@global'
require 'rubygems'
Gem.clear_paths

require File.join(File.dirname(__FILE__), '../config/environment')

class Rack::PathInfoRewriter
 def initialize(app)
   @app = app
 end

 def call(env)
   env.delete('SCRIPT_NAME')
   parts = env['REQUEST_URI'].split('?')
   env['PATH_INFO'] = parts[0]
   env['QUERY_STRING'] = parts[1].to_s
   @app.call(env)
 end
end

Rack::Handler::FastCGI.run  Rack::PathInfoRewriter.new(Imjustsayin::Application)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top