<?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>Hungry Machine &#187; yaml</title>
	<atom:link href="http://blog.hungrymachine.com/tag/yaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hungrymachine.com</link>
	<description>The guys behind LivingSocial</description>
	<lastBuildDate>Sun, 25 Oct 2009 15:08:39 +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>Reconfiguring the whole rails stack via a central YAML file</title>
		<link>http://blog.hungrymachine.com/2007/08/20/reconfiguring-the-whole-rails-stack-via-a-central-yaml-file/</link>
		<comments>http://blog.hungrymachine.com/2007/08/20/reconfiguring-the-whole-rails-stack-via-a-central-yaml-file/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 02:07:00 +0000</pubDate>
		<dc:creator>val</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Ops]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">blog.hungrymachine.com/2007/08/23/reconfiguring-the-whole-rails-stack-via-a-central-yaml-file</guid>
		<description><![CDATA[The challenge with hosting of multiple Rails-based Facebook applications is that the amount of users grow quickly. To address this problem we are using EC2 nodes that we can expand/shrink as the demand grows. The price/performance ratio isn&#8217;t quite what we first expected, so we are moving toward having a few dedicated boxes instead. Another [...]]]></description>
			<content:encoded><![CDATA[<p>The challenge with hosting of multiple Rails-based Facebook applications is that the amount of users grow quickly. To address this problem we are using <span class="caps">EC2</span> nodes that we can expand/shrink as the demand grows. The price/performance ratio isn&#8217;t quite what we first expected, so we are moving toward having a few dedicated boxes instead. Another problem that we add at least a couple of applications a week. On each box that hosts them, we need to reconfigure monit, haproxy, nginx, logrotate and nagios.</p>
<p>To mitigate both issues on dedicated boxes, we resolved to have a central configuration definition in svn with individual box configurations keyed on localhost name. A ruby script regenerates all those aforementioned configuration files from <span class="caps">ERB</span>-processed templates when it is run on a box and bounces the services. A sample config looks like:</p>
<div class="CodeRay">
<div class="code">
<pre>dedicated<span style="color:#00D; font-weight:bold">-1</span>:

    description: <span style="background-color:#fff0f0"><span style="color:#710">&quot;</span><span style="color:#D20">The dedicated box #1</span><span style="color:#710">&quot;</span></span>
    ip: <span style="color:#60E; font-weight:bold">64.233</span>.<span style="color:#60E; font-weight:bold">167.99</span>
    failover: dedicated<span style="color:#00D; font-weight:bold">-2</span>

    apps:

        bookshelf:
            port: <span style="color:#00D; font-weight:bold">5000</span>
            instances: <span style="color:#00D; font-weight:bold">20</span>
            response: <span style="color:#036; font-weight:bold">Book</span>

        ljconnect:
            port: <span style="color:#00D; font-weight:bold">6000</span>
            instances: <span style="color:#00D; font-weight:bold">7</span>
            virtual: ljconnect.hungrymachine.com
            response: <span style="color:#036; font-weight:bold">Journal</span>
                      </pre>
</div>
</div>
<p>That definition would generate a monit config with 20 instances of the <em>bookshelf</em> application and 7 instances of the <em>ljconnect</em> application plus all other configurations (including nagios health checks expecting the <em>response</em> value) . It is all possible because we adopt a fixed application deployment file structure and port numbering conventions (via offsets) for all servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hungrymachine.com/2007/08/20/reconfiguring-the-whole-rails-stack-via-a-central-yaml-file/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
