Installing Ruby on Rails Apps on MysticServer

How to put a RubyOnRails app on MysticServer hosting.

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 MysticServer.

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
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:
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:
vi public_html/.htaccess

Add these lines:
Options +FollowSymLinks +ExecCGI
RewriteEngine On


6. Next step is to modify the permissions (make the files executable)
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
rm your_app/public/index.html

Then,
vi your_app/config/routes.rb

On top of all the routes, add:
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:
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/
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.

Back
MysticServer
RubyOnRails

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki