Tuesday, December 26, 2006

Install a RubyOnRails app on a Site5 account

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

2) 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)

3) Now let's create symbolic link,
ln -s /home/{username}/apps/site/curent/public public_html

4) We have to declare the symlinks by creating the .htaccess file:
vi public_html/.htaccess

and following lines of code,

Options +FollowSymLinks +ExecCGI
RewriteEngine On


5) Next step is to modify the permissions (make the files executable)
Code:
chmod -R 755 your_app/*

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

Restarting dispatch.fcgi,
pkill -9 -u thezixo -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.

7) 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.
rm your_app/public/index.html
then,
vi your_app/config/routes.rb
then,
map.connect '', :controller => 'your_controller', :action => 'action_to_be_seen_as_index'

8) Finally, edit the environment.rb file to put the app into production mode:
vi your_app/config/environment.rb
then 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/

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home