Deploying my rails app to GoDaddy

So I’ve written my first real-world RoR app and I’m now getting ready
to deploy it. Unfortunately, my client decided to use GoDaddy as the
hosting provider and based on what I’ve seen so far from the web, it’s
not really the smoothest or ideal hosting for RoR apps. There were
several posts here that I tried to follow but they were kinda old
(2008, 2007). Most of them are talking about the dispatch.fcgi being
in the public folder. Well I tried searching my app for those and I
found them in the ‘vendor\rails\railties\dispatches’ folder instead.

I am hoping you folks have recently experienced deploying an app to
GoDaddy. I followed the instructions and have already attempted it 3
times and I still could not get my app to show. I kept getting ‘Page
Not Found’. I’m not sure with what’s supposed to be in my .htaccess
file for ruby app.

Here’s what I have right now for .htaccess.

RewriteEngine On
RewriteRule !/public/dispatch.fcgi [QSA,L]

+++++++++++++++++++++++++++++++

Here’s dispatch.fcgi :

#!/usr/local/bin/ruby

RewriteBase /access
RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

require File.dirname(FILE) + “/…/config/environment”
require ‘fcgi_handler’

RailsFCGIHandler.process!

+++++++++++++++++++++++++++++++
Here’s what my environment.rb looks like:

Be sure to restart your server when you modify this file

Specifies gem version of Rails to use when vendor/rails is not

present
#RAILS_GEM_VERSION = ‘2.3.5’ unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ‘1.1.6’ unless defined? RAILS_GEM_VERSION
ENV[‘GEM_HOME’] = ‘/usr/local/lib/ruby/gems-dev/1.8’

Bootstrap the Rails environment, frameworks, and default

configuration
require File.join(File.dirname(FILE), ‘boot’)

Rails::Initializer.run do |config|

config.time_zone = ‘UTC’

end
+++++++++++++++++++++++++++++++++

I’m not sure what else I’m missing. I used the GoDaddy CGI Admin to
create the rails directory where I uploaded my project. This also
generated the .htaccess file.

I’d appreciate all the help and advice I can get. Thanks.

Butterson wrote:

So I’ve written my first real-world RoR app and I’m now getting ready
to deploy it. Unfortunately, my client decided to use GoDaddy as the
hosting provider and based on what I’ve seen so far from the web, it’s
not really the smoothest or ideal hosting for RoR apps. There were
several posts here that I tried to follow but they were kinda old
(2008, 2007). Most of them are talking about the dispatch.fcgi being
in the public folder. Well I tried searching my app for those and I
found them in the 'vendor\rails\railties\dispatches' folder instead.

I am hoping you folks have recently experienced deploying an app to
GoDaddy. I followed the instructions and have already attempted it 3
times and I still could not get my app to show. I kept getting ‘Page
Not Found’. I’m not sure with what’s supposed to be in my .htaccess
file for ruby app.

Here’s what I have right now for .htaccess.

RewriteEngine On
RewriteRule !/public/dispatch.fcgi [QSA,L]

+++++++++++++++++++++++++++++++

Here’s dispatch.fcgi :

#!/usr/local/bin/ruby

RewriteBase /access
RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

require File.dirname(FILE) + “/…/config/environment”
require ‘fcgi_handler’

RailsFCGIHandler.process!

+++++++++++++++++++++++++++++++
Here’s what my environment.rb looks like:

Be sure to restart your server when you modify this file

Specifies gem version of Rails to use when vendor/rails is not

present
#RAILS_GEM_VERSION = ‘2.3.5’ unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ‘1.1.6’ unless defined? RAILS_GEM_VERSION
ENV[‘GEM_HOME’] = ‘/usr/local/lib/ruby/gems-dev/1.8’

Bootstrap the Rails environment, frameworks, and default

configuration
require File.join(File.dirname(FILE), ‘boot’)

Rails::Initializer.run do |config|

config.time_zone = ‘UTC’

end
+++++++++++++++++++++++++++++++++

I’m not sure what else I’m missing. I used the GoDaddy CGI Admin to
create the rails directory where I uploaded my project. This also
generated the .htaccess file.

I’d appreciate all the help and advice I can get. Thanks.

Must admit haven’t tried to deploy to GoDaddy however in the dim &
distant past I used to use site5 which used fcgi too.

Things I remember you need to be wary of:

  • Make sure the shebang is the correct path to ruby as this can differ
    (the #!/usr/local/bin/ruby bit)
  • Make sure your permissions are correct for the dispatch.fcgi &
    dispatch.rb files
  • In your environment.rb file you’ll probably need to add
    ENV[‘RAILS_ENV’] ||= ‘production’ at the top of the file to force your
    app into production mode

Debugging Help (assuming you have ssh access):

  • Try cd’ing to your apps public directory and calling ./dispatch.fcgi
    to see if your page’s html is output or an error message.
  • Try ‘ruby script/console production’ from your app root directory and
    doing a find on one of your models to ensure that your rails app isn’t
    bombing before even getting to the web-side of things.

I’m not 100% sure they are working the same but it would probably be
worth checking out the site5/dreamhost support forums as I think they
used to work a similar way.

Funnily enough just checked; see here - most of this is probably
relevant:

http://forums.site5.com/showthread.php?t=4406

Hope that helps

Cheers
Luke

Oh and one other thing - make sure you freeze your gems!

Cheers
Luke

Butterson wrote:

I’d appreciate all the help and advice I can get. Thanks.

My advice for your future projects would be to discuss deployment issues
with your client a lot earlier in the development cycle. I’d push this
discussion to the first conversation with the client if it were me.

A less that ideal development choice has a strong potential to hurt your
reputation in the long run. Any problems with the deployment environment
is going to reflect negatively on you directly. Most clients will not
differentiate server problems with problems with your application.

Just a little friendly advice. Sorry I can’t help you with your
deployment issues to Godaddy, I just hope this serves as a lesson to get
these issues nailed down with clients early in the negotiations.

Thanks all for the advice. I’ve completely given up on GoDaddy and
signed up for Site5. I agree I should have discussed this earlier on
with my client but since this is the first time I’m developing a Rails
app, it’s still a learning process for me. The client also have signed
up with Godaddy way before we talked about the project. Fortunately,
the client is a friend of mine so I think it will be ok. I’m just
disappointed that GoDaddy, given that they’re one of the big names out
there does not have the capability to support a framework.