<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <body>&lt;p&gt;
	&lt;a href=&quot;http://haproxy.1wt.eu/&quot;&gt; HAProxy&lt;/a&gt; is a &lt;strong&gt;very fast&lt;/strong&gt; and highly configurable software &lt;span class=&quot;caps&quot;&gt;TCP&lt;/span&gt; load balancer. We will show you how to install, configure and test HAProxy without impacting any applications you may already have running.
&lt;/p&gt;


&lt;h3&gt;Installing HAProxy&lt;/h3&gt;

&lt;p&gt;
	You can install HAProxy in two way. Either you download it from the source or leave it to yum to download and install everything for you.&lt;br/&gt;
	The easy way:
	&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;yum -y install haproxy
cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg_orig
wget http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9 -O /etc/haproxy/haproxy.cfg
&lt;/code&gt; &lt;br/&gt;
	
	The hard way:
	&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.9.tar.gz
tar xvzf haproxy* &amp;&amp; cd haproxy*
make TARGET=linux26
cp haproxy /usr/
sudo install --owner=root --group=root -m700 haproxy /usr/sbin/
wget http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9 -O /etc/haproxy/haproxy.cfg
&lt;/code&gt; &lt;br/&gt;
You can customize the haproxy.cfg file by editing the listen section with the correct mongrel ports.
&lt;/p&gt;


&lt;p&gt;Ok, we are ready. Lets fire up this thing and test it out.&lt;br/&gt; If you used the easy way, they you can start haproxy by running the following command
&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;/etc/init.d/haproxy start&lt;/code&gt;
otherwise
&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;haproxy -f /etc/haproxy/haproxy.cfg -D&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt; At this point your ready to test your configuration. Assuming your haproxy is listening to port 9001 then calling the fallowing command 
&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;curl localhost:9001&lt;/code&gt; should give you back the index page of your application.
&lt;/p&gt;

&lt;h3&gt;Configuring Apache&lt;/h3&gt;
&lt;p&gt;
At this point we need to update the apache.&lt;br/&gt;
  1. Go to /etc/apache2/ or /etc/httpd/ and run the following command
&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;grep -rn 'Proxy balancer' *&lt;/code&gt; open the file and commit out the line &lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt; &lt;Proxy balancer://APPNAMECLUSTER&gt; &lt;/code&gt;&lt;br/&gt;
  2. Look for this line RewriteRule ^/(.*)$ balancer://APPNAME_cluster%{REQUEST_URI} [P,QSA,L]&lt;br/&gt;
  3. change the preview line to  RewriteRule ^/(.*)$ http://localhost:9001%{REQUEST_URI} [P,QSA,L] &lt;br/&gt;

  Thats it, restart apache and your good to go	
&lt;/p&gt;
</body>
    <created-at type="datetime">2009-07-03T20:09:37Z</created-at>
    <id type="integer">3</id>
    <title>Mongrel and Haproxy</title>
    <updated-at type="datetime">2009-07-03T20:10:57Z</updated-at>
  </post>
  <post>
    <body>&lt;p&gt;
The end of the world must be near because Moski decided to start a blog and share his scary thoughts with the world. 
&lt;/p&gt;

&lt;p&gt;
My first attempt to create a blog engine was few months ago. At that point i wondering what&#8217;s the easiest way to learn Erlang. So i decided to create a blogging engine using Erlang and i did. You can find the source code &lt;a href=&quot;https://github.com/moski/erlyweb-blogging/tree&quot;&gt; here&lt;/a&gt;. But it turns out that maintaing this blog and adding new features was time consuming.  
&lt;/p&gt;

&lt;p&gt;
Today i decided to rewrite the engine using &lt;a href=&quot;http://rubyonrails.com&quot;&gt; Ruby on Rails &lt;/a&gt;. It took around 5 hours from the point i called the command 
&lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;rails blog&lt;/code&gt; To &lt;code lang=&quot;shell-unix-generic&quot; line_numbers=&quot;true&quot;&gt;mongrel_rails cluster::start&lt;/code&gt;
which is not bad considering we had to setup the server(configure mongrel_cluster,install and configure haproxy) and create the theme.
&lt;/p&gt;


&lt;p&gt;
Next post i will show you how to configure haproxy with rails and some tricks i've learned in these 5 hours. Until then peace.
&lt;/p&gt;</body>
    <created-at type="datetime">2009-07-03T13:33:03Z</created-at>
    <id type="integer">2</id>
    <title>Erlang to Rails</title>
    <updated-at type="datetime">2009-07-03T13:33:03Z</updated-at>
  </post>
  <post>
    <body>&lt;p&gt; This is my first Blog post ever and i wanted to make something special. So i decided to make it the first piece of code i wrote in Erlang.&lt;/p&gt;

&lt;p&gt; Erlang is such a beautiful language so here we go &lt;/p&gt;


&lt;code lang=&quot;ruby&quot; theme=&quot;twilight&quot; line_numbers=&quot;false&quot;&gt;
  -module(hello).
  -export([hello_world/0]). 
   
   hello_world()-&gt;
     io:format(&quot;Hello World ~n&quot;).
&lt;/code&gt;</body>
    <created-at type="datetime">2009-07-03T12:29:15Z</created-at>
    <id type="integer">1</id>
    <title>First Blog Post &amp;&amp; Erlang Luv</title>
    <updated-at type="datetime">2009-07-03T12:44:00Z</updated-at>
  </post>
</posts>
