<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Hosting India Blog - SpeedHost&#8482; &#187; Ruby on Rails</title>
	<atom:link href="http://blog.speedhost.in/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.speedhost.in</link>
	<description>Web Hosting India Blog</description>
	<lastBuildDate>Fri, 30 Jul 2010 04:39:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How do i View, Stop and Start my Ruby app via SSH</title>
		<link>http://blog.speedhost.in/how-do-i-view-stop-and-start-my-ruby-app-via-ssh/</link>
		<comments>http://blog.speedhost.in/how-do-i-view-stop-and-start-my-ruby-app-via-ssh/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 13:25:02 +0000</pubDate>
		<dc:creator>Prashant</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.speedhost.in/?p=640</guid>
		<description><![CDATA[To stop a process: You can kill the process using kill -9 To view all processes: You can view all running processes with ps ffaux the second column will be the pid. Once the application has stopped you can start the application by running scripts/server -p in the directory of the RoR project.]]></description>
			<content:encoded><![CDATA[<p><strong>To stop a process</strong>:<br />
You can kill the process using <strong>kill -9
<pid></strong></p>
<p><strong>To view all processes</strong>:<br />
You can view all running processes with <strong>ps ffaux</strong> the second column will be the pid. </p>
<p>Once the application has stopped you can start the application by running <strong>scripts/server -p
<port></strong> in the directory of the RoR project.</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/200812195287/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/200812195287/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '200812195287', 'http%3A%2F%2Fblog.speedhost.in%2Fhow-do-i-view-stop-and-start-my-ruby-app-via-ssh%2F', 'How+do+i+View%2C+Stop+and+Start+my+Ruby+app+via+SSH')" onclick="STTAFFUNC.cw(this, {id:'200812195287', link: 'http%3A%2F%2Fblog.speedhost.in%2Fhow-do-i-view-stop-and-start-my-ruby-app-via-ssh%2F', title: 'How+do+i+View%2C+Stop+and+Start+my+Ruby+app+via+SSH' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.speedhost.in/how-do-i-view-stop-and-start-my-ruby-app-via-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting your LocalHost Ruby app working on the Server</title>
		<link>http://blog.speedhost.in/getting-your-localhost-ruby-app-working-on-the-server/</link>
		<comments>http://blog.speedhost.in/getting-your-localhost-ruby-app-working-on-the-server/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 06:04:36 +0000</pubDate>
		<dc:creator>Prashant</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.speedhost.in/?p=635</guid>
		<description><![CDATA[SSH Access You will have to have to request jailed SSH access on your hosting account by submiting a support ticket. You can then use SSH to execute commands (rake, script/generate etc) like you would locally. To log in to SSH run: ssh -p 2222 username@example.com Creating Application Even though you have created your app [...]]]></description>
			<content:encoded><![CDATA[<p><strong>SSH Access</strong></p>
<p>You will have to have to request jailed SSH access on your hosting account by submiting a support ticket. You can then use SSH to execute commands (rake, script/generate etc) like you would locally.</p>
<p>To log in to SSH run:</p>
<pre class="brush: plain;">
ssh -p 2222 username@example.com
</pre>
<p><strong>Creating Application</strong></p>
<p>Even though you have created your app locally, you want to create a new app in SSH (and let it create the folder hierarchy) and then replace all the controllers/views/models/db/config etc with your app.</p>
<p>To create the new app in SSH:<br />
First navigate to a location where you want to create the new app folder – it doesn&#8217;t matter where, although cpanel likes to put them in ~/etc/rails_apps/.<br />
Run:</p>
<pre class="brush: plain;">
rails -d mysql --with-dispatchers mynewapp
</pre>
<p>You now need to upload your locally created app to the server using FTP or otherwise. Don&#8217;t overwrite the files yet! Create another folder out of the way and upload it there for now. You have to be careful when overwriting the ssh created app that you don&#8217;t accidentally wipe some necessary files. </p>
<p>You can completely overwrite all files and folders <strong>EXCEPT</strong> the public folder. When dealing with the public folder, I suggest you overwrite the individual images, stylesheets and javascripts folders without touching the files already in /public/. </p>
<p><strong>Specifically</strong>: public/dispatch.rb , public/dispatch.cgi and public/dispatch.fcgi must all be present otherwise your app will not function. </p>
<p>Once you&#8217;ve got your locally created app in place go on..</p>
<p>.htaccess</p>
<p>To get the app running properly it is necessary to edit .htaccess.<br />
Navigate to ~/etc/rails_apps/mynewapp/public:</p>
<pre class="brush: plain;">
cd /etc/rails_apps/mynewapp/public
</pre>
<p>To open .htaccess</p>
<pre class="brush: plain;">
pico .htaccess
</pre>
<p>Regardless of whether there&#8217;s already text in the file or its blank, the only necessary code is as follows:</p>
<pre class="brush: plain;">
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI 

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/notrails.*
RewriteRule .* - [L] 

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</pre>
<p>Save the .htaccess file</p>
<p><strong>Database Setup</strong></p>
<p>In cpanel go to MySQL databases and create a new database:<br />
eg. New database: records</p>
<p>Note that cpanel will automatically add username_ to the front of it, thus database name is:<br />
username_records<br />
You also need to create a user for this database:<br />
eg. Username: gkumar<br />
pw: *****<br />
Note that cpanel will also append username_ to the front of each user too, thus database user will be:<br />
username_gkumar</p>
<p>Finally in cpanel Add user to database: username_gkumar to username_records. </p>
<p>You can now use this database, username and password in database.yml</p>
<p><strong>Database.yml</strong></p>
<p><strong>in SSH or filemanager</strong>:</p>
<pre class="brush: plain;">
cd /etc/rails_apps/mynewapp/config/
pico database.yml
</pre>
<p><strong>Setup database.yml for above example</strong>:</p>
<pre class="brush: plain;">
development:
pool: 5
timeout: 5000
adapter: mysql
database: username_records
username: username_gkumar
password: *******
socket: /var/lib/mysql/mysql.sock

# Warning: The database defined as &quot;test&quot; will be erased and
# re-generated from your development database when you run &quot;rake&quot;.
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000

production:
adapter: mysql
username: username_gkumar
password: *******
socket: /var/lib/mysql/mysql.sock
pool: 5
timeout: 5000
reconnect: true
socket: /var/lib/mysql/mysql.sock
</pre>
<p><strong>Note</strong>: Leave test alone (if you setup test like the prod and dev you might accidentally wipe the database if you run a test). Take note of the adapter and socket, they need to be setup for mysql not sqlite.</p>
<p><strong>Symlink</strong></p>
<p>Currently we have the app loaded at /etc/rails_apps/mynewapp. However, pages that are visible on the web need to be in the /public_html/ directory. Because of the way rails separates public from models/views etc, we use a sym link to make the files from /mynewapp/public appear also in /public_html/. It will essentially seem like the one folder (public) has 2 different paths to it.</p>
<p>Do you want the app to be displayed at www.example.com/ or www.example.com/blog/? Do you have addon-domains or is this your only domain?</p>
<p>Case: Display at example.com/ and yes I have addon domains</p>
<p>If we want to display at example.com/ we need to create a symlink to /public_html/. The issue is that you must delete public_html and then recreate it with the symlink. (can&#8217;t symlink to an existing folder) As you probably know, addon domains are stored in /public_html/addondomain.com/. To ensure that you don&#8217;t loose you addon domain data it is necessary to: </p>
<p>1. Copy the addondomain.com folder/s elsewhere<br />
2. Delete public_html<br />
3. Create the symlink (which will recreate /public_html)<br />
4. Copy the addondomain.com folder/s back to their original location</p>
<p>So assuming you&#8217;ve backed up you addon domains and deleted public_html:</p>
<p><strong>In SSH (at /home/username/) execute</strong>:</p>
<pre class="brush: plain;">
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html
</pre>
<p>You will now find that in public_html you have the files and folders (images/stylesheets etc..) that are located in /mynewapp/public. Don&#8217;t forget to copy back you addon domains.</p>
<p>This is the hardest scenario, if you have no addon domains – obviously the same procedure applies without needing to backup anything.</p>
<p>If you want the rails app to display on an addon domain:</p>
<pre class="brush: plain;">
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html/addondomain.com
</pre>
<p>If you want the rails app to display at mydomain.com/blog: (ensure no folder named blog exists)</p>
<pre class="brush: plain;">
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html/blog
</pre>
<p>Also add to mynewapp/config/environment.rb:</p>
<pre class="brush: plain;">
ENV['RAILS_RELATIVE_URL_ROOT']=&quot;/blog&quot;
</pre>
<p><strong>Environment.rb</strong></p>
<p>At the top of the file you can add:</p>
<pre class="brush: plain;">
ENV['RAILS_ENV'] ||= 'production'
</pre>
<p><strong>In the Rails::Initializer.run do |config| block</strong>:</p>
<pre class="brush: plain;">
config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )
</pre>
<p><strong>Gems</strong></p>
<p>You can also have problems if you are using gems in your app that SpeedHost hasn&#8217;t got installed. You can view which gems are installed in cpanel RubyGems and also install gems through cpanel. If there is a gem missing from our server, you can send us an email and we will have it installed on the server.</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/200812195287/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/200812195287/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '200812195287', 'http%3A%2F%2Fblog.speedhost.in%2Fgetting-your-localhost-ruby-app-working-on-the-server%2F', 'Getting+your+LocalHost+Ruby+app+working+on+the+Server')" onclick="STTAFFUNC.cw(this, {id:'200812195287', link: 'http%3A%2F%2Fblog.speedhost.in%2Fgetting-your-localhost-ruby-app-working-on-the-server%2F', title: 'Getting+your+LocalHost+Ruby+app+working+on+the+Server' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.speedhost.in/getting-your-localhost-ruby-app-working-on-the-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do i Install Ruby Gems on my Hosting?</title>
		<link>http://blog.speedhost.in/how-do-i-install-ruby-gems-on-my-hosting/</link>
		<comments>http://blog.speedhost.in/how-do-i-install-ruby-gems-on-my-hosting/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 06:10:18 +0000</pubDate>
		<dc:creator>Prashant</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ruby Gems]]></category>

		<guid isPermaLink="false">http://blog.speedhost.in/?p=627</guid>
		<description><![CDATA[Most Ruby (RoR) Gems are already installed on our servers and can we used by you, however there might be some specialized gems which you may want to install. This can be simply done by the command below. run gem install &#60;gem name&#62; If you have any problem, you can always raise a support ticket [...]]]></description>
			<content:encoded><![CDATA[<p>Most Ruby (RoR) Gems are already installed on our servers and can we used by you, however there might be some specialized gems which you may want to install. This can be simply done by the command below.</p>
<pre class="brush: plain;">
run gem install &lt;gem name&gt;
</pre>
<p>If you have any problem, you can always raise a support ticket and we will have our Ruby admin install the gem for you.</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/200812195287/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/200812195287/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '200812195287', 'http%3A%2F%2Fblog.speedhost.in%2Fhow-do-i-install-ruby-gems-on-my-hosting%2F', 'How+do+i+Install+Ruby+Gems+on+my+Hosting%3F')" onclick="STTAFFUNC.cw(this, {id:'200812195287', link: 'http%3A%2F%2Fblog.speedhost.in%2Fhow-do-i-install-ruby-gems-on-my-hosting%2F', title: 'How+do+i+Install+Ruby+Gems+on+my+Hosting%3F' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.speedhost.in/how-do-i-install-ruby-gems-on-my-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Steps you can Perform to Deploy a Demo Rail Application</title>
		<link>http://blog.speedhost.in/steps-you-can-perform-to-deploy-a-demo-rail-application/</link>
		<comments>http://blog.speedhost.in/steps-you-can-perform-to-deploy-a-demo-rail-application/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 04:15:41 +0000</pubDate>
		<dc:creator>Prashant</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.speedhost.in/?p=618</guid>
		<description><![CDATA[1. Login to your SSH using your own account. 2. Once logged in make sure you are in your /home/username folder using the &#8220;pwd&#8221; command. It should show the output like this: cpaneluser@server [~]# pwd /home/cpaneluser 3. Then run the following commands to generate a demo rail app and its controller. cpaneluser@server [~]# rails /home/cpaneluser/demoapp [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1</strong>. Login to your SSH using your own account.<br />
<strong>2</strong>. Once logged in make sure you are in your /home/username folder using the &#8220;pwd&#8221; command.</p>
<p>It should show the output like this:</p>
<pre class="brush: plain;">
cpaneluser@server [~]# pwd
/home/cpaneluser
</pre>
<p><strong>3</strong>. Then run the following commands to generate a demo rail app and its controller.</p>
<pre class="brush: plain;">
cpaneluser@server [~]# rails /home/cpaneluser/demoapp
cpaneluser@server [~]# cd demoapp
cpaneluser@server [~]# ruby script/generate controller test
</pre>
<p><strong>4</strong>. Now create a symlink in public_html so that the app is viewable via the web.</p>
<pre class="brush: plain;">
cpaneluser@server [~]# cd ../public_html
cpaneluser@server [~]# ln –s ../demoapp/public rails
</pre>
<p><strong>5</strong>. Before you test the Rails page, there is one more modification you need to make.</p>
<pre class="brush: plain;">
cpaneluser@server [~]# cd ../demoapp/public
cpaneluser@server [~]# pico .htaccess
</pre>
<p>Locate the line where it has the code like below:</p>
<pre class="brush: plain;">
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</pre>
<p>Change that code to:</p>
<pre class="brush: plain;">
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
</pre>
<p>You can then visit http://example.com/rails/ and you should see a &#8220;Welcome Aboard&#8221; page which confirms successful working of your rail app. You can deploy any other standard Rail applications as well. Most of them should work well with the <a href="http://blog.speedhost.in/ruby-on-rails-gems-installed-on-our-server/">preinstalled Gems</a> we have. </p>
<script type="text/javascript" src="http://cdn.socialtwist.com/200812195287/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/200812195287/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '200812195287', 'http%3A%2F%2Fblog.speedhost.in%2Fsteps-you-can-perform-to-deploy-a-demo-rail-application%2F', 'Steps+you+can+Perform+to+Deploy+a+Demo+Rail+Application')" onclick="STTAFFUNC.cw(this, {id:'200812195287', link: 'http%3A%2F%2Fblog.speedhost.in%2Fsteps-you-can-perform-to-deploy-a-demo-rail-application%2F', title: 'Steps+you+can+Perform+to+Deploy+a+Demo+Rail+Application' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.speedhost.in/steps-you-can-perform-to-deploy-a-demo-rail-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Gems Installed on our Server</title>
		<link>http://blog.speedhost.in/ruby-on-rails-gems-installed-on-our-server/</link>
		<comments>http://blog.speedhost.in/ruby-on-rails-gems-installed-on-our-server/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 05:12:52 +0000</pubDate>
		<dc:creator>Prashant</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ruby Gems]]></category>

		<guid isPermaLink="false">http://blog.speedhost.in/?p=615</guid>
		<description><![CDATA[The following Gems have been preinstalled with the Ruby installations. Custom gems are avaliable on a per request basis. If you need an additional gem installed, please create a support ticket. Actionmailer Service layer for easy email delivery and testing. Actionpack Web-flow and rendering framework putting the VC in MVC. Actionwebservice Web service support for [...]]]></description>
			<content:encoded><![CDATA[<p>The following Gems have been preinstalled with the Ruby installations. Custom gems are avaliable on a per request basis. If you need an additional gem installed, please create a support ticket. </p>
<p><strong>Actionmailer</strong><br />
Service layer for easy email delivery and testing.</p>
<p><strong>Actionpack</strong><br />
Web-flow and rendering framework putting the VC in MVC.</p>
<p><strong>Actionwebservice</strong><br />
Web service support for Action Pack.</p>
<p><strong>Activerecord</strong><br />
Implements the ActiveRecord pattern for ORM.</p>
<p><strong>Activesupport</strong><br />
Support and utility classes used by the Rails framework.</p>
<p><strong>BlueCloth</strong><br />
BlueCloth is a Ruby implementation of Markdown, a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).</p>
<p><strong>Builder</strong><br />
Builders for MarkUp.</p>
<p><strong>Daemons</strong><br />
A toolkit to create and control daemons in different ways</p>
<p><strong>Feedtools</strong><br />
Parsing, generation, and caching system for xml news feeds.</p>
<p><strong>Gem_plugin</strong><br />
A plugin system based only on rubygems that uses dependencies only</p>
<p><strong>Gnuplot</strong><br />
Utility library to aid in interacting with gnuplot</p>
<p><strong>Htmltools</strong><br />
This is a Ruby library for building trees representing HTML structure.</p>
<p><strong>Mongrel</strong><br />
A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.</p>
<p><strong>MySQL</strong><br />
MySQL/Ruby provides the same functions for Ruby programs that the MySQL C API provides for C programs.</p>
<p><strong>Payment</strong><br />
Payment is used to process credit cards and electronic cash through merchant accounts.</p>
<p><strong>Rails</strong><br />
Web-application framework with template engine, control-flow layer and ORM.</p>
<p><strong>Rake</strong><br />
Ruby based make-like utility.</p>
<p><strong>Sources</strong><br />
This package provides download sources for remote gem installation</p>
<p><strong>Tidy</strong><br />
Ruby interface to HTML Tidy Library Project</p>
<p><strong>Uuidtools</strong><br />
Generation of UUIDs.</p>
<p><strong>Xml-simple</strong><br />
A very simple API for XML processing.</p>
<p>We are offering jailed SSH access on all our servers. You can <a href="http://blog.speedhost.in/how-can-i-order-shell-access-ssh/">get SSH enabled for your account</a> if you want to deploy and test Rails applications rapidly. The procedure to get SSH access is simple. You can order SSH while you are taking hosting from us or later by raising a support ticket from SpeedHost admin area.</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/200812195287/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/200812195287/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '200812195287', 'http%3A%2F%2Fblog.speedhost.in%2Fruby-on-rails-gems-installed-on-our-server%2F', 'Ruby+on+Rails+Gems+Installed+on+our+Server')" onclick="STTAFFUNC.cw(this, {id:'200812195287', link: 'http%3A%2F%2Fblog.speedhost.in%2Fruby-on-rails-gems-installed-on-our-server%2F', title: 'Ruby+on+Rails+Gems+Installed+on+our+Server' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.speedhost.in/ruby-on-rails-gems-installed-on-our-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
