Go Back   HostGator Peer Support Forums > HostGator Announcements > General Announcements

Notices

Reply
 
Thread Tools
  #151  
Old 09-24-2008, 07:24 PM
afaikIwin afaikIwin is offline
Banned User
 
Join Date: Sep 2008
Posts: 9
Default Re: Ruby on Rails Support

Thread has helped me out, tons.
Thanks OP.
Saved me a lot of headaches.
Reply With Quote
  #152  
Old 10-20-2008, 05:01 PM
deggertsen's Avatar
deggertsen deggertsen is offline
Hatchling Croc
 
Join Date: Aug 2008
Posts: 5
Default Re: Ruby on Rails Support

Okay, for all of you out there who may be ROR beginners like I am I will take you through the process of how I finally got my application to start working on a HG shared server.

If you're reading this you probably already solved the first problem I ran into which was installation... The guide at the beginning of this forum post solved everything there except for the .htaccess file (described in step 5) which didn't exist. So under "demoapp/public/" you need to create a .htaccess file with the following info:

Code:
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
# 
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
# 
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
# 
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
Once you've got the .htaccess in you should see the Welcome page at "yourdomain.com/rails/".

However, if you start trying to access controllers etc.. They wont work, or at least they didn't for me. Well, this was because my app was still set up for sqllite3 so you need to create a mysql database and follow the instructions given by DarkGamer:

Quote:
the mySQL database naming convention for shared servers is: username_databasename; this appears to be so as not to conflict with other users' database names. When I tried adding databases in cpanel with more than one underscore it would not allow me... for example, when I tried adding a database for application rails_app (by default, rails_app_development) when logged in as user, the database created becomes named user_railsappdevelopment, stripping all additional underscores.

This conflicts with the default RoR database naming conventions (_development, _test & _production). My advice for avoiding this snag is to not use underscores in your application name. Also, be sure you have the user name followed by an underscore at the beginning of the database names defined in config/database.ym (but no additional underscores!)... example:
And modify your database.yml file (located at "demoapp/config/") to read something like this with your personal MySQL database info inserted:

Code:
development:
  adapter: mysql
  database: name_name
  username: username_username
  password: ######
  socket: /tmp/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: name_name
  username: username_username
  password: ######
  socket: /tmp/mysql.sock

production:
  adapter: mysql
  database: name_name
  username: username_username
  password: ######
  socket: /tmp/mysql.sock
Once you've got that in everything should work fine... Unless of course your situation isn't exactly like mine which it probably wont be. But hey, I hope this helps somebody out there.

to all the previous forum posters who I basically took all this information from.
Reply With Quote
  #153  
Old 10-24-2008, 05:31 AM
vvlist vvlist is offline
Hatchling Croc
 
Join Date: Sep 2008
Posts: 3
Default Re: Ruby on Rails Support

I just noticed that my shared account has rails 2.1.2 installed... How about everyone else?
Reply With Quote
  #154  
Old 10-24-2008, 09:06 AM
Ayyash Ayyash is offline
Hatchling Croc
 
Join Date: Oct 2008
Posts: 7
Smile Re: Ruby on Rails Support

Hello deggertsen,

I need your help starting my demoapp, I followed everything from the beginning also I created .htaccess as you explained but I still receive page not found 404 error.

I access the app. using the ip address: http://74.52.117.210/rails/

I want to build my first facebook app. and want to make sure everything work fine on gator servers. Also, if you have any more help please tell me about to build my facebook app.


Regards,,
Reply With Quote
  #155  
Old 10-24-2008, 10:04 AM
deggertsen's Avatar
deggertsen deggertsen is offline
Hatchling Croc
 
Join Date: Aug 2008
Posts: 5
Default Re: Ruby on Rails Support

Ayyash,

My guess is that you're not putting in the correct path... If you are on a shared server with HG then, from my understanding, you will need to have something like "http://yourserverip/~username/rails/". I could be wrong and if so I would simply contact HG support for them to help you on that. I'm guessing that it doesn't have anything to do with how you setup Rails.

Good luck.
Reply With Quote
  #156  
Old 10-27-2008, 02:21 PM
Ayyash Ayyash is offline
Hatchling Croc
 
Join Date: Oct 2008
Posts: 7
Default Re: Ruby on Rails Support

Hello deggertsen,

At last I managed to run and view my demoapp, I built another demo app called mycity with the same steps but now when I enter my new app address as follow: http://www.ayyash.info/mycity/ the site forward to http://ayyash.info/rails/

could you help?
Reply With Quote
  #157  
Old 10-27-2008, 02:47 PM
deggertsen's Avatar
deggertsen deggertsen is offline
Hatchling Croc
 
