返回列表

Step by step deploy a Ruby application on GoDaddy

默认分类 2011-02-09 20:18:13

When I install a Ruby on Rails application on Godaddy which use 4GH. There is always show an error:


Application error
Rails application failed to start properly
the error message is different with the localhost :

Unknown action
No action responded to there

When I searched internet about this error, and found that some other people got the same problem, http://www.ruby-forum.com/topic/257202
After read a lot of pages I found an very good article which Posted on 4th Aug 2010 by hamaky <<how-to-host-a-ruby-application-on-godaddy>>,
I do step by step but still show error I nearly like Lord.Quackstar banging my head against a wall.
With more patience, try again and again, finally there show "Hello world". I hope my experience can help some one who plan to deploy Rails on Godaddy.

Enviorment:
RadRails.org v0.7.1
Instant Rails 1.0 final
FileZilla_3.3.4.1
Godaddy Rails version 1.1.6

1.Use RadRails create a Rails Project


2.Make an app controller : hi_controller.rb,content like this:

class HiController < ApplicationController
    def there
        render_text "Rails version " + Rails::VERSION::STRING + " [ render_text Rails::VERSION::STRING ]"
    end
end

 

3.Edit public/dispatch.cgi
#!C:/InstantRails/ruby/bin/ruby  =>  #!/usr/local/bin/ruby
 

4.Use ftp upload your app to your godaddy host.
 

5.Update all your file permissions to 755.
 

6.Creat Symbolic link to your app.
 

7.Output "Hello world". Happy the journey with Rails.
 


Below include from http://www.bigbluebrains.com/index.php/2010/08/04/how-to-host-a-ruby-application-on-godaddy/
==================================================

How to host a Ruby application on GoDaddy

Posted on 4th Aug 2010 by hamaky   /   Filed underBlogs   /  1 Comment
First you need to know that officially GoDaddy only supports rails v 1.1.6. That's the version you will find if you execute the command
gem list rails
Currently the latest rails version is v 2.2.3. So, it's no wonder if you are creating a new project you won't think of using such an old version. So if you are stuck with a GoDaddy host, let me tell you that you aren't forced to use this version.
Other rails versions are located in the following path
/usr/local/lib/ruby/gems-dev/1.8/gems
At the date of writing this article version '2.0.5′ is deployed. I will use it to guide you to the setup steps.
1. Navigate to the CGI Admin located in the following
http://your_domain.com/_h_admin_
2.  Select the Ruby Tab
3. In the  "Create Rails App Directory" write the name of you application and click "create"
4. After creating your ruby folder, you will need to create a symbolic link that points to your rails app. folder. In the "Create Rails Symbolic Link" section, click on "Show Rails Application"
Select the app. directory and write the name of the symbolic link then press the "create" button.
5. Now you have create the folder, connect to your host using your favorite ftp client using the following settings
Server: ftp.yourdomain.com
User: your_username
Password: your_password
Port: 21
6. upload your rails app to the rails app. folder you created.
7. Update shebang line with Godaddy's path
Edit public\dispatch.cgi, public\dispatch.fcgi, public\dispatch.rb and Replace first line with
#!/usr/local/bin/ruby
8. Set the rails environment to production. Edit "config\environment.rb" and uncomment the following line
ENV['RAILS_ENV'] ||= 'production'
9. Set the 'GEM_HOME' to the dev Gems repos. to be able to use the latest gem version
Edit "config\environment.rb" and set the 'GEM_HOME' if not set to the following
ENV['GEM_HOME'] = '/usr/local/lib/ruby/gems-dev/1.8′
10. Edit the "public\.htaccess"
RewriteBase /the_symbolink_link_you_created

11. Update Permissions
You need to update the 'dispatch.cgi' and 'dispatch.fcgi' permissions, you can use SSH to do so, following is the steps.
ssh your_username@your_domain.com
your_password
cd htm\symbolic_link\public
chmod 755 dispatch.cgi
chmod 755 dispatch.fcgi
12. Now you should be able to access your rails app using the following URL
http://your_domain.com/symbolic_link
13. If you want to access the rails app directly when entering your domain URL, apply the following
Create a '.htaccess' in the root folder if not created
Edit the file and add the following line
RewriteEngine On
RewriteRule ^(.*)$ http://www.your_domain.com/sybmolic_link/$1 [R,L]
 

One Response to "How to host a Ruby application on GoDaddy"

  1. [...] This post was mentioned on Twitter by Nihed MBAREK, Islam El-Hamaky. Islam El-Hamaky said: RT @DZone "How to host a ruby application on GoDaddy?"http://dzone.com/Grbh [...]