<?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>eXpand yOur cReativity &#187; server</title>
	<atom:link href="http://blog.bhushangahire.net/tag/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bhushangahire.net</link>
	<description>by Bhushan G Ahire</description>
	<lastBuildDate>Mon, 26 Jul 2010 10:25:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows Firewall and non-secure FTP traffic Rule for firewall</title>
		<link>http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/</link>
		<comments>http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/#comments</comments>
		<pubDate>Thu, 13 May 2010 05:59:21 +0000</pubDate>
		<dc:creator>Bhushan G Ahire</dc:creator>
				<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=179</guid>
		<description><![CDATA[
Windows firewall can be configured from command line using netsh command. 2 simple steps are required to setup Windows Firewall to allow non-secure FTP traffic
 
1) Open port 21 on the firewall
netsh advfirewall firewall add rule name=&#8221;FTP (no SSL)&#8221; action=allow protocol=TCP dir=in localport=21
2) Activate firewall application filter for FTP (aka Stateful FTP) that will dynamically [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F05%2F13%2Fwindows-firewall-and-non-secure-ftp-traffic%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p><strong>Windows firewall can be configured from command line using netsh command. 2 simple steps are required to setup Windows Firewall to allow non-secure FTP traffic</strong></p>
<p><span style="font-family: Arial; font-size: x-small;"> </span></p>
<p align="left"><strong>1)</strong> Open port 21 on the firewall</p>
<p><em><span style="color: #4f6228; font-size: x-small;"><strong>netsh advfirewall firewall add rule name=&#8221;FTP (no SSL)&#8221; action=allow protocol=TCP dir=in localport=21</strong></span></em></p>
<p><span style="font-size: x-small;"><strong>2)</strong> Activate firewall application filter for FTP (aka Stateful FTP) that will dynamically open ports for data connections</span></p>
<p><em><span style="color: #4f6228; font-size: x-small;"><strong>netsh advfirewall set global StatefulFtp enable</strong></span></em></p>
<p><em>Hope this information is helpful for you&#8230;.</em></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/&amp;title=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/&amp;title=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/&amp;title=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/&amp;t=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall+-+http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/&amp;title=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall&amp;summary=Windows%20firewall%20can%20be%20configured%20from%20command%20line%20using%20netsh%20command.%202%20simple%20steps%20are%20required%20to%20setup%20Windows%20Firewall%20to%20allow%20non-secure%20FTP%20traffic%0D%0A%0D%0A%20%0D%0A1%29%20Open%20port%2021%20on%20the%20firewall%0D%0Anetsh%20advfirewall%20firewall%20add%20rule%20name%3D%22FTP%20%28no%20SSL%29%22%20action%3Dallow%20protocol%3DTCP%20dir%3Din%20localport%3D21&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F05%2F13%2Fwindows-firewall-and-non-secure-ftp-traffic%2F&amp;t=Windows+Firewall+and+non-secure+FTP+traffic+Rule+for+firewall" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2010/05/13/windows-firewall-and-non-secure-ftp-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Do I Enable remote access to PostgreSQL database server?</title>
		<link>http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/</link>
		<comments>http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/#comments</comments>
		<pubDate>Tue, 11 May 2010 12:11:22 +0000</pubDate>
		<dc:creator>Bhushan G Ahire</dc:creator>
				<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=177</guid>
		<description><![CDATA[



By default, PostgreSQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home computer or from web server.
Step # 1: Login over ssh if server is outside your IDC
Login over ssh to remote PostgreSQL  database server:
$ ssh user@remote.pgsql.server.com
Step # 2: Enable [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F05%2F11%2Fhow-do-i-enable-remote-access-to-postgresql-database-server%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<div class="format_text entry-content">
<div style="float: right; margin-top: 0px; margin-left: 5px;"><a title="See all Postgresql related tips/articles" href="http://www.cyberciti.biz/tips/category/postgresql/"><br />
<img src="http://figs.cyberciti.biz/3rdparty/pgsql-logo.png" border="0" alt="" /></a></div>
<p>By default, PostgreSQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home computer or from web server.</p>
<h2>Step # 1: Login over ssh if server is outside your IDC</h2>
<p>Login over ssh to remote PostgreSQL  database server:</p>
<p><code>$ ssh user@remote.pgsql.server.com</code></p>
<h2>Step # 2: Enable client authentication</h2>
<p>Once connected, you need edit the PostgreSQL configuration file, edit the PostgreSQL configuration file <strong>/var/lib/pgsql/data/pg_hba.conf</strong> (or <strong>/etc/postgresql/8.2/main/pg_hba.conf</strong> for latest 8.2 version) using a text editor such as vi.</p>
<p>Login as postgres user using su / sudo command, enter:</p>
<p><code>$ su - postgres</code></p>
<p>Edit the file:</p>
<p><code>$ vi /var/lib/pgsql/data/pg_hba.conf</code></p>
<p>OR</p>
<p><code>$ vi /etc/postgresql/8.2/main/pg_hba.conf</code></p>
<p>Append the following configuration lines to give access to 10.10.29.0/24 network:</p>
<p><code>host all all 10.10.29.0/24 trust</code></p>
<p>Save and close the file.  Make sure you replace 10.10.29.0/24 with  actual network IP address range of the clients system in your own network.</p>
<h2>Step # 2: Enable networking for PostgreSQL</h2>
<p>You need to enable TCP / IP networking. Use either step #3 or #3a as per your PostgreSQL database server version.</p>
<h2>Step # 3: Allow TCP/IP socket</h2>
<p>If you are using <strong>PostgreSQL version 8.x or newer</strong> use the following instructions or skip to <a href="#3a">Step # 3a</a> for older version (7.x or older).</p>
<p>You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf or /etc/postgresql/8.2/main/postgresql.conf.</p>
<p><code># vi /etc/postgresql/8.2/main/postgresql.conf</code></p>
<p>OR</p>
<p><code># vi /var/lib/pgsql/data/postgresql.conf </code></p>
<p>Find configuration line that read as follows:</p>
<p><code>listen_addresses='localhost'</code></p>
<p>Next set IP address(es) to listen on; you can use comma-separated list of addresses; defaults to &#8216;localhost&#8217;, and &#8216;*&#8217; is all ip address:</p>
<p><code>listen_addresses='*'</code></p>
<p>Or just bind to 202.54.1.2 and 202.54.1.3 IP address</p>
<p><code>listen_addresses='202.54.1.2 202.54.1.3'</code></p>
<p>Save and close the file. Skip to <a href="#4">step # 4</a>.</p>
<h3>Step #3a &#8211; Information for old version 7.x  or older</h3>
<p>Following configuration only required for <strong>PostgreSQL version 7.x or older</strong>. Open config file, enter:</p>
<p><code># vi /var/lib/pgsql/data/postgresql.conf </code></p>
<p>Bind and open TCP/IP port by setting tcpip_socket to true.  Set / modify tcpip_socket to true:</p>
<p><code>tcpip_socket = true</code></p>
<p>Save and close the file.</p>
<h2>Step # 4: Restart PostgreSQL Server</h2>
<p>Type the following command:</p>
<p><code># /etc/init.d/postgresql restart</code></p>
<h2>Step # 5: Iptables firewall rules</h2>
<p>Make sure iptables is not blocking communication, <a href="http://www.cyberciti.biz/tips/howto-iptables-postgresql-open-port.html">open port 5432</a> (append rules to your iptables scripts or file <a href="http://www.cyberciti.biz/faq/howto-block-ipaddress-of-spammers-with-firewall/">/etc/sysconfig/iptables</a>):</p>
<pre>iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 20.04.23.22  --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 20.04.23.22 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT</pre>
<p>Restart firewall:</p>
<p><code># /etc/init.d/iptables restart</code></p>
<h2>Step # 6: Test your setup</h2>
<p>Use psql command from client system. Connect to remote server using IP address 20.04.23.22 and login using postgres username and testdatabase database, enter:</p>
<p><code>$ psql -h 20.04.23.22 -U postgres -d testdatabase</code></p>
</div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/&amp;title=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/&amp;title=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/&amp;title=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/&amp;t=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F+-+http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/&amp;title=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F&amp;summary=%0D%0A%0D%0A%0D%0ABy%20default%2C%20PostgreSQL%20database%20server%20remote%20access%20disabled%20for%20security%20reasons.%20However%2C%20some%20time%20you%20need%20to%20provide%20the%20remote%20access%20to%20database%20server%20from%20home%20computer%20or%20from%20web%20server.%0D%0AStep%20%23%201%3A%20Login%20over%20ssh%20if%20server%20is%20outside%20your%20IDC%0D%0ALogin%20over%20ssh%20to%20remote%20PostgreSQL%20%20d&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F05%2F11%2Fhow-do-i-enable-remote-access-to-postgresql-database-server%2F&amp;t=How+Do+I+Enable+remote+access+to+PostgreSQL+database+server%3F" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2010/05/11/how-do-i-enable-remote-access-to-postgresql-database-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Capistrano to deploy Rails application on Amazon EC2 with Git</title>
		<link>http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/</link>
		<comments>http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 06:22:49 +0000</pubDate>
		<dc:creator>Bhushan G Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=155</guid>
		<description><![CDATA[
1: Create a new Rails app &#8211; we&#8217;ll call is &#8216;deploytest&#8217;
$ rails deploytest
$ cd deploytest
2: Create a local Git repository for it
$ git init
$ git add *
$ git commit -a -m 'initial commit'
$ git status
3: Create a couple of Capistrano files
$ capify .
4: Edit config/deploy.rb
# The name of your app
set :application, "deploytest"
# The directory on [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F02%2F17%2Fsetup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<div class="post-body entry-content">1: Create a new Rails app &#8211; we&#8217;ll call is &#8216;deploytest&#8217;</p>
<pre class="prettyprint"><span class="pln">$ rails deploytest
$ cd deploytest</span></pre>
<p>2: Create a local Git repository for it</p>
<pre class="prettyprint"><span class="pln">$ git init
$ git add </span><span class="pun">*</span><span class="pln">
$ git commit </span><span class="pun">-</span><span class="pln">a </span><span class="pun">-</span><span class="pln">m </span><span class="str">'initial commit'</span><span class="pln">
$ git status</span></pre>
<p>3: Create a couple of Capistrano files</p>
<pre class="prettyprint"><span class="pln">$ capify </span><span class="pun">.</span></pre>
<p>4: Edit config/deploy.rb</p>
<pre class="prettyprint"><span class="com"># The name of your app</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">application</span><span class="pun">,</span><span class="pln"> </span><span class="str">"deploytest"</span><span class="pln">
</span><span class="com"># The directory on the EC2 node that will be deployed to</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">deploy_to</span><span class="pun">,</span><span class="pln"> </span><span class="str">"/var/www/apps/#{application}"</span><span class="pln">
</span><span class="com"># The type of Source Code Management system you are using</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">scm</span><span class="pun">,</span><span class="pln"> </span><span class="pun">:</span><span class="pln">git
</span><span class="com"># The location of the LOCAL repository relative to the current app</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">repository</span><span class="pun">,</span><span class="pln">  </span><span class="str">"."</span><span class="pln">
</span><span class="com"># The way in which files will be transferred from repository to remote host</span><span class="pln">
</span><span class="com"># If you were using a hosted github repository this would be slightly different</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">deploy_via</span><span class="pun">,</span><span class="pln"> </span><span class="pun">:</span><span class="pln">copy

</span><span class="com"># The address of the remote host on EC2 (the Public DNS address)</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">location</span><span class="pun">,</span><span class="pln"> </span><span class="str">"ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com"</span><span class="pln">
</span><span class="com"># setup some Capistrano roles</span><span class="pln">
role </span><span class="pun">:</span><span class="pln">app</span><span class="pun">,</span><span class="pln"> location
role </span><span class="pun">:</span><span class="pln">web</span><span class="pun">,</span><span class="pln"> location
role </span><span class="pun">:</span><span class="pln">db</span><span class="pun">,</span><span class="pln">  location</span><span class="pun">,</span><span class="pln"> </span><span class="pun">:</span><span class="pln">primary </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="kwd">true</span><span class="pln">

</span><span class="com"># Set up SSH so it can connect to the EC2 node - assumes your SSH key is in ~/.ssh/id_rsa</span><span class="pln">
</span><span class="kwd">set</span><span class="pln"> </span><span class="pun">:</span><span class="pln">user</span><span class="pun">,</span><span class="pln"> </span><span class="str">"root"</span><span class="pln">
ssh_options</span><span class="pun">[:</span><span class="pln">keys</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="typ">File</span><span class="pun">.</span><span class="pln">join</span><span class="pun">(</span><span class="pln">ENV</span><span class="pun">[</span><span class="str">"HOME"</span><span class="pun">],</span><span class="pln"> </span><span class="str">".ssh"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"id_rsa"</span><span class="pun">)]</span><span class="pln">
</span></pre>
<p>The only account on a default EC2 instance is root. You probably want to create a second user that is responsible for your application.</p>
<p>5: Copy your SSH public key to your EC2 node</p>
<pre class="prettyprint"><span class="pln">$ scp </span><span class="pun">-</span><span class="pln">i </span><span class="pun">~</span><span class="str">/my-ec2-keypair ~/</span><span class="pun">.</span><span class="pln">ssh</span><span class="pun">/</span><span class="pln">id_rsa</span><span class="pun">.</span><span class="pln">pub root@ec2</span><span class="pun">-</span><span class="lit">xxx</span><span class="pun">-</span><span class="lit">xxx</span><span class="pun">-</span><span class="lit">xxx</span><span class="pun">-xxx</span><span class="lit">.compute</span><span class="pun">-</span><span class="lit">1.amazonaws</span><span class="pun">.</span><span class="pln">com</span><span class="pun">:</span><span class="str">/root/</span><span class="pun">.</span><span class="pln">ssh</span><span class="pun">/</span><span class="pln">authorized_keys2</span></pre>
<p>NOTE the filename authorized_keys2 &#8211; not authorized_keys!!</p>
<p>6: Setup the EC2 node for Capistrano deployment.<br />
From your LOCAL machine, not the EC2 node:</p>
<pre class="prettyprint"><span class="pln">$ cap deploy</span><span class="pun">:</span><span class="pln">setup</span></pre>
<p>7: Finally, deploy your application</p>
<pre class="prettyprint"><span class="pln">$ cap deploy</span></pre>
<p>You will see lots of output and with this dummy application some of those will report errors/warnings. Don&#8217;t worry about that for now.</p>
<p>8: Check that the Deployment was successful<br />
Connect to the EC2 node with SSH the regular way, cd to the app directory and check that everything is there. If that is all working then you are ready to deploy a real application and add custom tasks for managing the database, restarting the server etc.</p>
<p>Bear in mind that Capistrano add new &#8216;releases&#8217; of your software in separate directories and symlinks the &#8216;current&#8217; directory to the latest. So the root of your deployed application is the &#8216;current&#8217; subdirectory.</p>
<p>Hope this will help you setting up your ec2 instance with capistrano.</p></div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/&amp;title=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/&amp;title=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/&amp;title=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/&amp;t=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git+-+http://tr.im/SU8k+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/&amp;title=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git&amp;summary=1%3A%20Create%20a%20new%20Rails%20app%20-%20we%27ll%20call%20is%20%27deploytest%27%0D%0A%24%20rails%20deploytest%0D%0A%24%20cd%20deploytest%0D%0A2%3A%20Create%20a%20local%20Git%20repository%20for%20it%0D%0A%24%20git%20init%0D%0A%24%20git%20add%20%2A%0D%0A%24%20git%20commit%20-a%20-m%20%27initial%20commit%27%0D%0A%24%20git%20status%0D%0A3%3A%20Create%20a%20couple%20of%20Capistrano%20files%0D%0A%24%20capify%20.%0D%0A4%3A%20Edit%20config%2Fdeploy.rb%0D%0A%23%20The%20name%20o&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2010%2F02%2F17%2Fsetup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git%2F&amp;t=Setup+Capistrano+to+deploy+Rails+application+on+Amazon+EC2+with+Git" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Step-By-Step setup slicehost server (fedora) for rails application.</title>
		<link>http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/</link>
		<comments>http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 10:11:00 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=136</guid>
		<description><![CDATA[






Hi all as I worked on setting up 4 to 5 servers, I thought its better to document the stuff so that I/developers can refer it, So I am documenting the step-by-step process for setting up the slicehost server for rails application work with nginx as a web server and mongrel as a rails application [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F07%2F22%2Fstep-by-step-setup-slicehost-server-fedora-for-rails-application%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<div id="content"><!--single.php--></p>
<p><!--loop--></p>
<p><!--post title--></p>
<div class="post-meta-top">
<div class="clearboth"></div>
<p><!--content with more link--></p>
<div>Hi all as I worked on setting up 4 to 5 servers, I thought its better to document the stuff so that I/developers can refer it, So I am documenting the step-by-step process for setting up the slicehost server for rails application work with <strong>nginx</strong> as a web server and <strong>mongrel</strong> as a rails application server.</div>
<div>
<h2>Update</h2>
<div class="level2">
<p>To update your system:</p>
<blockquote><p>yum update</p></blockquote>
</div>
<h2>MySQL</h2>
<div class="level2">
<p>to install mysql client and server apps</p>
<blockquote><p>yum install mysql-server</p></blockquote>
<p>The client package “mysql” will automatically be installed as a dependency.</p></div>
<h2>Apache</h2>
<div class="level2">
<blockquote><p>yum install httpd</p></blockquote>
</div>
<h2>PHP5</h2>
<div class="level2">
<p>To install php with soap, xml and mysql plugins:</p>
<blockquote><p>yum install php php-soap php-xml php-mysql</p></blockquote>
<p>some other php plugin utilities that are common:</p>
<blockquote><p>yum install php-mbstring php-gd</p></blockquote>
</div>
<h2>Ruby</h2>
<div class="level2">
<blockquote><p>yum install ruby</p></blockquote>
</div>
<h2>Utilities</h2>
<div class="level2">
<p>other useful utilities:</p>
<blockquote><p>yum install nano wget elinks subversion vi</p></blockquote>
</div>
</div>
<div>
<h2>Nginx</h2>
<div class="level2">
<p>install nginx web server:</p>
<blockquote><p>yum install nginx</p></blockquote>
</div>
<h2>Mongrel Cluster</h2>
<div class="level2">
<p>install mongrel_cluster:</p>
<blockquote><p>gem install mongrel_cluster –include-dependencies</p></blockquote>
</div>
<p>Setup your nginx configuration for your rails application and mongrel_cluster (proxy).</p>
<p>Below you found sample config file for nginx.conf (normally located in “/etc/nginx/conf/nginx.conf”)</p>
<blockquote>
<pre>user  deploy;
worker_processes  1;
error_log   logs/error.log debug;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
  include        conf/mime.types;
  default_type   application/octet-stream;
  sendfile        on;
  #tcp_nopush     on;
  keepalive_timeout  65;
  tcp_nodelay        on;
  gzip  on;
  gzip_min_length  1100;
  gzip_buffers     4 8k;
  gzip_types       text/plain;
  upstream mongrel {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
  }
  server {
    listen       80;
    server_name  example.com;
    root /var/www/apps/example/current/public;
    index  index.html index.htm;
    location / {
      proxy_set_header  X-Real-IP  $remote_addr;
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect false;
      if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename.html) {
        rewrite (.*) $1.html break;
      }
      if (!-f $request_filename) {
        proxy_pass http://mongrel;
        break;
      }
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
  }
}</pre>
</blockquote>
</div>
<p>Restart the nginx server:</p>
<blockquote><p>/etc/init.d/nginx restart</p></blockquote>
<div>
<h2>Mongrel Configuration:</h2>
<p>Now Go to the application directory and create a configuration for Mongrel:</p>
<blockquote><p>mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 2 -c /home/APP/production/APP/current</p></blockquote>
<p>it will create the config/mongrel_cluster.yml file; basically you do not need to edit it.</p>
<p>You can test cluster with</p>
<p>To Start:</p>
<blockquote><p>mongrel_rails cluster::start</p></blockquote>
<p>To Stop:</p>
<blockquote><p>mongrel_rails cluster::stop</p></blockquote>
<p>To Restart:</p>
<blockquote><p>mongrel_rails cluster::restart</p></blockquote>
</div>
<div>
<h2>Capistrano Configuration:</h2>
<p>Then create a configuration for Capistrano:</p>
<blockquote><p>cap –apply-to .</p></blockquote>
<p>we need to modify the generated file config/deploy.rb:</p>
<blockquote>
<pre>require 'mongrel_cluster/recipes'

#you set the APP name with the cap command
set :application, "APP"
#a path to your repository
set :repository, "svn+ssh://USERNAME@SVN_SERVER/projects/#{application}/trunk"

role :web, "SERVER"
role :app, "SERVER"
role :db, "SERVER", :primary =&gt; true

#where to deploy (copy the files) on the server; I created a special user APP for the</pre>
<pre>application (if you do not like it, replace the /home/#{application} part with your path
set :deploy_to, "/home/#{application}/production/#{application}"
set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml"
#if the server login name is different to the development computer login name; in my case</pre>
<pre>the user name is the APP nameset :user, "APP"</pre>
</blockquote>
<p>Make necessary changes to the config/database.yml file.</p></div>
<div>
<h2>Capistrano Deployment:</h2>
<p>Create the basic structure on the server:</p>
<blockquote><p>cap deploy:setup</p></blockquote>
<p>For the first deployment you can use cold deploy:</p>
<blockquote><p>cap cold_deploy</p></blockquote>
<p>After that for next deployments you have to use:</p>
<blockquote><p>cap deploy</p></blockquote>
<p>You can also run migration from capistrano with:</p>
<blockquote><p>cap deploy:migrate<sup>*</sup></p></blockquote>
<p><sup>*</sup> Note: It wont work for me, it migrating to the previous release available in the releses folder, So I suggest you manually run migration on server.</div>
<div>
<p>That’s it, your server is ready to run.</p>
<p>Hope this documentation will be helpful to you, Enjoy <img src='http://blog.bhushangahire.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</div>
<p><!--for paginate posts--></p>
<p><!--Post Meta--></div>
</div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/&amp;title=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application." rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/&amp;title=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application." rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/&amp;title=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application." rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/&amp;t=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application." rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application.+-+http://tr.im/SU8p+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/&amp;title=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application.&amp;summary=%0A%0A%0A%0A%0A%0A%0A%0AHi%20all%20as%20I%20worked%20on%20setting%20up%204%20to%205%20servers%2C%20I%20thought%20its%20better%20to%20document%20the%20stuff%20so%20that%20I%2Fdevelopers%20can%20refer%20it%2C%20So%20I%20am%20documenting%20the%20step-by-step%20process%20for%20setting%20up%20the%20slicehost%20server%20for%20rails%20application%20work%20with%20nginx%20as%20a%20web%20server%20and%20mongrel%20as%20a%20rails%20applica&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F07%2F22%2Fstep-by-step-setup-slicehost-server-fedora-for-rails-application%2F&amp;t=Step-By-Step+setup+slicehost+server+%28fedora%29+for+rails+application." rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2009/07/22/step-by-step-setup-slicehost-server-fedora-for-rails-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install and Configure FTP Server in Amazon EC2 instance</title>
		<link>http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/</link>
		<comments>http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:17:51 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[live]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[setup]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=97</guid>
		<description><![CDATA[
For many users, running FTP Sever in Amazon EC2 instance is headache at the first time. You need to experiment before being able to transfer data. The main problems are Ingress firewall in Amazon environment and NAT traversal.
Here I’m using vsftp (vsfptd) Server, which is one of the most popular and easy to configure. The [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F04%2F15%2Finstall-and-configure-ftp-server-in-amazon-ec2-instance%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>For many users, running FTP Sever in Amazon EC2 instance is headache at the first time. You need to experiment before being able to transfer data. The main problems are Ingress firewall in Amazon environment and NAT traversal.</p>
<p>Here I’m using vsftp (vsfptd) Server, which is one of the most popular and easy to configure. The instance is running from base Fedora 4 AMI but the setup should be identical to other Red Hat based distros.</p>
<p>Install vsftpd FTP server, if not installed earlier: </p>
<p><code># yum install vsfptd</code></p>
<p>Its upto you which FTP method i.e. Active or Passive you want to use. The problem with active mode is that your computer is sending a request out of port 21 when all of a sudden, the server attempts to initiate a request with your computer on port 20.  Since communication on port 21 does not imply communication on port 20, it appears as if some unauthorized host has attempted to initiate a new connection with your computer.  Kind of sounds like a hack right?  Your firewall may think so too (or your NAT router may have no idea to which computer to route the request). Active mode is not used as default method of ftp transfer in many clients these days. </p>
<p>On the other hand, as the Ingress firewall is running in AWS, from the firewall’s standpoint, to support passive mode FTP the following communication channels need to be opened:</p>
<p>FTP server’s port 21 from anywhere (Client initiates connection).<br />
FTP server’s port 21 to ports &gt; 1023 (Server responds to client’s control port).<br />
FTP server’s ports &gt; 1023 from anywhere (Client initiates data connection to random port specified by server).<br />
FTP server’s ports &gt; 1023 to remote ports &gt; 1023 (Server sends ACKs (and data) to client’s data port).</p>
<p>That second part is the problem: FTP server listens on a random port and hands that back to the client, so the client initiates a connection to a random server port, which you must allow.</p>
<p>Opening up all ports &gt; 1023 isn’t so good for security. But what you can do is allow the ports through the distributed firewall and then setup your own filtering inside your instance. Instead, you would better open a fixed number of ports (such as 1024 to 1048) and configure your FTP Server to only use that ports.</p>
<p>Check whether required ports are open or not in your EC2 security group. (if you are unaware about security group, it should be ‘defaul’ unless you created a new one). </p>
<p><code># ec2-describe-group</code></p>
<p>This command will print all ports which are currently open. If you dont find port 20,21,1024-1048 then you need to open these ports but if you dont find the command itself i.e.<br />
<code># ec2-describe-group<br />
-bash: ec2-describe-group: command not found</code></p>
<p>You need to install ec2 command line tools. You can find them <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&amp;categoryID=88" onclick="javascript:urchinTracker('/outbound/developer.amazonwebservices.com/connect/entry.jspa?externalID=351_038_categoryID=88?ref=http_//www.google.co.in/search?hl=en_client=firefox-a_rls=org.mozilla_3Aen-US_3Aofficial_q=how+to+connect+amazon+ec2+instance+with+sftp_btnG=Search_meta=_aq=o_oq=');">here</a>  and the instructions to setup/configure can be found <a href="http://docs.amazonwebservices.com/AWSEC2/2008-02-01/GettingStartedGuide/?ref=get-started" onclick="javascript:urchinTracker('/outbound/docs.amazonwebservices.com/AWSEC2/2008-02-01/GettingStartedGuide/?ref=get-started?ref=http_//www.google.co.in/search?hl=en_client=firefox-a_rls=org.mozilla_3Aen-US_3Aofficial_q=how+to+connect+amazon+ec2+instance+with+sftp_btnG=Search_meta=_aq=o_oq=');">here.</a> </p>
<p>Open the ports now: </p>
<p><code># ec2-authorize default -p 20-21<br />
# ec2-authorize default -p 1024-1048</code></p>
<p>Here, ‘default’ is the name of security group. You can also open ports for specific IPs. For ease of use, you better install ElasticFox, a firefox extension to manage EC2 stuff. you can find more about it <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609" onclick="javascript:urchinTracker('/outbound/developer.amazonwebservices.com/connect/entry.jspa?externalID=609?ref=http_//www.google.co.in/search?hl=en_client=firefox-a_rls=org.mozilla_3Aen-US_3Aofficial_q=how+to+connect+amazon+ec2+instance+with+sftp_btnG=Search_meta=_aq=o_oq=');">here.</a> </p>
<p>At this moment, you can start your FTP server and if you try to connect it, the process will get failed. By checking logs, you should find something like:</p>
<p><code>Status: Connected<br />
Status: Retrieving directory listing...<br />
Command: PWD<br />
Response: 257 "/" is current directory.<br />
Command: TYPE A<br />
Response: 200 Type set to A<br />
Command: PASV<br />
Response: 227 Entering Passive Mode (216,182,238,73,129,75).<br />
Command: LIST<br />
Error: Transfer channel can't be opened. Reason: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.<br />
Error: Could not retrieve directory listing<br />
</code></p>
<p>Time to configure vsftpd.conf file:<br />
<code># vi /etc/vsftpd/vsftpd.conf<br />
---Add following lines at the end of file---<br />
	pasv_enable=YES<br />
	pasv_min_port=1024<br />
	pasv_max_port=1048<br />
	pasv_address=<strong>Public IP of your instance</strong></code></p>
<p>Put public IP of your EC2 instance and then Save the file. Now restart the server: </p>
<p><code># /etc/init.d/vsftpd restart</code></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/&amp;title=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/&amp;title=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/&amp;title=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/&amp;t=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance+-+http://tr.im/SU8v+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/&amp;title=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance&amp;summary=For%20many%20users%2C%20running%20FTP%20Sever%20in%20Amazon%20EC2%20instance%20is%20headache%20at%20the%20first%20time.%20You%20need%20to%20experiment%20before%20being%20able%20to%20transfer%20data.%20The%20main%20problems%20are%20Ingress%20firewall%20in%20Amazon%20environment%20and%20NAT%20traversal.%0AHere%20I%E2%80%99m%20using%20vsftp%20%28vsfptd%29%20Server%2C%20which%20is%20one%20of%20the%20most%20popular%20&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F04%2F15%2Finstall-and-configure-ftp-server-in-amazon-ec2-instance%2F&amp;t=Install+and+Configure+FTP+Server+in+Amazon+EC2+instance" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2009/04/15/install-and-configure-ftp-server-in-amazon-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a new remote git repository</title>
		<link>http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/</link>
		<comments>http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 08:41:31 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git repo]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.bhushangahire.net/?p=50</guid>
		<description><![CDATA[

For the impatient
Set up the new bare repo on the server:
$ ssh myserver.com
Welcome to myserver.com!
$ mkdir /var/git/myapp.git &#38;&#38; cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
$ exit
Bye!

Add the remote repository and push:
$ cd ~/Sites/myapp
$ git remote add origin ssh://myserver.com/var/git/myapp.git
$ git push origin master
Set the local master branch to track the remote branch.
Read further [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F02%2F19%2Fsetting-up-a-new-remote-git-repository%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<div class="content">
<h2>For the impatient</h2>
<p>Set up the new bare repo on the server:</p>
<pre><span class="keywords">$ ssh myserver.com</span>
Welcome to myserver.com!
<span class="keywords">$ mkdir /var/git/myapp.git &amp;&amp; cd /var/git/myapp.git</span>
<span class="keywords">$ git --bare init</span>
Initialized empty Git repository in /var/git/myapp.git
<span class="keywords">$ exit</span>
Bye!
</pre>
<p>Add the remote repository and push:</p>
<pre><span class="keywords">$ cd ~/Sites/myapp</span>
<span class="keywords">$ git remote add origin ssh://myserver.com/var/git/myapp.git</span>
<span class="keywords">$ git push origin master</span></pre>
<p>Set the local master branch to track the remote branch.</p>
<p>Read further for a step-by-step explanation of what’s going on.</p>
<h2>Pre-flight sanity check</h2>
<p>Setting up a remote repository is fairly simple but somewhat confusing at first. Firstly, let’s check out what remote repositories are being tracked in our git repo:</p>
<pre><span class="keywords">$ cd ~/Sites/myapp</span>
<span class="keywords">$ git remote</span></pre>
<p>None. Looking good. Now let’s list all the branches:</p>
<pre><span class="keywords">$ git branch -a</span>
* master
</pre>
<p>Just one branch, the master branch. Let’s have a look at <code>.git/config</code>:</p>
<pre><span class="keywords">$ cat .git/config</span>
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true</pre>
<p>A pretty bare-minimum config file.</p>
<h2>Creating the bare remote repository</h2>
<p>Before we can push our local master branch to a remote repository we need to create the remote repository. To do this we’ll ssh in and create it on the server:</p>
<pre>
<span class="keywords">$ ssh myserver.com</span>
Welcome to myserver.com!
<span class="keywords">$ cd /var/git</span>
<span class="keywords">$ mkdir myapp.git</span>
<span class="keywords">$ cd myapp.git</span>
<span class="keywords">$ git --bare init</span>
Initialized empty Git repository in /var/git/myapp.git
<span class="keywords">$ exit</span>
Bye!
</pre>
<p>A short aside about what git means by <em>bare</em>: A default git repository assumes that you’ll be using it as your working directory, so git stores the actual bare repository files in a <code>.git</code> directory alongside all the project files. Remote repositories don’t need copies of the files on the filesystem unlike working copies, all they need are the deltas and binary what-nots of the repository itself. This is what “bare” means to git. Just the repository itself.</p>
<h2>Adding the remote repository to our local git repository configuration</h2>
<p>Now that we’ve created the remote repository we’ll add it to our local repository as a remote server called “origin” using <code>git remote add</code>, which is just a nicer way of updating our config file for us:</p>
<pre>
<span class="keywords">$ git remote add origin ssh://myserver.com/var/git/myapp.git</span></pre>
<p>Let’s see what it added to the config file:</p>
<pre>[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  url = ssh://myserver.com/var/git/myapp.git
  fetch = +refs/heads/*:refs/remotes/origin/*</pre>
<p>We now have a remote repository “origin” that will fetch all of it’s <code>refs/heads/*</code> branches and store them in our local repo in <code>refs/remotes/origin/*</code> when a <code>git fetch</code> is performed.</p>
<h2>Pushing to the remote repository</h2>
<p>The time has come to push our local master branch to the origin’s master branch. We do that using the <code>git push </code> command.</p>
<pre>
<span class="keywords">$ git push origin master</span>
updating 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   b379203bc187c2926f44a71eca3f901321ea42c6
 Also local refs/remotes/origin/master
Generating pack...
Done counting 1374 objects.
Deltifying 1374 objects...
 100% (1374/1374) done
Writing 1374 objects...
 100% (1374/1374) done
Total 1374 (delta 89), reused 0 (delta 0)
refs/heads/master: 0000000000000000000000000000000000000000 -&gt; b379203bc187c2926f44a71eca3f901321ea42c6
</pre>
<p>and that’s all, folks. Further pushes can be done by repeating the <code>git push</code> command.</p>
<p>Now you can tell your co-conspirators to:</p>
<pre><span class="keywords">$ git clone ssh://myserver.com/var/git/myapp.git</span></pre>
<p>and push and pull to your heart’s content.</p>
<h2>Track the remote branch</h2>
<p>You can specify the default remote repository for pushing and pulling using git-branch’s track option. You’d normally do this by specifying the <code>--track</code> option when creating your local master branch, but as it already exists we’ll just update the config manually like so:</p>
<pre>[branch "master"]
  remote = origin
  merge = refs/heads/master
</pre>
<p>Now you can simply <code>git push</code> and <code>git pull</code>.</p>
<h2>Sharing the remote repository with the world</h2>
<p>If you want to set it up as a public repository be sure to check out the Git manual’s chapter on <a href="http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#public-repositories">public git repositories</a>.</p>
<h2>Working with remote repository branches</h2>
<p><code>git remote show</code> is used to inspect a remote repository. It goes and checks the remote repository to see what branches have been added and removed since the last <code>git fetch</code>.</p>
<p>Doing a <code>git remote show</code> at the moment only shows us the remote repo’s master branch which we pushed earlier:</p>
<pre><span class="keywords">$ git remote show origin</span>
* remote origin
  URL: ssh://myserver.com/var/git/myapp.git
  Tracked remote branches
    master</pre>
<p>Let’s create a new local git repository and push to a new branch on the remote repository. We can then use <code>git remote show</code> to see the new remote branch, <code>git fetch</code> to mirror it into our local repo and <code>git checkout --track -b</code> to create a local branch to do some work on it.</p>
<p>We’ll start by creating a new local repo and pushing some code to a new branch in the remote repository.</p>
<pre><span class="keywords">$ mkdir /tmp/other-git</span>
<span class="keywords">$ cd /tmp/other-git</span>
<span class="keywords">$ git init</span>
Initialized empty Git repository in /tmp/other-git
<span class="keywords">$ git remote add origin ssh://myserver.com/var/git/myapp.git</span>
<span class="keywords">$ echo "Rails 2... woo" &gt; afile</span>
<span class="keywords">$ git add afile</span>
<span class="keywords">$ git commit -m "Added afile" </span>
Created initial commit 0ac9a74: Added afile
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 something
<span class="keywords">$ git push origin master:refs/heads/dev/rails-2</span>
updating 'refs/heads/rails-2' using 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   0ac9a7457f4b21c9e058d4c54d262584bf35e528
 Also local refs/remotes/origin/rails-2
Generating pack...
Done counting 3 objects.
Deltifying 3 objects...
 100% (3/3) done
Writing 3 objects...
 100% (3/3) done
Total 3 (delta 0), reused 0 (delta 0)
Unpacking 3 objects...
 100% (3/3) done
refs/heads/rails-2: 0000000000000000000000000000000000000000 -&gt; 0ac9a7457f4b21c9e058d4c54d262584bf35e528
</pre>
<p>Now let’s switch back to our old git repository and see if it detects the new branch on the remote repository:</p>
<pre><span class="keywords">$ git remote show origin</span>
* remote origin
  URL: ssh://myserver.com/var/git/myapp.git
  New remote branches (next fetch will store in remotes/origin)
    dev/rails-2
  Tracked remote branches
    master
</pre>
<p>Let’s update our mirror of the remote repository by doing a <code>git fetch</code>:</p>
<pre><span class="keywords">$ git fetch</span>
* refs/remotes/origin/master: storing branch 'dev/rails-2' of ssh://myserver.com/var/git/myapp.git
  commit: b379203
<span class="keywords">$ git remote show origin</span>
* remote origin
  URL: ssh://myserver.com/var/git/myapp.git
  Tracked remote branches
    master
    dev/rails-2</pre>
<p>We should now be able to see this in a our list of remote branches:</p>
<pre><span class="keywords">$ git branch -a</span>
* master
origin/dev/rails-2
origin/master</pre>
<p>If we then wanted to do some work on this remote <code>dev/rails-2</code> branch we create a new local tracking branch like so:</p>
<pre><span class="keywords">$ git checkout --track -b dev/rails-2 origin/dev/rails-2</span>
Branch dev/rails-2 set up to track remote branch refs/remotes/origin/dev/rails-2.
Switched to a new branch "dev/rails-2"
</pre>
<p>To keep up-to-date and push new changesets we simply use <code>git push</code> and <code>git pull</code> when working in the local <code>dev/rails-2</code> branch.</p>
<p>Also notice, like we manually changed for master, <code>.git/config</code> has a new entry for this new tracking branch:</p>
<pre>[branch "dev/rails-2"]
  remote = origin
  merge = refs/heads/dev/rails-2
</pre>
</div>
<div class="content">Reference from <a href="http://toolmantim.com/articles/setting_up_a_new_remote_git_repository">http://toolmantim.com/articles/setting_up_a_new_remote_git_repository</a></div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/&amp;title=Setting+up+a+new+remote+git+repository" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/&amp;title=Setting+up+a+new+remote+git+repository" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/&amp;title=Setting+up+a+new+remote+git+repository" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/&amp;t=Setting+up+a+new+remote+git+repository" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Setting+up+a+new+remote+git+repository+-+http://tr.im/SURM+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/&amp;title=Setting+up+a+new+remote+git+repository&amp;summary=%0AFor%20the%20impatient%0ASet%20up%20the%20new%20bare%20repo%20on%20the%20server%3A%0A%24%20ssh%20myserver.com%0AWelcome%20to%20myserver.com%21%0A%24%20mkdir%20%2Fvar%2Fgit%2Fmyapp.git%20%26amp%3B%26amp%3B%20cd%20%2Fvar%2Fgit%2Fmyapp.git%0A%24%20git%20--bare%20init%0AInitialized%20empty%20Git%20repository%20in%20%2Fvar%2Fgit%2Fmyapp.git%0A%24%20exit%0ABye%21%0A%0AAdd%20the%20remote%20repository%20and%20push%3A%0A%24%20cd%20%7E%2FSites%2Fmy&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2009%2F02%2F19%2Fsetting-up-a-new-remote-git-repository%2F&amp;t=Setting+up+a+new+remote+git+repository" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2009/02/19/setting-up-a-new-remote-git-repository/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>god Server process monitoring and notifying tool written in ruby</title>
		<link>http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/</link>
		<comments>http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 05:55:30 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/</guid>
		<description><![CDATA[
Progress on god is moving along as quick as ever. Most interestingly you&#8217;ll find several useful new command line functions:

god status prints out the status of each Watch
god log shows realtime logs for a specific Watch (even if you don&#8217;t have god logging to file)
god load loads or reloads a config file into a running [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2008%2F03%2F18%2Fgod-server-process-monitoring-and-notifying-tool-written-in-ruby%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p class="article">Progress on god is moving along as quick as ever. Most interestingly you&#8217;ll find several useful new command line functions:</p>
<ul>
<li><code>god status</code> prints out the status of each Watch</li>
<li><code>god log</code> shows realtime logs for a specific Watch (even if you don&#8217;t have god logging to file)</li>
<li><code>god load</code> loads or reloads a config file into a running god instance</li>
<li><code>god terminate</code> stops all Watches and then stops god (useful when testing your setup)</li>
</ul>
<p>The logging system has been beefed up with proper timestamps and criticality levels. Log messages are more complete overall. You can also get the STDOUT/STDERR of a god-daemonized process written to a log file by specify &#8216;w.log = <log>&#8216; in your Watch config.</log></p>
<p>If you let god daemonize your process for you, there&#8217;s no need to provide a stop command. A default killing lambda will take care of gracefully (or not so gracefully if necessary) stopping your god-daemonized process.</p>
<p>The validity of your config file is checked better than previous versions to point you to the problem area of your config.</p>
<p>The bug that prevented group control from working has been fixed so you can now start/stop/etc groups of Watches.</p>
<p>Updated documentation is now available on the website:</p>
<p><a href="http://god.rubyforge.org/">http://god.rubyforge.org/</a></p>
<p>WHAT IS GOD?</p>
<p>God is an easy to configure, easy to extend monitoring framework written in Ruby.</p>
<p>Keeping your server processes and tasks running should be a simple part of your deployment process. God aims to be the simplest, most powerful monitoring application available.</p>
<p>INSTALL</p>
<p>sudo gem install god</p>
<p>FEATURES</p>
<ul>
<li>Config file is written in Ruby</li>
<li>Easily write your own custom conditions in Ruby</li>
<li>Supports both poll and event based conditions</li>
<li>Different poll conditions can have different intervals</li>
<li>Easily control non-daemonized processes</li>
</ul>
<p>EXAMPLE</p>
<p>The easiest way to understand how god will make your life better is by looking at a sample config file. The following configuration file is to keep the mongrels running:</p>
<table class="CodeRay">
<tr>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="c"># file:      application_name.god</span><tt>
</tt><span class="c"># run with:  god -c /path/to/application_name.god</span><tt>
</tt><span class="c"># </span><tt>
</tt><span class="c"># This is the actual config file used to keep the mongrels of</span><tt>
</tt><span class="c"># application.com running.</span><tt>
</tt><span class="co">RAILS_ROOT</span> = <span class="s"><span class="dl">"</span><span class="k">/var/www/application_name/current</span><span class="dl">"</span></span><tt>
</tt><span class="s"><span class="dl">%w{</span><span class="k">8001 8002 8003</span><span class="dl">}</span></span>.each <span class="r">do</span> |port|<tt>
</tt>  <span class="co">God</span>.watch <span class="r">do</span> |w|<tt>
</tt>    w.name = <span class="s"><span class="dl">"</span><span class="k">application_name-mongrel-</span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="dl">"</span></span><tt>
</tt>    w.interval = <span class="i">30</span>.seconds <span class="c"># default</span><tt>
</tt>    w.start = <span class="s"><span class="dl">"</span><span class="k">mongrel_rails cluster::start --only </span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="k"> </span><span class="ch">\<tt>
</tt></span><span class="k">      -C </span><span class="il"><span class="dl">#{</span><span class="co">RAILS_ROOT</span><span class="dl">}</span></span><span class="k">/config/mongrel_cluster.yml</span><span class="dl">"</span></span><tt>
</tt>    w.stop = <span class="s"><span class="dl">"</span><span class="k">mongrel_rails cluster::stop --only </span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="k"> </span><span class="ch">\<tt>
</tt></span><span class="k">      -C </span><span class="il"><span class="dl">#{</span><span class="co">RAILS_ROOT</span><span class="dl">}</span></span><span class="k">/config/mongrel_cluster.yml</span><span class="dl">"</span></span><tt>
</tt>    w.grace = <span class="i">10</span>.seconds<tt>
</tt>    w.pid_file = <span class="co">File</span>.join(<span class="co">RAILS_ROOT</span>, <span class="s"><span class="dl">"</span><span class="k">log/mongrel.</span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="k">.pid</span><span class="dl">"</span></span>)    <tt>
</tt>    w.behavior(<span class="sy">:clean_pid_file</span>)<tt>
</tt>    w.start_if <span class="r">do</span> |start|<tt>
</tt>      start.condition(<span class="sy">:process_running</span>) <span class="r">do</span> |c|<tt>
</tt>        c.interval = <span class="i">5</span>.seconds<tt>
</tt>        c.running = <span class="pc">false</span><tt>
</tt>      <span class="r">end</span><tt>
</tt>    <span class="r">end</span> <tt>
</tt>    w.restart_if <span class="r">do</span> |restart|<tt>
</tt>      restart.condition(<span class="sy">:memory_usage</span>) <span class="r">do</span> |c|<tt>
</tt>        c.above = <span class="i">150</span>.megabytes<tt>
</tt>        c.times = [<span class="i">3</span>, <span class="i">5</span>] <span class="c"># 3 out of 5 intervals</span><tt>
</tt>      <span class="r">end</span>    <tt>
</tt>      restart.condition(<span class="sy">:cpu_usage</span>) <span class="r">do</span> |c|<tt>
</tt>        c.above = <span class="i">50</span>.percent<tt>
</tt>        c.times = <span class="i">5</span><tt>
</tt>      <span class="r">end</span><tt>
</tt>    <span class="r">end</span><tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<p>Configuration for nginx and mysql<br />
I found a gr8 post for sample configuration <a href="http://www.thewebfellas.com/blog/2008/2/12/a-simple-faith-monitoring-by-god">here</a></p>
<p>DOCS</p>
<p>Detailed documentation is available at <a href="http://god.rubyforge.org/">http://god.rubyforge.org/</a></p>
<p><a href="http://rubyisawesome.com/2007/9/10/god-0-4-0-released">Original Source&#8230;</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/&amp;title=god+Server+process+monitoring+and+notifying+tool+written+in+ruby" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/&amp;title=god+Server+process+monitoring+and+notifying+tool+written+in+ruby" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/&amp;title=god+Server+process+monitoring+and+notifying+tool+written+in+ruby" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/&amp;t=god+Server+process+monitoring+and+notifying+tool+written+in+ruby" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=god+Server+process+monitoring+and+notifying+tool+written+in+ruby+-+http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/&amp;title=god+Server+process+monitoring+and+notifying+tool+written+in+ruby&amp;summary=Progress%20on%20god%20is%20moving%20along%20as%20quick%20as%20ever.%20Most%20interestingly%20you%27ll%20find%20several%20useful%20new%20command%20line%20functions%3A%0A%0A%0A%09god%20status%20prints%20out%20the%20status%20of%20each%20Watch%0A%09god%20log%20shows%20realtime%20logs%20for%20a%20specific%20Watch%20%28even%20if%20you%20don%27t%20have%20god%20logging%20to%20file%29%0A%09god%20load%20loads%20or%20reloads%20a%20co&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2008%2F03%2F18%2Fgod-server-process-monitoring-and-notifying-tool-written-in-ruby%2F&amp;t=god+Server+process+monitoring+and+notifying+tool+written+in+ruby" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2008/03/18/god-server-process-monitoring-and-notifying-tool-written-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shorcuts for kill and restart rails server</title>
		<link>http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/</link>
		<comments>http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 14:43:46 +0000</pubDate>
		<dc:creator>Bhushan Ahire</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.bhushangahire.net/?p=27</guid>
		<description><![CDATA[
More lovely alias commands&#8230; this time to kill/restart Rail&#8217;s script/server from any Terminal session or login on your box&#8230; (as long as your the same user).
alias dierails='ps -a&#124;grep "/usr/local/bin/ruby script/server"&#124;grep -v "grep /usr"&#124;cut -d " " -f1&#124;xargs -n 1 kill -KILL $1'
alias resetrails='ps -a&#124;grep "/usr/local/bin/ruby script/server"&#124;grep -v "grep /usr"&#124;cut -d " " -f1&#124;xargs -n 1 [...]]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.bhushangahire.net%2F2008%2F01%2F22%2Fshorcuts-for-kill-and-restart-rails-server%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p class="post-body">More lovely alias commands&#8230; this time to kill/restart Rail&#8217;s script/server from any Terminal session or login on your box&#8230; (as long as your the same user).</p>
<pre style="overflow: auto;"><span class="keyword">alias</span> <span class="ident">dierails</span><span class="punct">='</span><span class="string">ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL $1</span><span class="punct">'</span>
<span class="keyword">alias</span> <span class="ident">resetrails</span><span class="punct">='</span><span class="string">ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -HUP $1</span><span class="punct">'</span></pre>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/&amp;title=Shorcuts+for+kill+and+restart+rails+server" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/&amp;title=Shorcuts+for+kill+and+restart+rails+server" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/&amp;title=Shorcuts+for+kill+and+restart+rails+server" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/&amp;t=Shorcuts+for+kill+and+restart+rails+server" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Shorcuts+for+kill+and+restart+rails+server+-+http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/+(via+@bhushangahire)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/&amp;title=Shorcuts+for+kill+and+restart+rails+server&amp;summary=More%20lovely%20alias%20commands...%20this%20time%20to%20kill%2Frestart%20Rail%27s%20script%2Fserver%20from%20any%20Terminal%20session%20or%20login%20on%20your%20box...%20%28as%20long%20as%20your%20the%20same%20user%29.%0A%0Aalias%20dierails%3D%27ps%20-a%7Cgrep%20%22%2Fusr%2Flocal%2Fbin%2Fruby%20script%2Fserver%22%7Cgrep%20-v%20%22grep%20%2Fusr%22%7Ccut%20-d%20%22%20%22%20-f1%7Cxargs%20-n%201%20kill%20-KILL%20%241%27%0Aalias%20resetrail&amp;source=eXpand yOur cReativity" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fblog.bhushangahire.net%2F2008%2F01%2F22%2Fshorcuts-for-kill-and-restart-rails-server%2F&amp;t=Shorcuts+for+kill+and+restart+rails+server" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.bhushangahire.net/2008/01/22/shorcuts-for-kill-and-restart-rails-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
