Ruby on Rails
Ruby on Rails
What is the path to Ruby?
How can I create a Ruby on Rails project?
How can I change the DocumentRoot of my site or subdomain?
What are the MySQL connection settings for Ruby?
What's involved in deploying a RoR project on your servers?
What is the path to Ruby?
The system path to Ruby on our servers is /usr/local/bin/ruby. So your Ruby scripts should start with the following line:
#!/usr/local/bin/ruby
[ More Ruby on Rails Topics ] - [ Back to FAQ Topics Index ]
How can I create a Ruby on Rails project?
If you plan to develop your RoR project directly on the server you will need to create the Project itself along with its directory structure.
This is usually done by executing the following command in a SSH environment rails project_name. However as we do not allow SSH access you can use a PHP wrapper script to run shell commands.
For example:
<?php
putenv("HOME=/home/$user");
system("rails project_name 2>&1");
?>
You can replace "project_name" with the name of your RoR project. Upload the script to your website and execute it from a browser. It will create all the necessary folders for your RoR project.
Using the above technique you can run other RoR related commands, such as script/generate, etc.
[ More Ruby on Rails Topics ] - [ Back to FAQ Topics Index ]
How can I change the DocumentRoot of my site or subdomain?
The DocumentRoot is the physical folder on the server, which content is displayed when a visitor accesses your website (or a subdomain on your site).
You can change the DocumentRoot of your website and/or any of your subdomains at your online Control Panel -> Subdomains section.
Navigate to the Manage Document Roots tab. There you will see a list of your subdomains, including your main site.
Control Panel - Manage DocumentRoot
To change the document root of any subdomain, press the button Change next to it. Then type the path to the new document root or use the Browse(magnifier) button to choose a folder from the server.
Once ready click on the Update button. The change will need a couple of minutes to take effect.
Notice:
- You cannot change the DocumentRoot for a subdomain where you have the MS FrontPage installed.
- Scripts located in your "cgi-bin" folder will always be accessible regardless of the current DocumentRoot.
- The DocumentRoot cannot be changed to an upper level folder. It can only be changed to a subfolder of the default DocumentRoot.
- If you change the DocumentRoot for your main www subdomain, the "/cp" alias for accessing your Control Panel and the "/webmail" alias for accessing your Webmail interface will stop working. You will still be able to reach the Control Panel at the link in your Welcome e-mail message that includes the server name, and you will be able to access the Webmail by placing an "mbox." prefix in front of your domain name.
[ More Ruby on Rails Topics ] - [ Back to FAQ Topics Index ]
What are the MySQL connection settings for Ruby?
When using MySQL4 database your database.yml file should look like:
production:
adapter: mysql
database: [your MySQL4 database name]
username: [your MySQL4 username]
password: [your MySQL4 password]
host: localhost
In case you are using a MySQL5 database, you need to specify a connection socket as well. Here is a sample configuration file:
production:
adapter: mysql
database: [your MySQL5 database name]
username: [your MySQL5 username]
password: [your MySQL5 password]
host: localhost
socket: /tmp/mysql5.sock
[ More Ruby on Rails Topics ] - [ Back to FAQ Topics Index ]
What's involved in deploying a RoR project on your servers?
If you have a Ruby On Rails application already developed on your computer you will have to follow these steps to launch it on the server.
1. Upload your Ruby on Rails files to the server (you can upload them to any web accessible directory)
2. Make sure the executable CGI files have execute permissions (like 775) granted to them. That's usually the dispatch.cgi script in the /public folder of your application.
3. Make sure the path to the Ruby interpreter is correct in your files. All executable files should have the following first line:
#!/usr/local/bin/ruby
4. Edit the configuration files and update them to use the correct database settings on the server. These settings depend on which version of MySQL you would prefer to use, MySQL 4 or MySQL 5. For MySQL 4, the settings can be the default ones; for MySQL 5, you need to specify the socket for the connection. It is "/tmp/mysql5.sock". More details on MySQL4 and MySQL5 connections settings can be found here
5. As RoR applications usually have their working folder called "public" you will need to create a .htaccess file with some mod_rewrite rules which will redirect all requests to the public directory. A sample .htaccess file should look like:
RewriteEngine On
RewriteRule (.*) /path_to_project/public/$1 [L]
Replace path_to_your_project with the path to the directory where your project is located starting from your site webroot.
The .htaccess file should be located in the main folder of your application. (i.e one folder above the "public" directory)
Another option would be to change the document root for your website to the /public folder of your RoR application. Instructions on how to change this can be found here
In case you have further questions or experience some troubles with the process described above, please feel free to contact our Technical support - we will be glad to assist you.
[ More Ruby on Rails Topics ] - [ Back to FAQ Topics Index ]