Site5  /  Backstage  /  Wiki  /  Site5 Support  /  Blog  /  Uptime Reports  /  Server Status Page
 

Go Back   Site5 Web Hosting Forums > Community Forums > Scripts and Programming > Ruby

Ruby Discussion of Ruby and all related code, and its usage and development, both on Site5 servers and elsewhere

Closed Thread
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old September 2nd, 2005, 02:24 PM
dom974 dom974 is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Sep 2005
Posts: 32
[HOW TO] Install a RubyOnRails app on a Site5 account

I don't know where to put this guide exactly so I'm starting here

Basically, I am assuming you're developing your RubyOnRails application on your computer first (and you access it with http://127.0.0.1:3000).

Here are the steps to have a decent RoR app running with Site5 (without FastCGI unfortunately, we're still waiting to have it on all the servers).

1/ Open a SSH session and go at the root of your personal directory (place where you can see the directory public_html).

2/ Type
Code:
rails name_of_your_application
You have now declared a new RoR application

3/ Using FTP, upload the following directories:
  • app
  • public
  • config
They should contain all the files created (but upload also the other directories if you have created files in other dir than the ones listed)

4/ Now let's create a symbolic link:
Code:
cd ~
ln -s your_app/public/ public_html/your_app_another_name
Note: It's important to have your application name pointing to a different name, I don't know why but otherwise the system gets crazy having to symlink with similar names
Note(2): The idea is to move away your application files from public users, especially the config files. That's the reason why we're creating the app at the root of the user home directory and creating a link to access only the public dir.

5/ We have to declare the symlinks by creating the .htaccess file:
Code:
vi public_html/.htaccess
Add these lines:
Code:
Options +FollowSymLinks +ExecCGI
RewriteEngine On
6/ Next step is to modify the permissions (make the files executable)
Code:
chmod -R 755  your_app/*
7/ Edit your public/dispatch.cgi file and replace the first line like this:
replace #!/usr/bin/ruby18 with #!/usr/bin/ruby
At this stage you may want to test the installation by visiting the address:
http://www.your_domain.com/your_other_app_name/
or http://www.your_domain.com:3000/your_other_app_name/
You should obtain the congratulations page of the server running perfectly well .

8/ Once you're done testing this, we're gonna create a simple route to display a page as the index page (like an index.html or index.php page)
First delete the index.html in the public dir unless you want to use it
Code:
rm your_app/public/index.html
Then,
Code:
vi your_app/config/routes.rb
On top of all the routes, add:
Code:
map.connect '', :controller => 'your_controller', :action => 'action_to_be_seen_as_index'
9/ Finally, edit the environment.rb file to put the app into production mode:
Code:
vi your_app/config/environment.rb
add the following line before the RAILS_ENV declaration, like this:
Code:
ENV['RAILS_ENV'] = "production"
RAILS_ENV  = ENV['RAILS_ENV']

Now, you should be allright and ready to show your work to the rest of the world !
You will be able to access the index page by typing:
http://www.your_domain.com/your_another_app_name/
Fortunately, you won't experience issues. I may forget some parts or putting some steps that are not exactly in accordance with your system configuration. Please forgive me if I made some mistakes, I'm no "RubyOnRails guru"
I'm ready to hear comments, suggestions or troubles !

Cheers,
Dominique.

Last edited by dom974; September 2nd, 2005 at 05:49 PM.
  #2  
Old September 2nd, 2005, 02:42 PM
Steven Byrd Steven Byrd is offline
Site5 Forum Addict
Error: User posts too much! -- Over 1,000 posts.
 
Join Date: Dec 2004
Location: Site5 Forums
Posts: 15,721
Dominique, great info. Thanks! I've stuck this thread and moved it to the Ruby Forum.
__________________
-Steven
Site5 Forum Overseer
Want the answers to the universe and everything? Check out the Site5 Wiki!
"To err is human, to forgive divine."
  #3  
Old September 2nd, 2005, 02:49 PM
dom974 dom974 is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Sep 2005
Posts: 32
My pleasure Steven ! Thanks moving the thread, I didn't notice the ruby forum at first
  #4  
Old September 7th, 2005, 11:22 PM
KelliShaver's Avatar
KelliShaver KelliShaver is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Mar 2005
Location: Morehead, KY
Posts: 77
Send a message via MSN to KelliShaver Send a message via Yahoo to KelliShaver
Edit: Nevermind... *sigh* the problem occured because I was trying to create a symlink to a directory that already existed. Like I said, stupid user error... maybe my mistake will help someone else, though.

Thanks for posting this. I'm having a problem, though. I'm sure it's stupid user error on my part. I can't get my symlink to work.

I've set up the rails app directory as "AddressBook" inside my home directory, and I'm trying to point it to public_html/dev using the following:

Code:
ln -s AddressBook/public/ public_html/dev
I've added the necessary lines to my .htaccess file, and I've set the proper file permissions on AddressBook/*

As you can see, though.... It's not working:
http://www.kellishaver.com/dev/

Any ideas?

Last edited by KelliShaver; September 7th, 2005 at 11:50 PM.
  #5  
Old September 8th, 2005, 03:45 AM
Heikki Heikki is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Mar 2005
Location: Finland
Posts: 34
I got my symlink working after I used full paths from root.

Now I have other problem:
Pages display fine except none of the images show up. The images are in public/images -folder. Any idea what might cause this?

-- edit
Well.. I figured it out. The images paths are now wrong.
/images/logo.jpg should be /(symlink name)/images/logo.jpg

Isn't there easier way to deal with this than to rewrite all the image paths?

-- edit #2

Ok. I solved that too by following the instructions here:
http://wiki.rubyonrails.com/rails/sh...InstallOnSite5

So I renamed public_html to public_html_back and created a symlink public_html.

Last edited by Heikki; September 8th, 2005 at 04:17 AM.
  #6  
Old November 3rd, 2005, 06:02 PM
alfa's Avatar
alfa alfa is offline
there is no spoon.
More than 500 posts ... And the attitude to go with it!
 
Join Date: Jun 2005
Posts: 530
I have never coded in my entire life. What is this about? How do I get ssh? O.o
__________________
www.site5.com
  #7  
Old November 3rd, 2005, 06:23 PM
David Felstead David Felstead is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Aug 2005
Location: Melbourne, Australia
Posts: 93
Quote:
Originally Posted by alfa View Post
I have never coded in my entire life. What is this about? How do I get ssh? O.o
Hi alfa - if you're on Mac OS X or Linux, ssh will already be installed as a command line utility - simply type: 'ssh yourusername@yourbox.site5.com' at the command line to use SSH (substituting 'yourusername' and 'yourbox' appropriately ). For windows, PuTTY is a great SSH client.
__________________
David Felstead
  #8  
Old November 3rd, 2005, 06:46 PM
alfa's Avatar
alfa alfa is offline
there is no spoon.
More than 500 posts ... And the attitude to go with it!
 
Join Date: Jun 2005
Posts: 530
Quote:
Originally Posted by David Felstead
Hi alfa - if you're on Mac OS X or Linux, ssh will already be installed as a command line utility - simply type: 'ssh yourusername@yourbox.site5.com' at the command line to use SSH (substituting 'yourusername' and 'yourbox' appropriately ). For windows, PuTTY is a great SSH client.
hey thanks! what is your box, btw? :P
__________________
www.site5.com
  #9  
Old November 3rd, 2005, 06:52 PM
David Felstead David Felstead is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Aug 2005
Location: Melbourne, Australia
Posts: 93
Quote:
Originally Posted by alfa View Post
hey thanks! what is your box, btw? :P
That's the name of the site5 server your site is hosted on - stacia, hypnos, leto, etc... You should be able to ssh to username@yourdomain.com as well - you'll see the name of the box in the welcome message there.

Hope that helps!
__________________
David Felstead
  #10  
Old November 15th, 2005, 02:15 PM
bbebop bbebop is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Feb 2005
Posts: 4
taking the first steps to install an RoR app on site5. after entering "rails appname" at the command line, i'm getting the following error message:

Quote:
/usr/bin/ruby: error while loading shared libraries: libruby.so.1.8: cannot open shared object file: No such file or directory
any suggestions? thanks.
  #11  
Old November 15th, 2005, 03:06 PM
Steven Byrd Steven Byrd is offline
Site5 Forum Addict
Error: User posts too much! -- Over 1,000 posts.
 
Join Date: Dec 2004
Location: Site5 Forums
Posts: 15,721
I believe you'll have to contact Customer Service to get that fixed as that lib doesn't seem to be installed.
__________________
-Steven
Site5 Forum Overseer
Want the answers to the universe and everything? Check out the Site5 Wiki!
"To err is human, to forgive divine."
  #12  
Old November 18th, 2005, 08:25 PM
orangekay orangekay is offline
Teenagers Suck
More than 250 posts ... Where's the next thread?
 
Join Date: Aug 2005
Posts: 353
A lot of people seem to be having problems installing Rails apps via the symlink method since they stripped down environment.rb and created the Initializer class in version 0.14.whatever. If you KNOW for a fact that you've done everything else right and are still getting "Premature end of script headers" errors in your logs and generic 500 error pages when you try to load your app, an additional step is necessary when you lack the administrative access necessary to add the relevant Alias directive to your httpd.conf file. I have not seen this documented anywhere, but a quick skim of the code in initializer.rb shows what the problem is.

boot.rb determines the root directory of the application with one line of code:

Code:
root_path = File.join(File.dirname(__FILE__), '..')
This translates into "Move up one directory from the directory boot.rb is in", and when that directory is a symlink, it's going to go back up to the document root holding said symlink rather than the Rails root holding the symlinked "public" directory that actually contains all the relevant files. Luckily, they have wrapped this code up in a conditional so it won't run if RAILS_ROOT is defined before it runs. All you need to do is define RAILS_ROOT at the top of your environment.rb file, setting it to the absolute path to your application's directory (NOT the public directory, the application's root directory that you created the first time you ran the rails command) i.e.

Code:
RAILS_ROOT = '/home/mydomaincom/myrailsapp/'
Good place to stick that is right after the
Code:
ENV['RAILS_ENV'] = 'production'
line. Worked for me.

EDIT: Or you can alternatively pass true to Pathname#cleanpath on line 5 of boot.rb so it reads

Code:
root_path = Pathname.new(root_path).cleanpath(true).to_s

Last edited by orangekay; November 20th, 2005 at 09:19 AM.
  #13  
Old November 20th, 2005, 03:20 AM
bbebop bbebop is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Feb 2005
Posts: 4
Has anyone successfully installed Instiki on Site5? A brief tutorial would be very, very helpful. Thanks!

Last edited by bbebop; November 21st, 2005 at 08:04 PM.
  #14  
Old December 10th, 2005, 03:48 PM
dbtanner dbtanner is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Dec 2005
Posts: 6
Exclamation

To clarify the symbolic link problem, here's what instruction line #4 should say:
cd ~
ln -s /home/your_username/your_app/public/ public_html/your_app_another_name

Otherwise the sym link doesn't have enough information.
  #15  
Old December 15th, 2005, 02:34 AM
Lancer Lancer is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Jul 2005
Posts: 29
Does anyone know how to set this up with Subversion? I want to be able to make the repository in a directory like /home/user_name/svn and have it symlink to /home/user_name/public_html/svn .
  #16  
Old December 15th, 2005, 02:42 AM
Steven Byrd Steven Byrd is offline
Site5 Forum Addict
Error: User posts too much! -- Over 1,000 posts.
 
Join Date: Dec 2004
Location: Site5 Forums
Posts: 15,721
Quote:
Originally Posted by Lancer View Post
Does anyone know how to set this up with Subversion? I want to be able to make the repository in a directory like /home/user_name/svn and have it symlink to /home/user_name/public_html/svn .
Wouldn't a
ln -s ~/public_html/svn ~/svn
do?
__________________
-Steven
Site5 Forum Overseer
Want the answers to the universe and everything? Check out the Site5 Wiki!
"To err is human, to forgive divine."
  #17  
Old December 15th, 2005, 03:00 AM
Lancer Lancer is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Jul 2005
Posts: 29
Nope, and anyway that defeats the purpose of symlinking.. that would expose parts of the repository I don't want to expose. Even if it did work, it would not be a practical solution.

I'm actually have a pending support ticket about this with the reseller staff, we've been back and forth about the issue but can't come up with a solution.. This would be a BIG thing if we could get it working.. even bigger if it's possible with my resold accounts.
  #18  
Old December 15th, 2005, 04:21 PM
Lancer Lancer is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Jul 2005
Posts: 29
Exclamation

I've decided not to use subversion o well...

In other news, Line #4 should be modified in the post so that when people are actually following the directions, they don't have to scroll down the post to find out why the symlink didn't work.
__________________
Ann Arbor Website Design
  #19  
Old December 15th, 2005, 04:38 PM
Lancer Lancer is offline
New Site5 Forum Member
Error: User doesn't post enough! ... less than 30 posts
 
Join Date: Jul 2005
Posts: 29
Well, everything worked fine until I followed the steps after #7. Now I get the notorious

Application error
Rails application failed to start properly"

error

http://www.desire2design.com/ca/
__________________
Ann Arbor Website Design
  #20  
Old December 16th, 2005, 11:59 AM
chenggao chenggao is offline
Site5 Forum Regular
Between 30 and 100 posts... been around the block a few times.
 
Join Date: Dec 2005
Posts: 34
While installing Mailr, I followed this post, and I found that
1 symlink is ok, and need no absolute dir, just
ln -s ~/railsapp/public public_html/railsapp
is ok.
2 if rails app need be accessed as http://site.com/railsapp/, add
RAILS_ROOT = '/home/mydomaincom/myrailsapp/'
to environment.rb works.
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
automated remote backup of my PC's to my site5 account? gregconquest Old Discussions 2 April 1st, 2005 09:55 PM


All times are GMT -4. The time now is 10:28 PM.

Feeds:   RSS  |   RSS2  |   XML
Forum home
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
  
Copyright © 2009 Site5 LLC