firstruby

Master ruby with us

E. Install a RubyOnRails app on a Site5 account

1) Using FTP, upload application.

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

3) Create symbolic link,

ln -s /home/username/apps/arithmetic/public public_html/math

ln -s /home/username/path_to_your_app/public public_html/your_app_name
4) We have to declare the symlinks by creating the .htaccess file:

vi public_html/.htaccess

vi public_html/.htaccess

Add these lines:

Options +FollowSymLinks +ExecCGI
RewriteEngine On

5) Next step is to modify the permissions (make the files executable),

chmod -R 755 /home/username/apps/arithmetic/*

chmod -R 755 your_app/*

6) Edit your .htaccess file in the /public/ directory with the last Rewrite rule pointing to dispatch.fcgi
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

7) Edit your public/dispatch.fcgi file and replace the first line like this:
replace #!/usr/bin/ruby18 with #!/usr/bin/ruby

8) Restart your FCGI Processes at the shell prompt,

pkill -9 -u username -f dispatch.fcgi

pkill -9 -u username -f dispatch.fcgi

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 .

9) 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 rename the index.html to index.html.hid in the public dir unless you want to use it. OR you can delete index.html

rm apps/arithmetic/public/index.html (rm your_app/public/index.html)

Then,

vi apps/arithmetic/config/routes.rb (vi your_app/config/routes.rb)

On top of all the routes, add:

map.connect ”, :controller => ‘main’, :action => ‘main’

(map.connect ”, :controller => ‘your_controller’, :action => ‘action_to_be_seen_as_index’)

10) Finally, edit the environment.rb file to put the app into production mode:

vi apps/arithmetic/config/environment.rb

(vi your_app/config/environment.rb)

add the following line before the RAILS_ENV declaration, like this:

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/
I’m ready to hear comments, suggestions or troubles !

Advertisements

One Response to “E. Install a RubyOnRails app on a Site5 account”

  1. Scott said

    Great tutorial. Yours is the most up to date and recent I have found. I was having serious problems getting this going. The issue for me seems to have been the very last step: RAILS_ENV = ENV(‘RAILS_ENV’)

    thank you, thank you, thank you. I am finally up and running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: