Deploying Ruby on rails on hostgator


#1

I created a Ruby on rails application on my linux.
here the what i did

1.first I log in to my ssh account
2.create an application rails /home/myusername/webregistration
3 cd webregistration
4 cd …/public_html
5 ln –s …/webregistration/public mywebregistration
6.upload my application develop locally using ftp.I overwite all except
for the public folder.

7.upload the .htaccess on public folder
on my .htaccess
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
on my routes.rb
ActionController::Routing::Routes.draw do |map|
map.resources :websites
map.connect ‘mywebregistration/:controller/:action/:id’
map.connect
‘mywebregistration/:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end
on my database.yml
development:
adapter: mysql
database: username_websiteregistration
username: username_johny
password: ********
host: myipaddress
when I browse my page I got an error
http://DNS/mywebregistration/websites/

LoadError in WebsitesController#index
/usr/lib/libmysqlclient.so.16: version `libmysqlclient_16’ not
found (required by
/usr/lib/ruby/site_ruby/1.8/i686-linux/mysql.so) -
/usr/lib/ruby/site_ruby/1.8/i686-linux/mysql.so

full trace
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in
process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in
handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:indispatch_unlocked’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in
dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:insynchronize’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:indispatch_cgi’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in
`dispatch’
dispatch.cgi:10

This error occurred while loading the following files:
mysql

can anyone know how to solve it.


#2

have you tried localhost instead of ipaddress?


#3

I’m also trying to deploy my app at hostgator and I’m facing this error:

undefined method `paginate_by_sql’

I have installed will_paginate both as a gem and plugin and in my local
configuration the app works fine. Any idea?


#4

Dimitris Theodorakis wrote:

have you tried localhost instead of ipaddress?
thank you very much for your reply
yes I try too but I got the same error.maybe if you had made a success
on deploying a RoR application locally develop and deploy on their linux
server please post an instructions on how.


#5

Johny ben wrote:

Dimitris Theodorakis wrote:

have you tried localhost instead of ipaddress?
thank you very much for your reply
yes I try too but I got the same error.maybe if you had made a success
on deploying a RoR application locally develop and deploy on their linux
server please post an instructions on how.
Finally after a weekend I have my rails app up and running.

I use exactly the same version as hostgator for rails, gems etc. So I
did nothing like freezing rails or gem. My problem was the above. I was
always getting an error as rails server didn’t include the path of
/vendor/plugins. So we added this little magic line on my
/config/environment.rb

“config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )” and everything
works fine right now.

no .htaccesses added!


#6

wow great.
Can you please elaborate detail by detail from start on how you upload
the application.what is your development environment.how you upload your
application through ftp or ssh.what modification you did.

again thank you very much


#7

Johny ben wrote:

wow great.
Can you please elaborate detail by detail from start on how you upload
the application.what is your development environment.how you upload your
application through ftp or ssh.what modification you did.

again thank you very much

the process was really very simple. I use the same rails and gem
versions so I didn’t have to freeze my project. I created a new RoR
application (cpanel), I uploaded my app and replaced the files from the
app that I had just created (~/etc/rail_apps/sample_app/). Then I
created a symbolic link from the cpanel, I added the line from the above
comment to my config/environment.rb and just everything works