Join Date: Aug 2008
Posts: 5
Default Re: Ruby on Rails Support

Have you checked to make sure that you don't have a forwarder on the mycity link? When you put in "ln -s ../demoapp/public rails" I assume that you changed "demoapp" with "mycity" and "rails" with "mycity". So I would go ahead and delete the "mycity" directory that you created under "public_html" and run that command again.
Code:
ln -s ../mycity/public mycity
Any Linux experts out there that have a better answer?
Reply With Quote
  #158  
Old 10-27-2008, 03:05 PM
Ayyash Ayyash is offline
Hatchling Croc
 
Join Date: Oct 2008
Posts: 7
Default Re: Ruby on Rails Support

hello,

I did that but it still forward me to http://ayyash.info/rails/
Reply With Quote
  #159  
Old 10-27-2008, 03:15 PM
deggertsen's Avatar
deggertsen deggertsen is offline
Hatchling Croc
 
Join Date: Aug 2008
Posts: 5
Default Re: Ruby on Rails Support

Beats me... Submit a support ticket to HG and let me know what they tell you.
Reply With Quote
  #160  
Old 10-28-2008, 11:42 AM
Ayyash Ayyash is offline
Hatchling Croc
 
Join Date: Oct 2008
Posts: 7
Default Re: Ruby on Rails Support

Hello,

This from HG support:

The reason this is occurring is because you have rewrite rules setup to match any request URI that isn't /rails to forward to /rails as described by your .htaccess :

[root@gator565 /home/bashar/public_html]# cat .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/rails
RewriteCond %{HTTP_HOST} ^(www\.)?ayyash.info [nc]
RewriteRule ^(.*)$ http://ayyash.info/rails/ [r=301,nc]
Reply With Quote
  #161  
Old 10-28-2008, 09:46 PM
deggertsen's Avatar
deggertsen deggertsen is offline
Hatchling Croc
 
Join Date: Aug 2008
Posts: 5
Default Re: Ruby on Rails Support

That makes a lot of sense... Should have thought of it before. Did you get the changes complete that you needed to get it to work?
Reply With Quote
  #162  
Old 10-29-2008, 01:32 AM
Ayyash Ayyash is offline
Hatchling Croc
 
Join Date: Oct 2008
Posts: 7
Default Re: Ruby on Rails Support

Yes bro. everything worked fine with me, thanx or your help
Reply With Quote
  #163  
Old 11-23-2008, 09:15 AM
djlandreneau djlandreneau is offline
Hatchling Croc
 
Join Date: Nov 2008
Posts: 1
Default Re: Ruby on Rails Support

Ok, this is very frustrating. The main reason I signed up for HG was because of Rails support. After working on this for a day and a half I still can't get the simple app that works fine on my local system to run on HG.

I believe this is a routing / configuration issue with the web server. I have tried to follow the instructions listed in the forum with no success. Any help would be appreciated.

http://dencity.biz/contact is the base app link and the only action I have is list which is http://dencity.biz/contact/list

DJ
Reply With Quote
  #164  
Old 11-23-2008, 09:38 AM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,040
Default Re: Ruby on Rails Support

Quote:
Originally Posted by djlandreneau View Post
After working on this for a day and a half I still can't get the simple app that works fine on my local system to run on HG.
You haven't told us what the problem is. Saying that something isn't working doesn't give anybody a clue what you have done, are trying to achieve or if for example there is error.
__________________
- David
Reply With Quote
  #165  
Old 12-06-2008, 05:05 PM
jimishjoban jimishjoban is offline
Hatchling Croc
 
Join Date: Nov 2008
Posts: 1
Default Re: Ruby on Rails Support

Hello,

My first attempt to get rails website running on my shared server. Pretty impressed to see rails (version 2.2.2) and ruby (1.8.7) already installed.

Quote:
jjoban2@tibindia.com [~/demoapp]# ruby script/generate controller test
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.

jjoban2@tibindia.com [~/demoapp]# gem update --system
Updating RubyGems
Nothing to update

jjoban2@tibindia.com [~/rubygems-1.3.1]# gem -v
1.2.0
I got a copy of rubygems 1.3.1 using wget. But I need sudo access to install it. Any solutions?

Will soon send a ticket but thought of checking it on the forum too.

Thanks
Reply With Quote
  #166  
Old 12-10-2008, 09:25 PM
ginad ginad is offline
Hatchling Croc
 
Join Date: Dec 2008
Posts: 1
Default Re: Ruby on Rails Support

