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