Rails on Dreamhost = 9th Circle of Hell

software development

#1

Does anyone have Ruby on Rails running on a shared Dreamhost box?

Every tutorial and step-by-step I’ve tried does not work, including two in the Dreamhost wiki and the ones from Rails themselves.

The main issue is that the public/ folder just gives me a directory listing. I have Passenger setup for my domain and have deleted the index.html in the public folder. The Web Directory setting in Manage Domains points to /home/myuser/mydomain.com/public, and public is symlinked to /home/myuser/mydomain.com/myrubyapp/public. When I surf to www.mydomain.com, I get a directory listing of /home/myser/myrubyapp/public. Ditto if I surf to www.mydomain.com/myrubyapp/public

I also tried setting the Manage Domains Web Directory setting to /home/myuser/mydomain.com/myrubyapp/public (i.e., eliminating the symlink), and that didn’t change anything. Still got a directory listing.

Again, this shared hosting…about half the Ruby-on-Dreamhost stuff I’ve googled assumes a VPS.

This page:

http://wiki.dreamhost.com/Talk:Passenger

starts with a comment noting that the Passenger instructions don’t work. Great.

I have zero .htaccess files anywhere in that domain.

Looks like others have the same problems:

Following this classic for a ways:

http://guides.rubyonrails.org/getting_started.html

Doesn’t get me any further (i.e., “rails generate controller home index” and modifying config/routes.rb don’t change anything). SQLite vs. MySQL makes no difference.

I won’t even get into how broken the FastCGI tutorial on the wiki is.

Seriously - Rails on Dreamhost…it can’t really be this difficult, can it?

[hr]
BTW, /home/myuser/mydomain.com/myrailsapp/log/production.log is a 0-length, empty file. Actually, all the files everything in log/ is a 0-length, empty file.


#2

I absolutely cannot figure out how to get a rails app working on Dreamhost / Passenger. The app runs fine locally, using all the versioned gems listed on dreamhost’s page but nothing works on Passenger under my DH account. Even a simple app with one controller will not produce anything but an error no matter what I’ve tried. I’ve scoured google for any answer I could find to no avail.

I’m seriously considering leaving DH over this, this is ridiculous.


#3

I haven’t had any problems getting it running on my account. What version of rails are you using? Do you have Passenger enabled in the Web UI?


#4

Here’s what I did to follow the Getting Started tutorial.

I already have Rails installed an an app created using the “rails new APP_PATH” command. My app was in the path transit.adigitalcity.com. To start generating scaffolding, etc (as shown in the tutorial), you must:

In ssh, make sure you change directory, “cd”, to your APP_PATH. In this case, this was transit.adigitalcity.com, the subdomain where the rails app was created.

The first time you enter “rails generate controller home index”, you will get an error:

Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile. Try running `bundle install`.

To fix this, you need to edit the Gemfile located in your root directory (transit.adigitalcity.com/Gemfile). Simply comment out the line “gem ‘mysql2’”. The file should now look like this:

[code]source ‘http://rubygems.org

gem ‘rails’, ‘3.0.3’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

#gem ‘mysql2’

Use unicorn as the web server

gem ‘unicorn’

Deploy with Capistrano

gem ‘capistrano’

To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)

gem ‘ruby-debug’

gem ‘ruby-debug19’

Bundle the extra gems:

gem ‘bj’

gem ‘nokogiri’

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

gem ‘aws-s3’, :require => ‘aws/s3’

Bundle gems for the local environment. Make sure to

put test-only gems in this group so their generators

and rake tasks are available in development mode:

group :development, :test do

gem ‘webrat’

end[/code]

After doing that, I was now able to “rails generate controller home index” with the following result:

rails generate controller home index create app/controllers/home_controller.rb route get "home/index" invoke erb create app/views/home create app/views/home/index.html.erb invoke test_unit create test/functional/home_controller_test.rb invoke helper create app/helpers/home_helper.rb invoke test_unit create test/unit/helpers/home_helper_test.rb

That’s as far as I am at the moment, but I will update if I encounter any more problems.


#5

that did the trick. thanks!