<?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>Schadenfreude &#187; mongrel</title>
	<atom:link href="http://www.ralree.com/tag/mongrel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Thu, 09 Feb 2012 01:49:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Successful Settings for Apache forwarding to Mongrel</title>
		<link>http://www.ralree.com/2006/06/15/successful-settings-for-apache-forwarding-to-mongrel/</link>
		<comments>http://www.ralree.com/2006/06/15/successful-settings-for-apache-forwarding-to-mongrel/#comments</comments>
		<pubDate>Thu, 15 Jun 2006 14:14:37 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/successful-settings-for-apache-forwarding-to-mongrel</guid>
		<description><![CDATA[So, after a day of working on it, I finally fixed the problems I was having. I wanted to have Apache forward all traffic hitting a path to a mongrel server running in a rails application. So, I did as bish0p suggested, and set up the rails app to accept this behavior. First, I put this at the bottom of my environment.rb: ActionController::AbstractRequest.relative_url_root = "/MyRailsApp" This make it so all the urls in the Rails app are prepended with /MyRailsApp. [...]]]></description>
			<content:encoded><![CDATA[<p>So, after a day of working on it, I finally fixed the problems I was having.  </p>
<p>I wanted to have Apache forward all traffic hitting a path to a mongrel server running in a rails application.  So, I did as bish0p suggested, and set up the rails app to accept this behavior.  First, I put this at the bottom of my <strong>environment.rb</strong>:</p>
<pre><code>
ActionController::AbstractRequest.relative_url_root = "/MyRailsApp"
</code></pre>
<p>This make it so all the urls in the Rails app are prepended with /MyRailsApp.  Without this, you&#8217;ll get renders that don&#8217;t have stylsheets, javascripts, or anything else that resides in the <em>public</em> directory of rails.</p>
<p>Second, I made a ProxyPass entry in the Apache configuration:</p>
<pre><code>
Redirect /MyRailsApp http://www.example.com/MyRailsApp/
ProxyPass /MyRailsApp/ http://localhost:6402/MyRailsApp/
ProxyPassReverse /MyRailsApp/ http://localhost:6402/MyRailsApp/
</code></pre>
<p>This allows all traffic that goes to /MyRailsApp on the server to be redirected to my mongrel server, which is running on port 6402 (This port does <strong>not</strong> have to be unfirewalled since all the requests are done locally by Apache).</p>
<p>Next, I have to further fix the problem of mongrel not being able to find things in public by making a symlink in public to itself.  Make sure not to just do a link to ../public.  Here&#8217;s an example:</p>
<pre><code>
cd public
mkdir MyRailsApp # This has to be whatever you used in your Apache configuration.
cd MyRailsApp
ln -s ../* . # Link to everything above.
rm MyRailsApp # Get rid of the recursive link.
</code></pre>
<p>Now, just configure your db, application, etc. and start the mongrel server from the root of the application.</p>
<pre><code>
mongrel_rails start -p 6402 -e production -d
</code></pre>
<p>And voila!  You have a working ProxyPass connection from Apache to Mongrel.</p>
<h3>Update:</h3>
<p>Thanks to <a href="http://www.apacheweek.com/features/reverseproxies">this article</a>, I now have mod_deflate running!  It was very easy to install:</p>
<pre><code>
apxs -c -i mod_deflate.c # As Root
</code></pre>
<p>This will install it to your apache installation&#8217;s modules directory.  Now, just add some lines in your config:</p>
<pre><code>
Redirect /MyRailsApp http://www.example.com/MyRailsApp/
ProxyPass /MyRailsApp/ http://localhost:6402/MyRailsApp/
&lt;Location /MyRailsApp&gt;
  ProxyPassReverse /MyRailsApp
  SetOutputFilter INFLATE;proxy-html;DEFLATE
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
&lt;/Location&gt;
</code></pre>
<p>Congratulations, you&#8217;re now deflating your HTML/XML/CSS/JS/PlainText files!  This works on all modern browsers (yes, even Lynx), and <strong>greatly</strong> reduces the size of the files sent.  Here&#8217;s a summary:</p>
<p><strong>Before:</strong> <br/><br />
14.4K:  172.65 seconds <br/><br />
28.8K:  86.32 seconds <br/><br />
33.6K:  73.99 seconds <br/><br />
56K:  44.40 seconds <br/><br />
ISDN 128K:  13.60 seconds <br/><br />
T1 1.44Mbps:  1.18 seconds <br/></p>
<p><strong>After:</strong> <br/><br />
14.4K:  52.27 seconds <br/><br />
28.8K:  26.13 seconds <br/><br />
33.6K:  22.40 seconds <br/><br />
56K:  13.44 seconds <br/><br />
ISDN 128K:  4.12 seconds <br/><br />
T1 1.44Mbps:  0.36 seconds <br/></p>
<p><strong>Roughly <em>3 times as fast</em></strong>!!</p>
<p>Also, it may be possible to leave off a lot of the junk here.  I might have to streamline the configuration some in the following days.  If I&#8217;m right, you won&#8217;t even need the <strong>ActionController</strong> line anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/06/15/successful-settings-for-apache-forwarding-to-mongrel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Collaboa Trunk Install</title>
		<link>http://www.ralree.com/2006/06/14/collaboa-trunk-install/</link>
		<comments>http://www.ralree.com/2006/06/14/collaboa-trunk-install/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 03:54:58 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[collaboa]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/collaboa-trunk-install</guid>
		<description><![CDATA[Well, I guess I might as well finish the job as much as I can before bed. I&#8217;m going to install Collaboa. Here&#8217;s the beginning: Get rails and mongrel, along with all the deps: sudo gem install rails mongrel redcloth syntax sqlite3-ruby xhtmldiff Now, get ruby-mysql, which requires some junk on FC5: sudo yum install mysql mysql-devel sudo gem install mysql -- --with-mysql-config Now, get the trunk: svn co http://svn.collaboa.org/svn/collaboa/trunk/ collaboa --username=anon --password=anon I&#8217;m going to use SQLLite for this [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I guess I might as well finish the job as much as I can before bed.  I&#8217;m going to install Collaboa.  Here&#8217;s the beginning:</p>
<p>Get rails and mongrel, along with all the deps:</p>
<pre><code>
sudo gem install rails mongrel redcloth syntax sqlite3-ruby xhtmldiff
</code></pre>
<p>Now, get ruby-mysql, which requires some junk on FC5:</p>
<pre><code>
sudo yum install mysql mysql-devel
sudo gem install mysql -- --with-mysql-config
</code></pre>
<p>Now, get the trunk:</p>
<pre><code>
svn co http://svn.collaboa.org/svn/collaboa/trunk/ collaboa --username=anon --password=anon
</code></pre>
<p>I&#8217;m going to use SQLLite for this project.  I have to make the database:</p>
<pre><code>
touch db/pdn.db
</code></pre>
<p>Here&#8217;s my database.yml:</p>
<pre><code>
production:
  adapter: sqlite3
  dbfile: db/pdn.db
</code></pre>
<p>Now, I have to tell it where my repositories are (<strong>config/repository.yml</strong>):</p>
<pre><code>
production:
  repos_path: /path/to/repos/hank
</code></pre>
<p>Now that the database and repository files are setup, I have to import the schema and default settings:</p>
<pre><code>
RAILS_ENV="production" rake db_schema_import
RAILS_ENV="production" ruby db/default_content.rb
</code></pre>
<p>Now I finally sync the repository with the database:</p>
<pre><code>
./script/repository_syncer
</code></pre>
<p>Time to start mongrel!</p>
<pre><code>
mongrel_rails start -p 3010
</code></pre>
<p>Now, I redirect the apache server to mongrel when /browse is accessed (I&#8217;m running mongrel on port 3010)(bottom of <strong>conf.d/svn.conf</strong>):</p>
<pre><code>
Redirect /browse  http://example.com/browse
ProxyPass /browse/ http://localhost:3010/browse/
ProxyPassReverse /browse/ http://localhost:3010/browse/
</code></pre>
<h3>NOTEs:</h3>
<ul>
<li>Make sure that <strong>BOTH YOUR PROXYPASS LINES HAVE A FINAL / AT THE END OF EACH ARGUMENT</strong>.  This will solve the <em>redirection limit</em> errors.</li>
<li>Make a symbolic link in <strong>public</strong> to itself, and call it whatever you named the proxypass (in this example, <strong>browse</strong>).  This will stop the no-images/stylesheets madness.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/06/14/collaboa-trunk-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongrel/WEBrick Forwarding in Apache</title>
		<link>http://www.ralree.com/2006/06/14/mongrel-webrick-forwarding-in-apache/</link>
		<comments>http://www.ralree.com/2006/06/14/mongrel-webrick-forwarding-in-apache/#comments</comments>
		<pubDate>Wed, 14 Jun 2006 02:55:48 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mongrel]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/mongrel-webrick-forwarding-in-apache</guid>
		<description><![CDATA[This will let you redirect an apache request to a local mongrel or webrick server. Very handy, yet maybe some logging of the used ports would be good at some point. &#60;VirtualHost collaboa.example.com:80&#62; Servername collaboa.example.com CustomLog /www/collaboa/logs/access.log combined ErrorLog /www/collaboa/logs/error.log ProxyPass / http://127.0.0.1:3005/ ProxyPassReverse / http://127.0.0.1:3005/ &#60;/VirtualHost&#62;]]></description>
			<content:encoded><![CDATA[<p>This will let you redirect an apache request to a local mongrel or webrick server.  Very handy, yet maybe some logging of the used ports would be good at some point.</p>
<pre><code>
&lt;VirtualHost collaboa.example.com:80&gt;
  Servername collaboa.example.com
  CustomLog /www/collaboa/logs/access.log combined
  ErrorLog  /www/collaboa/logs/error.log
        ProxyPass / http://127.0.0.1:3005/
        ProxyPassReverse / http://127.0.0.1:3005/
&lt;/VirtualHost&gt;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/06/14/mongrel-webrick-forwarding-in-apache/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