Good day,
How can i use rake db:migrate and rake db:create? Because every run the command i always get /usr/bin/rake:17: undefined method `require_gem' for main:Object (NoMethodError)

Ginad
Reply With Quote
  #167  
Old 01-17-2009, 07:51 PM
ericindc ericindc is offline
Hatchling Croc
 
Join Date: Jan 2009
Posts: 1
Default Re: Ruby on Rails Support

I was able to get the Rails welcome screen following the various steps mentioned in this thread, but when I upload my application to overwrite the default Rails stuff, I get...

Forbidden

You don't have permission to access /rails/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.aaaaa.org Port 80

I've updated my environment to use production mode, uploaded my routes.rb file, and rand the db migrations after configuring for mySQL. Any suggestions on what's going on?

Also, I think I'm still running in development mode, since the db:migrate populated the database defined for development in my database.yml. I thought changing that line in environment.rb would switch this to production. Is there something else?
Reply With Quote
  #168  
Old 01-22-2009, 04:53 AM
i2it i2it is offline
Hatchling Croc
 
Join Date: Jan 2009
Posts: 1
Default Re: Ruby on Rails Support

I am also getting similar problem, how did you solve it
Quote:
Originally Posted by zzz View Post
Any tips for getting a rails application running on hostgator that was developed locally.

So I have a ruby on rails application on my local computer and want to upload it and host it on hostgator.

I was able to successfully creat a rails application from the jailshell access. But i'm having issues getting a locally developed app running.
I can get it to show the &quot;welcome aboard&quot; page. When I try to navigate to any pages or controller/views I get an error that &quot;the page isnt redirecting properly&quot;

the log/development.log file file shows 302 messages showing the address in my address bar so it is loading as a static html page from what i see.
Reply With Quote
  #169  
Old 02-25-2009, 10:13 PM
3den 3den is offline
Hatchling Croc
 
Join Date: Feb 2009
Posts: 1
Exclamation Re: Ruby on Rails Support

Ive filany made my 1st rails project to work, Ive used cpanel to run app and is working fine by now you can see on www.3den.org

the solution is to create a project and subdomain using cpanel, there you need to create a rewrite to link the rails App to the Subdomain

now the problem is that the public/.htaccess is not created, so it try to use fcgi which is buged, you just need to create it by hand and just write:

# public/.htaccess
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

now your app shall work, hope you find this usefull and admin add sonner as possible suport to fastCGI,

there is a very important gem missing http://gemsonrails.rubyforge.org/ with this we can install gems on aplication scope only. is safe and easy hope admin add this cause it will help a loot
Reply With Quote
  #170  
Old 02-27-2009, 02:58 AM
johny13 johny13 is offline
Hatchling Croc
 
Join Date: Feb 2009
Posts: 4
Default Re: Ruby on Rails Support

I have problem to run the demo application I followed this link
http://forums.hostgator.com/ruby-rai...rt-t13038.html
When I try to browse the site it gives the following error
htttp://domain/rails/
404 Not Found

The server can not find the requested page:

htttp://domain/rails/
Reply With Quote
  #171  
Old 02-27-2009, 08:46 PM
katmann katmann is offline
Hatchling Croc
 
Join Date: Apr 2008
Posts: 2
Default Re: Ruby on Rails Support

Has anyone successfully deployed more than one Rails app to their server? I have one running currently and want to add a second (running under a different domain name) and am not sure how to go about it.
Reply With Quote
  #172  
Old 03-04-2009, 01:44 AM
gsalinas's Avatar
gsalinas gsalinas is offline
Hatchling Croc
 
Join Date: Jan 2009
Posts: 1
Default Re: Ruby on Rails Support

I don't have access to my database , can some one help with this issue..
Reply With Quote
  #173  
Old 03-11-2009, 04:24 AM
johny13 johny13 is offline
Hatchling Croc
 
Join Date: Feb 2009
Posts: 4
Default Re: Ruby on Rails Support

please post a latest guide on how to deploy RoR application locally develop and deploy on the hostgator server
Reply With Quote
  #174  
Old 05-25-2009, 09:11 PM
jllamoca jllamoca is offline
Hatchling Croc
 
Join Date: May 2009
Posts: 1
Talking Ruby on Rails: Deploy application developed locally

For the better understanding we will assume the following:
1) My hostgator user name its "white"
2) I want to create an application called "demoapp"
3) I will organize all my ruby projects inside this directorie /home/white/rubys/, remember that white is my user name
4)Comentaries in the commands will be after # symbol

================================================

I have problems to deploy my locally developed application. Then with the help of hostgator support i finally have my application runing. (Sorry, my english it's very bad but i want to help).

So first of all it's better to create the application from scratch using a ssh cliente(for this you can use putty).

After connect to the server using putty, you will be situated at /home/white/, then you have to run this commands:

mkdir rubys #This is the directory that will contain my ruby on rails applications
cd rubys #This located you inside rubys directorie
rails demoapp -d mysql #This create the demoapp application

Then locate inside the directorie created for the application:

cd demoapp

Then of that you must create your databse using the CPANEL(not use rake db:create or similars), then create the user. Then and associate the user with the databse created with all the privilegies, do all this things with the CPANEL, it's intuitive.

Then as you will see the user created will be {hostgatorUser}_name. So if your hostgator user is "white" and you create a mysql user called "monkey" the user created will be white_monkey. The same happens with the database, so if you created a databse called "db" the database created will be white_db.

So knowing this you must configure your database.yml. This file it's located at /home/white/demoapp/config/ . Put the correct user and password for development environment.

So if you want to create the database using "rake db:create" it wont work because to create the database you need a user and the user was created just a few minutes ago and that user have all the privileges over the data base created above but doesn't have privileges to create a db so rake db:create or similars doesn't work.

Then using "gFTP" you can pass your controllers, views and models. Be carefully at the moment of pass the controllers and views. Pass only that you create, don't pass another file created automatically at the moment of create the application.Read this considerations:

1)Controllers: Inside the controlles directorie it's automatically created an application_controller.rb with the version of rails that i use, but with the version of hostgator the file name is application.rb. So you must pass only controller that you create, because when you run the command "rails demoapp" you don't need to pass application_controller.rb or application.rb files that was created automatically and with the correct configuration.

2) With the models ther are not problems i think you cauld pass the complete folder without problems.

3) With views you must only pass that directories(or folders) associated to any controllers don't overwrite the layouts for example.

4) Inside demoapp/db: Pass the migrate folder located at appname/db. Just pass that folder don't pass the schema.rb file. That file it's created automatically when you run rake db:migrate later.

Whit this you probably pass all your sources, it doesn't take much time. So then you must run:

rake db:migrate #This will create your table structures in your database.

We are almost ready. you must run this commands:

cd /home/white/public_html #That its the directorie of your actual site
ln -s ../rubys/demoapp/public demo #With this you create a link to your public folder of your application, so when you enter www.yourdomain/demo you will se the welcome page of rails. But we need to do a pair of steps before to open that url with your browser. (remeber that my application its inside rubys directori, analyze the command)

Create a file called .htaccess in your computer (somewhere), inside it put the text attached in the file text.txt(at the end you can find the link to download).

Then usin gFTP pass .htaccess created before in the public directorie of our demoapp application, the path is /home/white/rubys/demoapp/public remember the assumptions things at the begining of the message.

Then of that we must modified the next file /home/white/rubys/demoapp/config/environment.rb , after this line # ENV['RAILS_ENV'] ||= 'production', about the line 5, put this ENV['RAILS_RELATIVE_URL_ROOT']="/demo", so you have:

# ENV['RAILS_ENV'] ||= 'production'
ENV['RAILS_RELATIVE_URL_ROOT']="/demo"


Remember when we create the link we put demo at the end of the command(ln -s ../rubys/demoapp/public demo), that's the reason why the root must be /demo to match the link.

With this we are ready, you can open the url www.mydomain/demo with your browser and you'll see the welcome page. if you have a controller called test_contoller you can se it with this www.mydomain/demo/test .

################################################## ###########
Something more, i read that the production environment is faster so when you want to pass to the production environment you must create first the database for production and associate it to a user, then configure your database.yml, run
rake db:migrate ENV="production" # This create the structure database on production.

Then remember the line:
# ENV['RAILS_ENV'] ||= 'production'

This line it's inside /home/white/rubys/demoapp/config/environment.rb file, uncomment it so it must be:
ENV['RAILS_ENV'] ||= 'production'

Whit this you are operating in the production environment.

I hope this help you, if you have a problem open a ticket and the hostgator support will help you extremely fast. That's all folks. I'm tired.

Johao R. LLamoca Palomino.
Attached Files
File Type: txt text.txt (1.2 KB, 37 views)

Last edited by jllamoca; 05-25-2009 at 09:16 PM.
Reply With Quote
  #175  
Old 06-18-2009, 03:33 PM
sporkit sporkit is offline
Hatchling Croc
 
Join Date: Jun 2009
Posts: 10
Default Re: Ruby on Rails Support

Great work jllamoca. Helped me out for sure.

Alternatively, if you don't like /demo on www.domain.com/demo you could delete public_html (back it up!) then from /home/username/ run

Code:
ln -s rubys/demoapp/public_html public_html
No need to edit config/environments.rb in this case.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 04:08 AM.