<?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>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India &#187; pound</title>
	<atom:link href="http://vinsol.com/blog/category/pound/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 26 Jul 2010 08:37:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running Rails Application on https with pound</title>
		<link>http://vinsol.com/blog/2007/09/13/running-rails-application-on-https-with-pound/</link>
		<comments>http://vinsol.com/blog/2007/09/13/running-rails-application-on-https-with-pound/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 13:58:56 +0000</pubDate>
		<dc:creator>Akhil Bansal</dc:creator>
				<category><![CDATA[RubyonRails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[mongrel_cluster]]></category>
		<category><![CDATA[pound]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://webonrails.com/2007/09/13/running-rails-application-on-https-with-pound/</guid>
		<description><![CDATA[Hours ago, I posted about, &#8220;How to deploy rails application with pound as a Balancer&#8221;.
Lets run rails application on https with pound. For that your machine should have:
* Pound installed with ssl support
* Pound and mongrels running
Now, First of all we need a ssl certificate, that can be generate by issuing &#8220;openssl req -x509 -newkey [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Hours ago, I posted about, <a href="http://webonrails.com/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/" target = "_blank">&#8220;How to deploy rails application with pound as a Balancer&#8221;</a>.</p>
<p>Lets run rails application on https with pound. For that your machine should have:</p>
<p>* Pound installed with ssl support<br />
* Pound and mongrels running</p>
<p>Now, First of all we need a ssl certificate, that can be generate by issuing <strong>&#8220;openssl req -x509 -newkey rsa:1024 -keyout mydomain.pem  -out mydomain.pem -days 365 -nodes&#8221;</strong> . Give all the information it asks. Now copy mydomain.pem to /etc/pound/ directory(I am assuming that your pound.cfg file resides in /etc/pound/). Now put the following code in pound configuration file(/etc/pound/pound.cfg):</p>
<textarea name="code" class="c++" cols="50" rows="10">
ListenHTTPS
  Address 0.0.0.0
  Port    443
  Cert    "/etc/pound/mydomain.pem" 
  # pass along https hint
  AddHeader "X-Forwarded-Proto: https" 
  HeadRemove "X-Forwarded-Proto" 

Service
    URL "/(images|stylesheets|javascripts)/"
    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
</textarea>
<p>I am assuming that your mongrels are running at ports 8000, 8001, 8002, apache running at 8080 and pound is listening ports 443 &#038; 80.<br />
Restart pound, and you are done. With this configuration all requests for dynamic content at port 443(https) will get redirected to mongrels and requests for static content will get redirected to apache.</p>
<p>You may want to check if the request is https or not before serving the content. That can be done by adding a before_filter (defined below) in application.rb  :</p>
<textarea name="code" class="ruby" cols="50" rows="10">
def confirm_ssl
  unless request.ssl?
    request.env["HTTPS"] = "on"
    redirect_to "/"
    return
  end
end
</textarea>
<p>By adding this method as before_filter in application.rb your application will check for https, if the request is not of type https it will redirect to an https request.
</p>
]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2007/09/13/running-rails-application-on-https-with-pound/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying rails application with pound as a Balancer</title>
		<link>http://vinsol.com/blog/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/</link>
		<comments>http://vinsol.com/blog/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[RubyonRails]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mongrel_cluster]]></category>
		<category><![CDATA[pound]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[web development]]></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 [...]


Related posts:<ol><li><a href='http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/' rel='bookmark' title='Permanent Link: 11 Things to Consider Before Deploying Your Ruby on  Rails Application'>11 Things to Consider Before Deploying Your Ruby on  Rails Application</a> <small>At VinSol, we have been developing and deploying Rails applications...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></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>
<p><textarea name="code" class="c++" cols="50" rows="10"></p>
<p>User &#8220;pound&#8221;<br />
Group &#8220;pound&#8221;</p>
<p>ListenHTTP<br />
  Address 0.0.0.0<br />
  Port 80<br />
  Service<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8000<br />
    End<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8001<br />
    End<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8002<br />
    End<br />
  End<br />
End<br />
</textarea></p>
<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>
<p><textarea name="code" class="c++" cols="50" rows="10"></p>
<p>User &#8220;pound&#8221;<br />
Group &#8220;pound&#8221;</p>
<p>ListenHTTP<br />
  Address 0.0.0.0<br />
  Port 80<br />
  Service<br />
      URL &#8220;/(images|stylesheets|flash|javascripts)/&#8221;<br />
      BackEnd<br />
          Address 127.0.0.1<br />
          Port    8080<br />
      End<br />
      Session<br />
          Type    BASIC<br />
          TTL     300<br />
      End<br />
  End<br />
  Service<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8000<br />
    End<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8001<br />
    End<br />
    BackEnd<br />
      Address 127.0.0.1<br />
      Port 8002<br />
    End<br />
  End<br />
End<br />
</textarea></p>
<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>
<p><textarea name="code" class="c++" cols="50" rows="10"><br />
<VirtualHost *:8080><br />
  ServerName example.com<br />
  ServerAlias www.example.com<br />
  DocumentRoot /var/www/html/example.com/public<br />
  <Directory "/var/www/html/example.com/public" ><br />
    Options FollowSymLinks<br />
    AllowOverride None<br />
    Order allow,deny<br />
    Allow from all<br />
  </Directory></p>
<p>  RewriteEngine On</p>
<p>  # For static files it&#8217;s good to avoid hitting your mongrel process<br />
  # so let apache knows it should serve it directly<br />
  # for a rails application it means, files in images / stylesheets / javascripts<br />
  RewriteRule &#8220;^/(images|stylesheets|flash|javascripts)/?(.*)&#8221; &#8220;$0&#8243; [L]</p>
<p></VirtualHost><br />
</textarea></p>
<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>


<p>Related posts:<ol><li><a href='http://vinsol.com/blog/2009/11/16/11-things-to-consider-before-deploying-your-rails-application/' rel='bookmark' title='Permanent Link: 11 Things to Consider Before Deploying Your Ruby on  Rails Application'>11 Things to Consider Before Deploying Your Ruby on  Rails Application</a> <small>At VinSol, we have been developing and deploying Rails applications...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2007/09/13/deploying-rails-application-with-pound-as-a-balancer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
