<?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>WebOnRails &#187; deploy</title>
	<atom:link href="http://webonrails.com/category/deploy/feed/" rel="self" type="application/rss+xml" />
	<link>http://webonrails.com</link>
	<description>Its all about Ruby On Rails</description>
	<lastBuildDate>Mon, 05 Jul 2010 16:37:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>11 Things to Consider Before Deploying Your Rails Application</title>
		<link>http://webonrails.com/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/</link>
		<comments>http://webonrails.com/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:51:25 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[vinsol]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://webonrails.com/?p=355</guid>
		<description><![CDATA[Cross Posted from http://vinsol.com/blog At VinSol, we have been developing and deploying Rails applications for more than four years. During this period, we have identified some best practices that we prefer to follow while deploying rails application to production server. Below is the checklist of these practices: &#160; 1. Ensure that NS records and MX]]></description>
			<content:encoded><![CDATA[<p><strong><br />
  Cross Posted from <a href="http://vinsol.com/blog" target = "_blank">http://vinsol.com/blog</a></strong></p>
<p>At VinSol, we have been developing and deploying Rails applications for more than four years. During this period, we  have identified some best practices that we prefer to follow while deploying  rails application to production server.</p>
<p>Below is the checklist of these practices:</p>
<p> &nbsp; </p>
<p><strong>1. </strong><strong>Ensure that NS records and MX records are changed if they need to be changed</strong></p>
<p>Changing nameservers will point the domain to the hosting server,  and changing MX records will redirect incoming mails to the mail server. As a very first step, we should make sure that name servers of the domain are set to be the correct one.  Changing MX record is a must if our application is parsing incoming mails or we wants to use other mail services for e-mail exchange, for example Gmail.</p>
<p> &nbsp; </p>
<p><strong>2. Ensure some backup mechanism in place for both data as well as user uploaded content like images/documents etc.</strong></p>
<p>Since production data is very critical, we must setup backup  mechanism. It could be some type of scheduled task that takes periodic backup of all critical data, Or it could be some type of backup service provided by hosting company. When we talk about critical production data, it includes production DB, content generated by application users like images, documents, etc.</p>
<p> &nbsp; </p>
<p><strong>3. Ensure database indexes</strong></p>
<p>We might have done development without having proper database indexes, but we should avoid going to production without them. Adding indexes might slow down insert queries a bit but it increases the  performance of read queries. It applies when application in production has percentage of read operations much more than write operations.</p>
<p> &nbsp; </p>
<p><strong>4. Enable your slow query log</strong></p>
<p>This is specific to MySQL. Enabling slow query log allows MySQL to log slow running queries to a file. And this log can be used to find queries that take a long time to execute and are therefore candidates for optimization.</p>
<p> &nbsp; </p>
<p><strong>5. Ensure exception capturing is in place</strong></p>
<p>We might want to be notified when something bad happens to our application. There are several hosted services available who receive and track exceptions, for example <a href="http://hoaptoadapp.com" target="_blank">Hoptoadapp.com</a>,<a href="http://getexceptional.com/"> GetExceptional.com</a> etc&#8230;  Either we can choose one from these hosted services or we can use <a href="http://agilewebdevelopment.com/plugins/exception_notifier">“exception notifier”</a> plugin.</p>
<p> &nbsp; </p>
<p><strong>6. Ensure adding entries for cron/scheduled jobs</strong></p>
<p>Most of the applications have some functionality/jobs that need to be run periodically, for example generating invoices, sending newsletters etc.  In most cases these jobs are done by a rake task. We should make sure that we have added such jobs to cron or similar program.</p>
<p> &nbsp; </p>
<p><strong>7.  Monitoring important processes</strong></p>
<p>To ensure that our site is up 24&#215;7 we need to ensure that all processes that our application needs are up. There can be many processes like MySQL, Mongrel, Apache etc.. These processes are very important as our application directly depends on them. For example if MySQL process get killed accidentally, our application would not be able to connect to MySQL and will start throwing exceptions.</p>
<p>We can choose any of the available monitoring tools like God, Monit, 24&#215;7 etc&#8230;</p>
<p> &nbsp; </p>
<p><strong>8. Ensure confidential data filtering</strong></p>
<p>We would never like to leak/share confidential information of our application users. We should make sure that none of the user&#8217;s confidential data like SSN, Credit card info, password are being written to log files. We might not have paid much attention on this while developing the application.</p>
<p> &nbsp; </p>
<p><strong>9. Rotate log files</strong></p>
<p>Once our site is up and running, every single request write some text in log file. And hence size of the  log file keeps on increasing. Larger log files can put us in trouble if we get it beyond certain size. Its difficult to manage these log files, as larger files need more memory to open and need more time to download. In one of the rescue project we did , the log file size was 3GB.</p>
<p>We would recommend having<a href="http://www.nullislove.com/2007/09/10/rotating-rails-log-files/"> logrotate setup</a> for the application.</p>
<p> &nbsp; </p>
<p><strong>10. Setup Asset Host </strong></p>
<p>Setting up asset hosts can reduce loading time by 50% or more. We must setup asset hosts for our application. Once asset hosts are all set, our static files will be delivered via asset hosts for example asset1.hostname.com, asset2.hostname.com</p>
<p> &nbsp; </p>
<p><strong>11. Clearing up stale sessions</strong></p>
<p>We should make sure we should not left any stale session on the server. If our application is using DB or file system  as session store, we must add a schedule task to delete stale sessions.</p>
<p>These are some of the points we have identified from our past experience and we might be missing some. Feel free to  always add them as comments, and I&#8217;ll keep this post updated.</p>
<hr size = 2 width = "98%" style="border-top:2px dotted grey; margin: 5px;"/>
<img src="http://www.gravatar.com/avatar/174330d280860a6ad77a6d15dd7fabe1?s=96&#038;d=wavatar&#038;r=G" height="50" align="left" hspace="10" vpsace="10" /> <a href="http://www.webonrails.com" target="_blank"> Akhil </a> is a senior software engineer working with Vinsol for last 5 years. He is an inhouse deployment ninja.</p>
<div style ="clear:both"> &nbsp;</div>
<hr size = 2 width = "98%" style="border-top:2px dotted grey; margin: 5px;"/>
<p> &nbsp; </p>
<p>We also provide affordable <a href="http://vinsol.com/rails-deployment-services"> rails deployment services</a>.  </p>
<p> &nbsp; </p>
<p> &nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hassle free installation of rails stack on debian based system</title>
		<link>http://webonrails.com/2009/02/23/hassle-free-installation-of-rails-stack-on-debian-based-system/</link>
		<comments>http://webonrails.com/2009/02/23/hassle-free-installation-of-rails-stack-on-debian-based-system/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 16:34:52 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[rails stack]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[slicehost]]></category>

		<guid isPermaLink="false">http://webonrails.com/?p=255</guid>
		<description><![CDATA[Want to install rails stack on a machine? Just follow these steps. It will setup a rails stack(Apache + passenger + mysql + ruby + rubygems + common gems + git) on any server(debian based) apt-get update apt-get upgrade -y apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev apt-get -y install mysql-server libmysqlclient15-dev mysql-client apt-get -y]]></description>
			<content:encoded><![CDATA[<p>Want to install rails stack on a machine? Just follow these steps.  It will setup a rails stack(Apache + passenger + mysql + ruby + rubygems + common gems + git) on any server(debian based)</p>
<ol>
<li>apt-get update</li>
<li>apt-get upgrade -y</li>
<li>apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev  </li>
<li>apt-get -y install mysql-server libmysqlclient15-dev mysql-client </li>
<li>apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8</li>
<li>install rubygems manually:
<ol>
<li>download rubygems form rubyforge, >=1.3</li>
<li>unzip files</li>
<li>ruby setup.rb</li>
<li>Check that gem command is in path. Sometimes &#8216;gem1.8&#8242; is available but &#8216;gem&#8217; not. In that case copy /usr/bin/gem1.8 to /usr/bin/gem using &#8220;cp /usr/bin/gem1.8 /usr/bin/gem&#8221;</li>
</ol>
</li>
<li>apt-get -y install libmagick9-dev</li>
<li>apt-get -y install imagemagick</li>
<li>apt-get -y install postfix mailx</li>
<li>apt-get -y install apache2</li>
<li>apt-get -y install apache2-prefork-dev</li>
<li>wget http://webonrails.com/wp-content/plugins/download-monitor/download.php?id=7</li>
<li>ruby install_gems.txt</li>
<li>passenger-install-apache2-module</li>
<li>
Download git from git-scm.com</p>
<ol>
<li> Unzip files</li>
<li>./configure &#8211;without-tcltk</li>
<li>make -j 2</li>
<li>make install</li>
</ol>
</li>
</ol>
<p>You are all set now, go deploy you rails app. I have tested it on linode(ubuntu8.10), slicehost(ubuntu 8.10), should work for you too</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2009/02/23/hassle-free-installation-of-rails-stack-on-debian-based-system/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WebByNode: A New Hosting Service Launching Soon</title>
		<link>http://webonrails.com/2008/11/09/webbynode-a-new-hosting-service-launching-soon/</link>
		<comments>http://webonrails.com/2008/11/09/webbynode-a-new-hosting-service-launching-soon/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 03:36:04 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://webonrails.com/?p=114</guid>
		<description><![CDATA[Guys, I received a mail today that there will be a new hosting service launching soon. They said that it makes easier to deploy your applications. Whether its Ruby on Rails, Django, LAMP or your choice of Linux Distribution, its a ready-to-go solution. For more information please visit http://www.webbynode.com/ I am signing up there as]]></description>
			<content:encoded><![CDATA[<p>Guys, I received a mail today that there will be a new hosting service launching soon. They said that it makes easier to deploy your applications. Whether its Ruby on Rails, Django, LAMP or your choice  of Linux Distribution, its a ready-to-go solution. For more information please visit <a href="http://www.webbynode.com/">http://www.webbynode.com/</a></p>
<p>I am signing up there as a beta tester. Lets see how webby-node can help rails community by its services.</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2008/11/09/webbynode-a-new-hosting-service-launching-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presented at BarCampDelhi3</title>
		<link>http://webonrails.com/2007/12/10/presented-in-barcampdelhi3/</link>
		<comments>http://webonrails.com/2007/12/10/presented-in-barcampdelhi3/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 07:57:33 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[barcamp]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[ec2]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/12/10/presented-in-barcampdelhi3/</guid>
		<description><![CDATA[Yesterday, I attended third barcamp in delhi. I presented a session &#8220;Deploying rails application in EC2&#8243;. It was an amazing experience. We talked about EC2 and I had given a demo &#8220;How to deploy rails application on EC2&#8243;. I personally didn&#8217;t like some sessions. There were people from some company and after every 2 mins]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I attended<a href="http://www.barcamp.org/BarCampDelhi3"> third barcamp in delhi</a>. I presented a session &#8220;Deploying rails application in EC2&#8243;.  It was an amazing experience. We talked about EC2 and I had given a demo &#8220;How to deploy rails application on EC2&#8243;.</p>
<p>I personally didn&#8217;t like some sessions. There were people from some company and after every 2 mins they were saying &#8220;we are the best&#8221;. I think this should not happen in barcamp. As far as I know about barcamp, it is for sharing your experiences, talking about new technology, but not for promoting your company.</p>
<p>I think that, at BarCamp there should be sessions on new things, not on the things that are popular and have similar other services.</p>
<p>There was a very good session by  Jinesh Varia on Amazon Cloud Computing. He included Amazon&#8217;s simple storage system, and  Amazon&#8217;s cloud computing(Ec2) in his presentation. He also helped me in answering people while the demo. He gave me a hint that very soon there will a news from Amazon that will surprise us.</p>
<p>I have uploaded my presentation slides on Slideshare.net:</p>
<div style="width:425px;text-align:left" id="__ss_197972"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=deploying-rails-app-on-ec2-1197272291134652-3"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=deploying-rails-app-on-ec2-1197272291134652-3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/bansalakhil/deploying-rails-app-on-ec2" title="View 'Deploying Rails App On Ec2' on SlideShare">View</a> | <a href="http://www.slideshare.net/upload">Upload your own</a></div>
</div>
<p>Thanks to <a href="http://impetus.com">Impetus</a> Noida for Hosting Barcamp for second time and <a href="http://www.opera.com/">Opera</a> for Beer.</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2007/12/10/presented-in-barcampdelhi3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Deploying rails application with pound as a Balancer</title>
		<link>http://webonrails.com/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/</link>
		<comments>http://webonrails.com/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 12:40:38 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[balancer]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[pound]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/</guid>
		<description><![CDATA[Now a days Apache + mod_proxy + mongrel_clusters, Lighttpd + Mongrel cluster and Nginx + mongrel cluster are well known for deploying rails applications. You can also deploy your rails application with pound(a reverse proxy, load balancer and HTTPS front-end for Web server). First you need to setup mongrel_clusters for your rails application by issuing]]></description>
			<content:encoded><![CDATA[<p>Now a days Apache + mod_proxy + mongrel_clusters, Lighttpd + Mongrel cluster and Nginx + mongrel cluster are well known for deploying rails applications.</p>
<p>You can also deploy your rails application with <a href="http://www.apsis.ch/pound/"  target= "_blank">pound</a>(a reverse proxy, load balancer and HTTPS front-end for Web server).</p>
<p>First you need to setup mongrel_clusters for your rails application by issuing &#8221; <strong>mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 3 -c ./</strong> &#8221; inside the rails application root directory(on client machine). This will create mongrel_cluster.yml in config directory. You can change parameters in this command, as -p 8000 specifies that mongrel instances  will start  up on port  number starting 8000, -a 127.0.0.1 specifies that mongrel instances will listen to the localhost, -N specifies the number of mongrel instances and -c specifies the rails root directory.</p>
<p>Now you need to install pound(if not installed) by issuing following commands(as root):</p>
<ul>
<li>cd /opt/src</li>
<li>wget http://www.apsis.ch/pound/Pound-2.3.2.tgz</li>
<li>tar xzpf Pound-2.1.6.tgz</li>
<li>cd Pound-2.1.6</li>
<li>./configure</li>
<li>make</li>
<li>make install</li>
</ul>
<p>This will install pound in /usr/local/sbin/pound. In order to proceed further we need to create pound.cfg(pound configuration file) in /etc/pound/pound.cfg . Below is the content of pound.cfg:</p>
<pre class="brush: cpp;">

User &quot;pound&quot;
Group &quot;pound&quot;

ListenHTTP
  Address 0.0.0.0
  Port 80
  Service
    BackEnd
      Address 127.0.0.1
      Port 8000
    End
    BackEnd
      Address 127.0.0.1
      Port 8001
    End
    BackEnd
      Address 127.0.0.1
      Port 8002
    End
  End
End
</pre>
<p>Start mongrel cluster by issuing mongrel_rails cluster::start in you app root directory, start pound by /usr/local/sbin/pound -f /etc/pound/pound.cfg , now you are done. Pound is listening the port 80 and redirect all requests to mongrel instances running on 8000, 8001, 8002.</p>
<p>* Please Note that we have configured pound at port 80, if port 80 is being used by apache or any other application pound will not start. You need to stop any service using  port 80, if it is apache then stop apache, change line &#8216;Listen 80&#8242; to &#8220;Listen 8080&#8243; and start apache.</p>
<p>In a specific case, when apache is running at some port (let say 8080), you may want to use apache to serve static content of your application, in order to reduce some load from mongrels. In that case use the following:</p>
<pre class="brush: cpp;">

User &quot;pound&quot;
Group &quot;pound&quot;

ListenHTTP
  Address 0.0.0.0
  Port 80
  Service
      URL &quot;/(images|stylesheets|flash|javascripts)/&quot;
      BackEnd
          Address 127.0.0.1
          Port    8080
      End
      Session
          Type    BASIC
          TTL     300
      End
  End
  Service
    BackEnd
      Address 127.0.0.1
      Port 8000
    End
    BackEnd
      Address 127.0.0.1
      Port 8001
    End
    BackEnd
      Address 127.0.0.1
      Port 8002
    End
  End
End
</pre>
<p>This will redirect all requests for image, stylesheets, javascripts, flash to apache. Now we need to configure apache to serve those static content. Just add a virtualhost for that:</p>
<pre class="brush: cpp;">
&lt;virtualHost *:8080&gt;
  ServerName example.com
  ServerAlias www.example.com
  DocumentRoot /var/www/html/example.com/public
  &lt;directory &quot;/var/www/html/example.com/public&quot; &gt;
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  &lt;/directory&gt;

  RewriteEngine On

  # For static files it's good to avoid hitting your mongrel process
  # so let apache knows it should serve it directly
  # for a rails application it means, files in images / stylesheets / javascripts
  RewriteRule &quot;^/(images|stylesheets|flash|javascripts)/?(.*)&quot; &quot;$0&quot; [L]

&lt;/virtualHost&gt;
</pre>
<p>Its all done. All requests for dynamic content at port 80 will be redirect to mongrel running at 8000, 8001, 8001 and requests for static content will be served by apache running at port 8080.</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Stuck with capistrano</title>
		<link>http://webonrails.com/2007/05/15/stuck-with-capistrano/</link>
		<comments>http://webonrails.com/2007/05/15/stuck-with-capistrano/#comments</comments>
		<pubDate>Tue, 15 May 2007 14:40:49 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/05/15/stucked-with-capistrano/</guid>
		<description><![CDATA[I was deploying my latest code to live site today using Capistrano, and suddenly I stuck. When I tried to deploy the code, it checked out the latest version on the server and while executing after_symlink task it rolled back. I was surprised because the deploy script was working fine earlier and I haven&#8217;t made]]></description>
			<content:encoded><![CDATA[<p>I was deploying my latest code to live site today using Capistrano, and suddenly I stuck. When I tried to deploy the code, it checked out the latest version on the server and while executing after_symlink task it rolled back. I was surprised because the deploy script was working fine earlier and I haven&#8217;t made any change in deploy.rb or deploy procedure.  I tried many times but not succeed, and then I found the root of problem.</p>
<p>The problem was that I mistakenly created a file in releases directory and Capistrano uses ln -x1 command to create symbolic link to current release. And Capistrano links last output of &#8216;ln -x1&#8242; as &#8216;current&#8217;, so in this case &#8216;current&#8217; was linking to a file. This was doing all the mess, as &#8216;current&#8217; was pointing to a file instead of latest release directory. I deleted that file from releases and then it worked fine&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2007/05/15/stuck-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Engine Yard: Best Hosting for rails applications</title>
		<link>http://webonrails.com/2007/03/20/engine-yard-best-hosting-for-rails-applications/</link>
		<comments>http://webonrails.com/2007/03/20/engine-yard-best-hosting-for-rails-applications/#comments</comments>
		<pubDate>Tue, 20 Mar 2007 15:54:00 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[Engine Yard]]></category>
		<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/03/20/engine-yard-best-hosting-for-rails-applications/</guid>
		<description><![CDATA[Today I deployed my rails application to Engine Yard server. They have great configuration, ultimate cluster architecture(physical clusters then logical clusters). They have separate servers for SSH, email, web, app etc&#8230; . Servers are managed by top architects, I should say they are expert in rails application deployment.]]></description>
			<content:encoded><![CDATA[<p>Today I deployed my rails application to <a href="http://engineyard.com/">Engine Yard</a> server. They have great configuration, ultimate cluster architecture(physical clusters then logical clusters). They have separate servers for SSH, email, web, app etc&#8230; . Servers are managed by top architects, I should say they are expert in rails application deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2007/03/20/engine-yard-best-hosting-for-rails-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>apache proxy balancer + mongrel clusters and deploying application with capistrano</title>
		<link>http://webonrails.com/2007/02/04/apache-proxy-balancer-mongrel-clusters-and-deploying-application-with-capistrano/</link>
		<comments>http://webonrails.com/2007/02/04/apache-proxy-balancer-mongrel-clusters-and-deploying-application-with-capistrano/#comments</comments>
		<pubDate>Sun, 04 Feb 2007 14:20:25 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[mongrel_cluster]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/02/04/apache-proxy-balancer-mongrel-clusters-and-deploying-application-with-capistrano/</guid>
		<description><![CDATA[So you want to setup production server with mongrel clusters and apache proxy balancer, also wants to use capistrano for deployment, huh. Take it easy, its very simple. You need Apache 2.2 or later on your production server, and the following ruby gems on your both machine(server and local): capistrano mongrel mongrel_cluster I haven&#8217;t mentioned]]></description>
			<content:encoded><![CDATA[<p>So you want to setup production server with mongrel clusters and apache proxy balancer, also wants to use capistrano for deployment, huh. Take it easy, its very simple.</p>
<p>You need Apache 2.2 or later on your production server, and the following ruby gems on your both machine(server and local):</p>
<ul>
<li>capistrano</li>
<li>mongrel</li>
<li>mongrel_cluster</li>
</ul>
<p>I haven&#8217;t mentioned rails and rake gem as we are deploying a rails application so these gems are obvious.</p>
<p>Lets install above gems (if not installed)  by issuing:</p>
<p>gem install &#8211;include-dependencies capistrano<br />
gem install &#8211;include-dependencies mongrel<br />
gem install &#8211;include-dependencies mongrel_cluster</p>
<p>Now make sure that the following modules are enabled (they are disabled by default) :</p>
<ul>
<li>mod-rewrite</li>
<li>mod-proxy</li>
<li>mod-proxy-http</li>
<li>mod-proxy-balancer</li>
</ul>
<p>to check if they are enabled issue &#8221; <strong>/etc/init.d/apachectl -M</strong> &#8221; on server, it will list all the enabled modules. For Debian systems all enabled modules are in /etc/apache2/mods-enabled directory and all available modules are in  /etc/apache2/mods-available directory, to enable them issue &#8221; <strong>a2enmod MOD_NAME</strong> &#8220;.</p>
<p>Now create the production database(on server) and update database.yml for production database settings.</p>
<p>After this configure mongrel by issuing &#8221; <strong>mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 2 -c ./</strong> &#8221; inside the rails application root directory(on client machine). This will create mongrel_cluster.yml in config directory. You can change parameters in this command, as -p 8000 specifies that mongrel instances  will start  up on port  number starting 8000, -a 127.0.0.1 specifies that mongrel instances will listen to the localhost, -N specifies the number of mongrel instances and -c specifies the rails root directory.</p>
<p>Now its time to capistranize rails application, issue &#8221; <strong>cap &#8211;apply-to ./ APP_NAME</strong> &#8221; inside rails application root directory(on client machine), this will add two files(config/deploy.rb and lib/tasks/capistrano.rake) to the rails application. Edit deploy.rb according to your requirements. Also add the following code to deploy.rb :</p>
<p>task :restart, :roles => :app do<br />
# stop mongrel clusters for previous release and start for current<br />
run &#8220;cd #{previous_release} &#038;&#038; mongrel_rails cluster::stop&#8221;<br />
run &#8220;sleep 5&#8243;<br />
run &#8220;cd #{current_release} &#038;&#038; mongrel_rails cluster::start&#8221;<br />
end</p>
<p>Now on your local machine issue these two commands in only once &#8221; <strong>rake remote:setup</strong> &#8221; and &#8221; <strong>rake remote:cold_deploy</strong> &#8220;, when you issue &#8221; <strong>rake remote:setup</strong> &#8221; it will prompt for the server password and create necessary directories on the server and &#8221; <strong>rake remote:cold_deploy</strong> &#8221; will deploy your code to the server. Next time whenever you want to deploy to the server you just need to issue &#8221; <strong>rake remote:deploy</strong> &#8221; not &#8221; <strong>rake remote:cold_deploy</strong> &#8220;.</p>
<p>Now we are just one step back, we need to configure apache proxy balancer for mongrel instances. Add the following code to the httpd.conf file:</p>
<proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000<br />
BalancerMember http://127.0.0.1:8001
</proxy>
<p><virtualHost *:80><br />
ServerName myapp.com<br />
DocumentRoot /rails_apps/app/public</p>
<p><directory "/rails_apps/app/public"><br />
Options FollowSymLinks<br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all<br />
</directory></p>
<p>RewriteEngine On</p>
<p>RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f<br />
RewriteCond %{SCRIPT_FILENAME} !maintenance.html<br />
RewriteRule ^.*$ /system/maintenance.html [L]</p>
<p>RewriteRule ^/$ /index.html [QSA]<br />
# Rewrite to check for Rails cached page<br />
RewriteRule ^([^.]+)$ $1.html [QSA]</p>
<p>RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f<br />
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]<br />
</virtualHost></p>
<p>you need to change the above code according to you requirement. Also you need to restart apache server by issuing &#8221; <strong>/etc/init.d/apachectl restart</strong> &#8220;. Now you are done.</p>
<p>But we also need to add a script to start mongrel instances when the server restarts, otherwise whenever the server restart there will no mongrel instance running.</p>
<p>Just create a file named mongrel_clusters (you can choose any name) in /etc/init.d directory with the following code:</p>
<p>#!/bin/bash<br />
#<br />
# chkconfig: 345 94 16<br />
# description: Startup script for mongrel<br />
BASEDIR=/var/www/your_app<br />
export HZ=100<br />
export TERM=linux<br />
export SHELL=/bin/bash<br />
export HUSHLOGIN=FALSE<br />
export USER=root<br />
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games<br />
export MAIL=/var/mail/root<br />
export _=/usr/bin/env<br />
export PWD=/etc/init.d<br />
export HOME=/root<br />
export SHLVL=2<br />
export LOGNAME=root</p>
<p>cd $BASEDIR<br />
case &#8220;$1&#8243; in<br />
start)<br />
echo &#8220;starting up mongrel in $BASEDIR&#8221;<br />
mongrel_rails cluster::start<br />
;;<br />
stop)<br />
echo &#8220;stopping mongrel&#8221;<br />
mongrel_rails cluster::stop<br />
;;<br />
restart)<br />
mongrel_rails cluser::stop<br />
sleep 3<br />
mongrel_rails cluster::start<br />
;;<br />
esac</p>
<p>You need to change the BASEDIR in the above code. Make this file executable by &#8221; <strong>chmod +x /etc/init.d/mongrel_clusters</strong> &#8221;<br />
Issue these commands to add this script at system startup:</p>
<p><strong>Debian:</strong><strong> /usr/sbin/update-rc.d /etc/init.d/mongrel_clusters defaults</strong><br />
<strong>RedHat:</strong>  <strong>/usr/sbin/chkconfig &#8211;add /etc/init.d/mongrel_clusters</strong> and <strong>/usr/sbin/chkconfig &#8211;level 2 /etc/init.d/mongrel_clusters on</strong></p>
<p>Note: Use above instructions at your own risk, if your computer explodes its not my fault <img src='http://webonrails.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2007/02/04/apache-proxy-balancer-mongrel-clusters-and-deploying-application-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Configuring Multiple Rails Application with Lighttpd</title>
		<link>http://webonrails.com/2006/06/28/configuring-multiple-rails-application-with-lighttpd/</link>
		<comments>http://webonrails.com/2006/06/28/configuring-multiple-rails-application-with-lighttpd/#comments</comments>
		<pubDate>Wed, 28 Jun 2006 22:06:00 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[ROR]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rubyonrails]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[lighttpd]]></category>

		<guid isPermaLink="false">http://webonrails.com/?p=14</guid>
		<description><![CDATA[I was using lighttpd web server for my Rails applications. In development mode I was starting lighttpd server from the rails application directory by lighttpd -D -f config/lighttpd.conf But I was facing problem when I tried to run multiple rails applications in production mode. After some trials I succeded. I inserted the following lines of]]></description>
			<content:encoded><![CDATA[<p>I was using lighttpd web server for my Rails applications.<br />
In development mode I was starting lighttpd server from the rails application directory by</p>
<p><strong>lighttpd -D -f config/lighttpd.conf</strong><br />
But I was facing problem when I tried to run multiple rails applications in production mode. After some trials I succeded.</p>
<p>I inserted the following lines of code in my /etc/lighttpd/lighttpd.conf file</p>
<blockquote><p>$HTTP["host"]== &#8220;domain.com&#8221; {</p>
<p>server.error-handler-404 = &#8220;/dispatch.fcgi&#8221;</p>
<p>server.document-root = &#8220;/home/railsapp/public/&#8221;</p>
<p>server.errorlog = &#8220;/home/railsapp/log/lighttpd.error.log&#8221;</p>
<p>accesslog.filename = &#8220;/home/railsapp/log/lighttpd.access.log&#8221;</p>
<p>url.rewrite = ( &#8220;^/$&#8221; =&gt; &#8220;index.html&#8221;, &#8220;^([^.]+)$&#8221; =&gt; &#8220;$1.html&#8221; )</p>
<p>fastcgi.server = ( &#8220;.fcgi&#8221; =&gt; ( &#8220;localhost&#8221; =&gt; (</p>
<p>&#8220;min-procs&#8221; =&gt; 1,</p>
<p>&#8220;max-procs&#8221; =&gt; 1,</p>
<p>&#8220;socket&#8221; =&gt; &#8220;/home/railsapp/tmp/sockets/fcgi.socket&#8221;,</p>
<p>&#8220;bin-path&#8221; =&gt; &#8220;/home/railsapp/public/dispatch.fcgi&#8221;,</p>
<p>&#8220;bin-environment&#8221; =&gt; ( &#8220;RAILS_ENV&#8221; =&gt; &#8220;production&#8221; )</p>
<p>) ) )</p>
<p>}</p>
<p>$HTTP["host"]== &#8220;another.domain.com&#8221; {</p>
<p>server.error-handler-404=&#8221;/dispatch.fcgi&#8221;</p>
<p>server.document-root = &#8220;/home/anotherrailsapp/sparitual/public/&#8221;</p>
<p>server.errorlog = &#8220;/home/anotherrailsapp/log/lighttpd.error.log&#8221;</p>
<p>accesslog.filename = &#8220;/home/anotherrailsapp/log/lighttpd.access.log&#8221;</p>
<p>url.rewrite = ( &#8220;^/$&#8221; =&gt; &#8220;index.html&#8221;, &#8220;^([^.]+)$&#8221; =&gt; &#8220;$1.html&#8221; )</p>
<p>compress.filetype = ( &#8220;text/plain&#8221;, &#8220;text/html&#8221;, &#8220;text/css&#8221;, &#8220;text/javascript&#8221; )</p>
<p>compress.cache-dir = &#8220;/home/anotherrailsapp/tmp/cache&#8221;</p>
<p>fastcgi.server = ( &#8220;.fcgi&#8221; =&gt; ( &#8220;localhost&#8221; =&gt; (</p>
<p>&#8220;min-procs&#8221; =&gt; 1,</p>
<p>&#8220;max-procs&#8221; =&gt; 1,</p>
<p>&#8220;socket&#8221; =&gt; &#8220;/home/anotherrailsapp/tmp/sockets/fcgi.socket&#8221;,</p>
<p>&#8220;bin-path&#8221; =&gt; &#8220;/home/anotherrailsapp/public/dispatch.fcgi&#8221;,</p>
<p>&#8220;bin-environment&#8221; =&gt; ( &#8220;RAILS_ENV&#8221; =&gt; &#8220;production&#8221; )</p>
<p>) ) )</p>
<p>}</p></blockquote>
<p>Then started the lighttpd server by</p>
<p><strong>lighttpd -D -f /etc/lighttpd/lighttpd.conf</strong></p>
<p>And it worked&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://webonrails.com/2006/06/28/configuring-multiple-rails-application-with-lighttpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
