Topic: hostmonster

Hi Guys,
Does anyone in here run their rails app on hostmonster? if so how did you get it up and running? i try to follow the instruction on their help section but still i pretty stuck.
can anyone help me out with this?
Thanks

-Michael

-Michael

Re: hostmonster

Hello, I run many rails apps in hostmonster with fastCGI so I can give some instructions.

1) First of all you need to create your new addon domain from cPanel. This will create a folder in the public_html folder which you need to change it, you should link it to your public folder of your rails app. To do this you need ssh access, so you login with ssh and you type:
cd ~/public_html/
rm -r folder_of_your_addon_domain
ln -s $HOME/rails/name_of_your_app/public $HOME/public_html/folder_of_your_addon_domain

Also a tip when your rails app is up and running with fastCGI, if you are in production mode, the changes you made won't happen immediately, you need to restart your app, so to do this you need to login with ssh access and type in killall dispatch.fcgi

2) Second you need the dispatchers. To get them you need to type rails test_app_just_to_get_the_dispatchers -D with ssh as far as I remembered (the dispatchers will be in the public directory of your new test rails app). This will give you 4 files (dispatch.cgi, dispatch.fcgi, dispatch.rb, .htaccess). Copy all of them and paste them into the public folder of your normal rails app. IMPORTANT: Change to 755 the privileges of this file otherwise it won't work! I have forgotten this one many times in the past and I couldn't figured out why my rails app isn't running. I am changing them with my FTP program (filezilla), right click the file and it is the last option (you can do it also with ssh).

3) Third, last and most important step for hostmonster specific, open your config/environment.rb file of your rails app and write on top of all, this one:
ENV['GEM_PATH'] = '/home/the_name_of_your_login_in_ssh/ruby/gems:/usr/lib64/ruby/gems/1.8', I also put this RAILS_ENV = 'production' to run it in production mode and I comment the rails version like this #RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION, for some reason I remember it didn't worked when it was uncomment.

This is how it looks like my .htaccess file:

AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks +ExecCGI
Options +SymLinksIfOwnerMatch +ExecCGI
RewriteEngine On

RewriteCond %{HTTP_HOST} ^your-domain-name.com [NC]
RewriteRule ^(.*)$ http://www.your-domain-name.com/$1 [L,R=301]
This two lines in italic, isn't neccesary, I am adding them for SEO reason (redirecting the non-www domain version to www)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 /500.html
#ErrorDocument 500 "

There are many guides on the internet for fastCGI and how to deploy a rails app, this one is for hostmonster and is working date: 4 April 2010, the last step is important to set the gem folder of your rails app and is hostmonster specific. The other steps are for every fastCGI deploy on shared hosting.

Hope this helped you (and also I hope I didn't forget anything!)

Re: hostmonster

When you create your first rails app, the directories are laid out for you. ... are important – it lets rails applications “find their parts” easily, .... You got it — Ruby needs to be installed to run the various files ...

Re: hostmonster

The FastCGI Extension for Internet Information Services (IIS) 6.0 and 5.1 enables popular application frameworks (such as PHP) to be hosted on the IIS web ...

Re: hostmonster

Thank You!  I was missing the GEM path in environment.rb. 
This marks the end of 12 hours of frustration!  Celebration!!
cheers,
Don