<?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>pkgbox</title>
	<atom:link href="http://www.pkgbox.org/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pkgbox.org/wordpress</link>
	<description>Everything in a box</description>
	<lastBuildDate>Sun, 05 Feb 2012 20:18:23 +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>Custom SSL certificates for Mercurial (hg)</title>
		<link>http://www.pkgbox.org/wordpress/2012/02/custom-ssl-certificates-for-mercurial-hg/</link>
		<comments>http://www.pkgbox.org/wordpress/2012/02/custom-ssl-certificates-for-mercurial-hg/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 20:14:14 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[NetBSD]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[VCS/DVCS]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=169</guid>
		<description><![CDATA[I run a small web server for my personal things like the rpm packages, some Perl stuff, this blog and &#8230; <a href="http://www.pkgbox.org/wordpress/2012/02/custom-ssl-certificates-for-mercurial-hg/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-155" title="2002-04-07_12-52-53" src="http://www.pkgbox.org/wordpress/wp-content/uploads/2012/01/2002-04-07_12-52-53-300x168.jpg" alt="" width="300" height="168" />I run a small web server for my personal things like the rpm packages, some Perl stuff, this blog and some other things. Among these things are the source code repositories such as the git repos and the Mercurial repositories. I had to switch from <a title="git project homepage" href="http://git-scm.com/" target="_blank">git</a> to <a title="Mercurial project homepage" href="http://mercurial.selenic.com/" target="_blank">Mercurial</a> as my new employer uses Mercurial and I need some training. Setting up a source code repository which is shared using the web server and the provided hgwebdir.cgi script is easy. I won&#8217;t explain all the details in this post, there are <a title="Publishing Mercurial Repositories" href="http://mercurial.selenic.com/wiki/PublishingRepositories" target="_blank">several good tutorials</a> out there.</p>
<p>However, I would like to use SSL for the http transport and I found some problems with this. The web server srv.pkgbox.de is using a certificate which has been signed by <a title="CACERT - free certificates - and a nice project" href="http://www.cacert.org/" target="_blank">CACERT</a>. After I imported the <a title="CACERT root certificates" href="http://www.cacert.org/index.php?id=3" target="_blank">CACERT root certificates</a> into my web browser everything was fine and the small lock symbol was closed. Easy. However using <em>hg clone</em> to get a copy of my new repository threw the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">$ hg clone https://jbond@srv.pkgbox.de/hg/world-domination-project
abort: error: _ssl.c:<span style="">503</span>: error:<span style="">14090086</span>:
SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed</pre></div></div>

<p>Huh. There was a problem with the certificates. The solution is quite simple. You have get the root certificates from CACERT and store them in a single file in the PEM format. CACERT provides two certificates, a <a title="CACERT root certificate" href="http://www.cacert.org/certs/root.crt" target="_blank">root certificate</a> and a <a title="CACERT class3 certificate" href="http://www.cacert.org/certs/class3.crt" target="_blank">class 3 certificate</a>, we have to get both of them. So, let&#8217;s do some work in the terminal window and set up everything for certificates.</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">$ mkdir ~/.certs
$ curl -s -k http://www.cacert.org/certs/root.crt \
   http://www.cacert.org/certs/class3.crt &gt; ~/.certs/ca-certificates.crt</pre></div></div>

<p>Ok, now we have the root certificates from CACERT and concatenated them in a single file inside the subdirectory ~/.certs/. Let&#8217;s use the <a title="OpenSSL project homepage" href="http://www.openssl.org/" target="_blank">openssl</a> tools and check if our certificate chain is valid.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">$ openssl s_client \
   -CAfile ~/.certs/ca-certificates.crt -connect srv.pkgbox.de:<span style="">443</span> &lt; /dev/null | \
   grep Verify
   <span class="br0">&#91;</span>...<span class="br0">&#93;</span>
   DONE
   Verify return code: <span style="">0</span> <span class="br0">&#40;</span>ok<span class="br0">&#41;</span></pre></div></div>

<p>Cool &#8211; openssl verifies the certificate and everything is working (for openssl). Now we only need to tell Mercurial to use the file with the certificates in (<em>~/.certs/ca-certificates.crt</em>). Mercurial uses a configuration file named <em>hgrc</em>. This file can either be system wide in <em>/etc/mercurial/hgrc</em> or can be used on a user basis in <em>~/.hgrc</em> &#8211; or inside any <em>.hg</em> directory of your project. Let&#8217;s use the user configuration file as I want to set it up for all my repositories.</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">$ cat &lt;&lt;_EOF_ &gt; ~/.hgrc
<span class="br0">&#91;</span>web<span class="br0">&#93;</span>
cacerts = ~/.certs/ca-certificates.crt
_EOF_</pre></div></div>

<p>Voila, let&#8217;s check if everything is working for us and try to clone our sources again.</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">$ hg clone https://jbond@srv.pkgbox.de/hg/world-domination-project
http authorization required
realm: Mercurial Repositories
user: jbond
password:
destination directory: world-domination-project
requesting all changes
<span class="br0">&#91;</span>...<span class="br0">&#93;</span>
updating to branch default
<span style="">16</span> files updated, <span style="">0</span> files merged, <span style="">0</span> files removed, <span style="">0</span> files unresolved</pre></div></div>

<p>Hej, it&#8217;s working. Time to get some more work done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2012/02/custom-ssl-certificates-for-mercurial-hg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating p5-* packages in pkgsrc</title>
		<link>http://www.pkgbox.org/wordpress/2012/01/updating-p5-packages-in-pkgsrc/</link>
		<comments>http://www.pkgbox.org/wordpress/2012/01/updating-p5-packages-in-pkgsrc/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 08:50:21 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[NetBSD]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=153</guid>
		<description><![CDATA[I am updating Perl packages in pkgsrc right now. pkgsrc is the package management system from the NetBSD project and &#8230; <a href="http://www.pkgbox.org/wordpress/2012/01/updating-p5-packages-in-pkgsrc/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft  wp-image-156" title="2002-04-07_12-53-17" src="http://www.pkgbox.org/wordpress/wp-content/uploads/2012/01/2002-04-07_12-53-17-300x168.jpg" alt="" width="210" height="118" />I am updating Perl packages in pkgsrc right now. pkgsrc is the package management system from the NetBSD project and it is great. It works on different platforms and different operating systems such as Linux, Solaris and even on FreeBSD.</p>
<p>The Perl packages really need some love there &#8211; some are horribly outdated and broken. There seem to be Perl packages in pkgsrc which are older than the versions which are shipped with the Perl core distribution. It&#8217;s alot of work.</p>
<p>Here what I will do in the next days &#8211; let&#8217;s see how far I can get:</p>
<ul>
<li>update the packages (at least the most)</li>
<li>clean up the licenses</li>
<li>check the dependencies inside the Makefile.PL (script)</li>
</ul>
<div>As I&#8217;ve mentioned on a talk &#8211; it&#8217;s not only fun to maintain Perl packages for a package distribution. But it seems to be fair &#8211; compared to someone who follows the KDE packages :)</div>
<div></div>
<div>Ah folks &#8211; here is something which I don&#8217;t like:</div>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">snowflake:p5-Archive-Tar rhaen$ cvs ci ../../doc/CHANGES-<span style="">2012</span> 
cvs commit: Up-to-date check failed for `../../doc/CHANGES-<span style="">2012</span>'
cvs <span class="br0">&#91;</span>commit aborted<span class="br0">&#93;</span>: correct above errors first!</pre></div></div>

<p><em>Can i haz  working version control system?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2012/01/updating-p5-packages-in-pkgsrc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new hope &#8211; package repository for RHEL 6 based Linux</title>
		<link>http://www.pkgbox.org/wordpress/2012/01/a-new-hope-package-repository-for-rhel-6-based-linux/</link>
		<comments>http://www.pkgbox.org/wordpress/2012/01/a-new-hope-package-repository-for-rhel-6-based-linux/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 21:23:54 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=146</guid>
		<description><![CDATA[Everyone needs software which is not in the repositories. That happens from time to time and usually you end up &#8230; <a href="http://www.pkgbox.org/wordpress/2012/01/a-new-hope-package-repository-for-rhel-6-based-linux/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>Everyone needs software which is not in the repositories. That happens from time to time and usually you end up building the sources by hand. Especially when it comes to Perl modules. However, if you want to install the stuff on more than one server you won&#8217;t take the usual:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">./configure &amp;&amp; make &amp;&amp; make install</pre></div></div>

<p>approach. Just don&#8217;t do it &#8211; it&#8217;s nasty. Build a package with your favorite package manager and deploy it. As I am working with RHEL based systems, the package format of my choice is RPM and I love it. As I am in the same situation such as you &#8211; I decided to build a public repository.</p>
<p>Voila &#8211; another repository to add &#8211; <a title="Packages" href="http://www.pkgbox.org/wordpress/packages/" target="_blank">check out my small project page about this</a>. For the unpatient people here is the quick way:</p>

<div class="wp_syntax"><div class="code"><pre class="" style="font-family:monospace;">yum install http://rpm.pkgbox.org/pkgbox-repo-<span style="">6</span>.noarch.rpm</pre></div></div>

<p>That should do the trick. Even for i386 hosts &#8211; usually I am building for x86_64. However, I am using mock to build the packages, but thats a different story.</p>
<p>&nbsp;</p>
<p><strong><a title="Packages" href="http://www.pkgbox.org/wordpress/packages/" target="_blank">Enjoy the RPMs (and leave some feedback)</a></strong></p>
<p>&nbsp;</p>
<p><em>btw, this is just my personal repo &#8211; don&#8217;t expect too much &#8211; it&#8217;s the stuff I need for my daily business such as:</em></p>
<ul>
<li><em>The wonderful Perl MongoDB driver by <a href="http://search.cpan.org/~kristina/">Kristina Chodorow</a></em></li>
<li><em>The skyrocketing collectd statistics daemon by <a href="http://verplant.org/">Florian octo Forster</a></em></li>
<li><em>The next generation Perl webframework Mojolicious by <a title="The Mojolicious Perl next generation webframework" href="http://mojolicio.us/" target="_blank">Sebastian Riedel</a></em></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2012/01/a-new-hope-package-repository-for-rhel-6-based-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System administration in the year 2012</title>
		<link>http://www.pkgbox.org/wordpress/2012/01/system-administration-in-the-year-2012/</link>
		<comments>http://www.pkgbox.org/wordpress/2012/01/system-administration-in-the-year-2012/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 19:41:14 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=117</guid>
		<description><![CDATA[System administration is a tough job these days. The toolchain changes frequently, the basic technology is moving fast, even in &#8230; <a href="http://www.pkgbox.org/wordpress/2012/01/system-administration-in-the-year-2012/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>System administration is a tough job these days. The toolchain changes frequently, the basic technology is moving fast, even in the age of Linux 3.x series. RedHat does a great job by introducing new features into their Linux distributions such as SELinux, upstart &#8211; systemd just to name two of the changes. The IT systems seem to grow more than the common techniques of system administration are able to deal with. In the old days few shell scripts and ssh were able to cope with the requirements, today tools like Fabric, func, puppet or chef seem to change the art of operations radically.</p>
<p>This is a start of a small series of blog articles about managing infrastructure in 2012. I&#8217;ll adapt some of the development methods and explain how we can use them to build more reliable systems with better teams.</p>
<p>&nbsp;</p>
<p><strong>Sidenote</strong></p>
<p><em>By the way &#8211; is that really true or is it just something which is being hyped by blogs, the devops community and the agile movement of lean. Seriously, the first release of cfengine happened in 1993. I used cfengine in my first project in 1999, this was a long time before puppet has been released. So, let&#8217;s be serious &#8211; the tools were there already, however, noone used it in the way we are thinking of infrastructure today.</em></p>
<p>&nbsp;</p>
<p><strong>What has changed?</strong></p>
<p>So what has changed recently in the sysadmin world? Maybe it&#8217;s the way the business world pretends to work these days. Scalability was always an issue, however, with public APIs, realtime trading systems and the hype of cloud based systems, scalability became more and more important. We can&#8217;t just afford to lack performance on our websites, be offline or fail to answer requests.</p>
<p>&nbsp;</p>
<p><strong>Does your team scale?</strong></p>
<p>Due to vastly improved requirements to the infrastructure the tools became sharper and the sysadmins became smarter. Now they are being called devops and have to deal with everything. Everything is about scaling things but does your team scale, too?</p>
<p>From my experience I can tell that this is an serious issue. Your team won&#8217;t be able to scale with the requirements, the tools and the change of methods unless everyone is higly motivated and open for changes. Usually it&#8217;s just not the case and things are likely to move slower if you try to catch up.</p>
<p>&nbsp;</p>
<p><strong>Don&#8217;t call for heroes!</strong></p>
<p>There are several different methods to deal with the situation. The far worst thing is the call for heroes. Those guys are smart, will code everything in puppet in a few minutes, install new servers in seconds and will take over. While this is a solution for a short time, you have to make sure to spread their knowledge and their philosophy to build systems. I was working for a company and became one of their heroes. I&#8217;ve built several systems and saved the company a bunch of trouble. However, noone was able to understand the systems. When I quit the company I had to hand over the systems and it was an interesting experience. Explaining what was clear to me and what was new to them, took some time. Now I know how hard it actually is to write documentation as a developer about your code.</p>
<p>&nbsp;</p>
<p><strong>Pair your admins and team up</strong></p>
<p>Basically, we have to accept our new tools such as RHEL Satellite (Spacewalk), puppet and clouds/virtualization. We are still very valuable, there is no reason to think why sysadmins are no longer needed. We are needed &#8211; however, we need to adapt some parts of our thinking.</p>
<p>Infrastructure work is no longer mucking with bare metal servers, it&#8217;s about to manage an infrastructure in all its glory. Virtual servers, cloud instances, bare metal servers, virtual switches and real firewalls. It&#8217;s all ours!</p>
<p>&nbsp;</p>
<p><em><strong>Let&#8217;s take the challenge!</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2012/01/system-administration-in-the-year-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kanban, Devops and agility</title>
		<link>http://www.pkgbox.org/wordpress/2012/01/kanban-devops-and-agility/</link>
		<comments>http://www.pkgbox.org/wordpress/2012/01/kanban-devops-and-agility/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 23:45:38 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[Kanban]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=109</guid>
		<description><![CDATA[I read alot of different books about Kanban during the last days. Christmas holidays are awesome. I have found several &#8230; <a href="http://www.pkgbox.org/wordpress/2012/01/kanban-devops-and-agility/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>I read alot of different books about Kanban during the last days. Christmas holidays are awesome. I have found several books quite useful &#8211; here is a minimalistic presentation of them. I will/might review them later in a more detailed way.</p>
<p><em><strong>Kanban<br />
</strong></em>Author: David J. Anderson<br />
Recommended: yes<br />
Amazon:</p>
<ul>
<li>€39,50 (<a href="http://www.amazon.de/gp/product/0984521402/ref=as_li_tf_tl?ie=UTF8&amp;tag=pkgboxde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=6742&amp;creativeASIN=0984521402">Kanban</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=pkgboxde-21&amp;l=as2&amp;o=3&amp;a=0984521402" alt="" width="1" height="1" border="0" /> Book)</li>
<li>€14,44 (<a href="http://www.amazon.de/gp/product/B0057H2M70/ref=as_li_ss_tl?ie=UTF8&amp;tag=pkgboxde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=B0057H2M70">Kanban</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=pkgboxde-21&amp;l=as2&amp;o=3&amp;a=B0057H2M70" alt="" width="1" height="1" border="0" /> Kindle Edition)</li>
</ul>
<p>This book is a goldmine of information about all questions of Kanban. David explorer Kanban for software development. He is the guru without any question. I got his book (signed by him) in one of his courses. This book is just outstanding. A review will follow at later time.</p>
<p>&nbsp;</p>
<p><em><strong>Personal Kanban &#8211; Mapping world | Navigating life</strong></em><br />
Author: Jim Benson, Tonianne DeMaria Barry<br />
Recommended: yes<br />
Amazon:</p>
<ul>
<li>€19,00 (<a href="http://www.amazon.de/gp/product/1453802266/ref=as_li_ss_tl?ie=UTF8&amp;tag=pkgboxde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=1453802266">Personal Kanban</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=pkgboxde-21&amp;l=as2&amp;o=3&amp;a=1453802266" alt="" width="1" height="1" border="0" /> Book)</li>
<li>€7,21 (<a href="http://www.amazon.de/gp/product/B004R1Q642/ref=as_li_ss_tl?ie=UTF8&amp;tag=pkgboxde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=B004R1Q642">Personal Kanban</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=pkgboxde-21&amp;l=as2&amp;o=3&amp;a=B004R1Q642" alt="" width="1" height="1" border="0" /> Kindle Edition)</li>
</ul>
<div>This book is about Kanban as a personal management system. It offers some insights how to use a personal management system based on Kanban. It shows some tipps and tricks, however, it&#8217;s not a fully appliable system. You need to tailor your own system and you&#8217;ll be guided. This book is more about the why and not that much about the doing.</div>
<p><em><strong>Getting started with Kanban</strong></em><br />
Author: Paul Klipp<br />
Recommended: <em>HIGHLY!</em><br />
Amazon:</p>
<ul>
<li>€1,03 (<a href="http://www.amazon.de/gp/product/B0058TU89G/ref=as_li_ss_tl?ie=UTF8&amp;tag=pkgboxde-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=B0058TU89G">Getting Started with Kanban</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=pkgboxde-21&amp;l=as2&amp;o=3&amp;a=B0058TU89G" alt="" width="1" height="1" border="0" /> Kindle Edition)</li>
</ul>
<p>That&#8217;s an incredible short introduction into the Kanban methodology. Ok, the book features a website which provides a Kanban system as SAAS. However, everything is well explained independently. If you need to get grip on Kanban fast, this is your book to read!<br />
Please note &#8211; there is also a free PDF version. The Kindle version works perfect and it&#8217;s cheap &#8211; no reason to work with the PDF. Please look at the PDF version here: <a title="Kanbanery - Getting started with Kanban - free ebook" href="http://kanbanery.com/ebook" target="_blank">Getting started with Kanban</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2012/01/kanban-devops-and-agility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring 2.0 &#8211; Next generation monitoring</title>
		<link>http://www.pkgbox.org/wordpress/2011/11/monitoring-2-0-next-generation-monitoring/</link>
		<comments>http://www.pkgbox.org/wordpress/2011/11/monitoring-2-0-next-generation-monitoring/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 20:31:24 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[MacOS X]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=84</guid>
		<description><![CDATA[Designing monitoring systems can be thrillseeking. I have seen all kinds of homegrown monitoring systems built on top of nagios &#8230; <a href="http://www.pkgbox.org/wordpress/2011/11/monitoring-2-0-next-generation-monitoring/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>Designing monitoring systems can be thrillseeking. I have seen all kinds of homegrown monitoring systems built on top of <a title="Nagios Monitoring" href="http://nagios.org/" target="_blank">nagios</a> or <a title="mrtg tool" href="http://oss.oetiker.ch/mrtg/" target="_blank">mrtg</a>. Usually all those solutions lack one thing: decent configuration possibilities.</p>
<p>In the old administration days one sysadmin was responsible for the installation of a server and the configuration system. Right now one sysadmin uses a central management server and fires up several virtual boxes or cloud instances with a few commands. But what about the monitoring? Is the monitoring included with the setup of <strong><em>your</em></strong> cloud instances? Lucky you. Usually those kind of tasks are only for brave sysadmins &#8211; and they are getting fewer every day.</p>
<div id="attachment_97" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/11/collectd_rrd2graph1.png" rel="lightbox[84]"><img class="size-medium wp-image-97" title="rrd2graph showing collectd data" src="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/11/collectd_rrd2graph1-300x120.png" alt="Graph drawn by rrd2graph from collectd data" width="300" height="120" /></a><p class="wp-caption-text">Graph drawn by rrd2graph from collectd data</p></div>
<p>I gave a talk on Tuesday about a more flexible toolchain for monitoring than the common used nagios setup. I had some good experiences with this toolchain at the company I am working for and it seems to scale reasonably well.</p>
<p><a title="collectd - the system statistics daemon" href="http://collectd.org/" target="_blank">collectd</a> is small daemon which collects the data on every instance/server and stores the information in rrd databases using librrd or via rrdcached. The perfomance data is being pushed to central servers, too. I like to call them collectors. They gather all the data from the different servers/instances. The advantage is clear &#8211; nagios can get all the values from those databases from every server at one place. This is not only an advantage for the firewall, it also saves the nagios server alot of work. The graphs are being drawn using <a title="n2rrd homepage" href="http://n2rrd-wiki.diglinks.com/" target="_blank">rrd2graph</a> (see screenshot) which is part of the n2rrd project.</p>
<p>The best thing about using collectd is it&#8217;s way of configuration. I suggest to setup three different configuration levels. A <em>base</em> configuration which is exactly the same on every host. It just has the most basic configuration in. A second level called <em>environment</em> configuration deals with networking stuff like who is the collector server in a certain zone. The third layer is called <em>service</em> configuration. This layer deals with services running on the server such as mysql, httpd, nginx, etc.</p>
<p>If you are using a configuration management tool such as puppet or RedHat Satellite it&#8217;s an easy task to build classes or system service groups which care for the configuration layers. Use RPMs during the kickstart process to install the collectd binaries and provide them with a sane first <em>/etc/collectd.conf</em>.</p>
<p>collectd provides a nice plugin structure with about 90 pre-made plugins and it&#8217;s easy to extend by using it&#8217;s Perl, Java, Python apis.</p>
<p>&nbsp;</p>
<p><em>Oh, did I mention? This works for Windows based servers, too! Please check out the slides for more information. The first link is a mindmap in <a title="Xmind - Mindmapping tool" href="http://www.xmind.net" target="_blank">xmind</a> format with a small management summary. If you are interested in the slides of the presentation, please use the second link which is in PDF format.</em></p>
<p>&nbsp;</p>
<p><a href="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/11/Monitoring-2.0.xmind">Monitoring 2.0 &#8211; Presentation Summary (xmind &#8211; Mindmap)</a></p>
<p><a href="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/11/Monitoring-2.pdf">Presentation about monitoring Unix environments with modern tools (pdf)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2011/11/monitoring-2-0-next-generation-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Perl knowledge for DevOps positions</title>
		<link>http://www.pkgbox.org/wordpress/2011/09/testing-perl-knowledge-job-interviews/</link>
		<comments>http://www.pkgbox.org/wordpress/2011/09/testing-perl-knowledge-job-interviews/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 21:02:59 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[Exam]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[Job]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=80</guid>
		<description><![CDATA[Teaching new colleagues the wonders of Perl can be a tough thing because it&#8217;s not clear where to start. Do &#8230; <a href="http://www.pkgbox.org/wordpress/2011/09/testing-perl-knowledge-job-interviews/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>Teaching new colleagues the wonders of Perl can be a tough thing because it&#8217;s not clear where to start. Do I have to start from scratch with just the basic things or does someone who had Perl mentioned in his CV qualifies as a Perl person already?</p>
<p>That&#8217;s a difficult question. Having interviews, talks or even exams might not give the right answer but you will get a certain feeling about someone and his skills. However, even the old geeks tend to be silent when <a title="Gabor Szabo on Linkedin" href="http://www.linkedin.com/in/szabgab" target="_blank">Gabor Szabo</a> (<a title="Gabors blog about Perl" href="http://szabgab.com/" target="_blank">blog</a>) is asking stuff about regular expressions in his talks on conferences. That&#8217;s interesting. People who are able to do the most complicated stuff with regex are quiet when they are asked simple regex. Is that the kind of people we are referring to as DevOps? Probably not.</p>
<p>So how do we find those multitalented people who are using Perl for sysadmin stuff, understand the complexity of J2EE and its architectures and are communicative to their colleagues &#8211; even when they can&#8217;t provide the answer at this time (referring to the regex problem). Actually, I don&#8217;t know. During interviews I have used the following simple questions to get a feeling about the Perl knowledge of the candidate:</p>
<ol>
<li>What&#8217;s the correct way to test if two scalars are the same &#8211; string comparison?</li>
<li>What does the keyword <em>&#8220;say&#8221;</em> do?</li>
<li>What is the meaning of the code fragement <em>$c = $a // $b</em> ?</li>
<li>What is the purpose of the command line tool <em>prove</em>?</li>
<li>What is the <em>taint</em> mode of Perl?</li>
</ol>
<p>Those are just 5 simple questions. Let me explain why I like to ask them and why I think they can give you more insights into the job candidate.</p>
<p>Question 1 &#8211; Tries to sort out if the person is actually using Perl. The most common answers for this are:<em> &#8220;==&#8221;</em>, <em>&#8220;=&#8221;</em> or <em>&#8220;$string1=~ /$string2/&#8221;</em>. Once again, Gabor has some answers for this in a short YouTube video &#8211; <a title="Modern Perl - Comparing scalars" href="http://www.youtube.com/watch?v=KXFn0rnBPrc" target="_blank">Comparing scalars</a>. If the candidate is very nervous and fails instantly, be nice and start a dialogue. Discuss the different options &#8211; if he has no clue at all, he will fail anyway in this question.</p>
<p>Question 2 &#8211; Asking about &#8220;modern&#8221; Perl knowlege. Most of the Google code snippets don&#8217;t show results about the keyword say. However, if the person is using a more current version or if he read the history he knows about the keyword.</p>
<p>Question 3 &#8211; Tricky one and might even be complicated for professionals. Code constructs like this one are common:</p>
<p><code><br />
if ( ! defined $a ) {<br />
    $b = $a;<br />
}<br />
else {<br />
    $b = "Hello world";<br />
}<br />
</code></p>
<p>Haven&#8217;t seen constructs like this &#8211; check your legacy Perl code. There are nice examples in the <a title="C-style Logical defined or documentation" href="http://perldoc.perl.org/perlop.html#C-style-Logical-Defined-Or" target="_blank">perlop</a> documentation it. This is something special, however, there is a reason why this operator exists &#8211; if you want someone working for you who knows how to use the tools &#8211; check if he really knows them.</p>
<p>Question 4 &#8211; Huh, don&#8217;t know the answer? That doesn&#8217;t matter &#8211; really. A lot of people are using <a title="Documentation of Test::More" href="http://perldoc.perl.org/Test/More.html" target="_blank">Test::More</a> for a long time and know about <a title="Test::Harness" href="http://search.cpan.org/dist/Test-Harness/lib/TAP/Harness/Beyond.pod" target="_blank">TAP</a>. If the person knows TAP and Test::More already, it&#8217;s ok that they don&#8217;t have the meaning of <a title="prove command - run test harness" href="http://perldoc.perl.org/prove.html" target="_blank">prove</a> handy. If they don&#8217;t know anything about TAP or Test::More, you will have another hint of their level of Perl knowledge. Do you expect a DevOp person to be the glue between development and sysadmins without knowledge of testing stuff?</p>
<p>Question 5 &#8211; wow, that&#8217;s legacy stuff. Really, I mean it &#8211; what was the last time that you&#8217;ve use the <a title="Taint mode in Perl" href="http://perldoc.perl.org/perlsec.html#Taint-mode" target="_blank">taint</a> mode for old CGI stuff? But is it such a bad idea to use the taint mode? Actually, the taint mode is something unpopular today. I wrote several scripts some decades ago which used the taint mode. I will fail horribly when I am trying to use the taint mode today &#8211; however, understanding about the history stuff is never a bad idea.</p>
<p>&nbsp;</p>
<p>Those are just some questions which might help you to check the knowledge of Perl of a candidate. You&#8217;ll understand their ways of thinking &#8211; their way to solve problems. If you can use the interviews to ask them face to face &#8211; that&#8217;s awesome and might give you an even deeper insight. If you are asking these questions on the phone &#8211; <em>be nice</em>! They are not as easy as you might think now when you are relaxed and not in a situation of job application. Help them on their way &#8211; test their knowledge, look at their problem solving skills and motivate them to pass the tests.</p>
<p><em>When you want to attract DevOps &#8211; try to be as nice and communicative as you expect them to be!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2011/09/testing-perl-knowledge-job-interviews/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Success or failure &#8211; with open source</title>
		<link>http://www.pkgbox.org/wordpress/2011/09/success-or-failur-with-open-source/</link>
		<comments>http://www.pkgbox.org/wordpress/2011/09/success-or-failur-with-open-source/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 21:15:15 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[Ironman]]></category>
		<category><![CDATA[Mojolicious]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=70</guid>
		<description><![CDATA[I like to look at things that work well and try to figure why they work and what are the &#8230; <a href="http://www.pkgbox.org/wordpress/2011/09/success-or-failur-with-open-source/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>I like to look at things that work well and try to figure why they work and what are the success factors.This is more fun at projects which are successful than looking at projects which failed. Usually the spirit of successful projects is more straight forward and doesn&#8217;t sound like an excuse. <em>&#8220;Blah, blah, blah messed up the code repository and we are just in the phase of picking up everything.&#8221;</em> That doesn&#8217;t sound like a great project to me and already got to the point of finger pointing. In a great project which is successful and well accepted someone might pick up the broken things and fix them. Oh, wait, even there might be something like a vision which is helpful for people to follow.</p>
<p>Here are some simple facts about github usage which might be helpful:</p>
<p>&nbsp;</p>
<p><strong>Fact I: Use github right</strong></p>
<p>github is not just a tool or a place to put a clone of your git repo on. If you decided to put things on github, use github as a platform. Be polite, answer to issues and decide about the incoming pull requests. Some projects use github as a place for backing up their repositories. <em>&#8220;A copy of the original repo is on github&#8221;</em> &#8211; is a common term. Forget about it. If someone forks and contributes to your project make sure to answer <em>appropriately</em> and fast. Those people already forked the repo, downloaded everything, looked into the sources and put some effort into it. They don&#8217;t deserve a break about 1-2 weeks for contributing. Firing a patch to a mailing list is just easy. Working out a pull request is much more complicated. You probably have to rebase your stuff on top of the repo, merge stuff..you&#8217;ve figured already.</p>
<p><em>If you don&#8217;t encourage contributions &#8211; don&#8217;t use github.</em></p>
<p>&nbsp;</p>
<p><strong>Fact II: Use github for communication</strong></p>
<p>Denying a pull request isn&#8217;t bad &#8211; it&#8217;s just code. Be nice and explain why you don&#8217;t accept the pull request. I&#8217;ve sent several pull requests to @kraih for Mojolicious. He rejected most of them, however, I always got a nice reply. Sometimes he even took my commit and changed it a little bit. I was visible as the author and he took the rule as committer. git is something social politcal statement alike, too and github visualizes this nicely.</p>
<p><em>Use github to encourage contributions!</em></p>
<p>&nbsp;</p>
<p><strong>Fact III: Wiki your community</strong></p>
<p>The wiki on github is very basic. However, it provides some useful features which are helpful for the Perl people. You can choose the format in which the pages of the wiki are being created in. Using the pod format allows people to clone your wiki and read it in offline mode using perldoc. This is an awesome and in my opinion underrated feature. The only problem with the wiki on github is that you have to enable write access to the project repo to allow users to push content. I&#8217;ll hope they&#8217;ll fix it one day.</p>
<p>The wiki is usually driven by the community. The headline person of the project can contribute and give insights into different code parts and can share his vision. The community will care for examples, discussion and keep the wiki up to date. Therefore the wiki needs to be writable for everyone. I am serious, open the wiki for everyone! All the content is stored in git anyway so you can easily revert things if they got broken.</p>
<p><em>Be spirited, share your vision and be open to your community!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2011/09/success-or-failur-with-open-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Publishing your existing git repo (Xcode)</title>
		<link>http://www.pkgbox.org/wordpress/2011/09/publishing-your-existing-git-repo-xcode/</link>
		<comments>http://www.pkgbox.org/wordpress/2011/09/publishing-your-existing-git-repo-xcode/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 12:14:36 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Devops]]></category>
		<category><![CDATA[MacOS X]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=65</guid>
		<description><![CDATA[I&#8217;ve received alot of feedback about the setup of a git server on MacOS X. Some people had some problems &#8230; <a href="http://www.pkgbox.org/wordpress/2011/09/publishing-your-existing-git-repo-xcode/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve received alot of feedback about the setup of a git server on MacOS X. Some people had some problems with Xcode and existing git repositories and sharing them. My <a title="Setting up a git server on MacOS X Lion" href="http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/" target="_blank">article</a> about setting up a git repository was starting with an empty repository, here is the description on how to start with existing git repositories. I won&#8217;t explain everything from scratch &#8211; it&#8217;s just something like an addon to the <a title="Setting up a git server on MacOS X Lion" href="http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/" target="_blank">article</a>.<br />
Please make sure to follow all the steps in the tutorial, except using a new repo, I will show you how to prepare an existing repo for sharing.</p>
<p>Let&#8217;s assume we already have a project named &#8220;<em>myproject</em>&#8220;. As I am a Perl programmer we will use Perl sources and a perlish layout of the project. However, this should work for every project! As you see in this screenshot I&#8217;ve some source layout (given by common Perl nature) and a <em>&#8220;.git&#8221;</em> directory. I&#8217;ve worked with the sources and ran <em>git init</em> and added all the files to the repo.</p>
<div id="attachment_66" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/09/plain-git-repo.png" rel="lightbox[65]"><img class="size-medium wp-image-66" title="plain-git-repo" src="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/09/plain-git-repo-300x182.png" alt="Plain screenshot of a project using git" width="300" height="182" /></a><p class="wp-caption-text">project toplevel folder with .git directory</p></div>
<p>Therefore we have an existing repo which is fine for local work, however, sharing via HTTP requires some steps:</p>
<ul>
<li>Clone the existing repo to a bare repository</li>
<li>Enable the post-update hook</li>
<li>Setup the apache to share the repo</li>
</ul>
<p>Let&#8217;s start with cloning the repository to a bare repo. A bare repo is just a git repository with a different layout. You won&#8217;t see any active checkouts aka sources, you&#8217;ll only find the structure of the <em>&#8220;.git&#8221;</em> repository in it. As we used the directory <em>&#8220;/Library/WebServer/Documents/repo&#8221;</em> as the base directory for my last article we&#8217;ll continue to work at this directory base. We will clone our small project <em>&#8220;myproject&#8221;</em> to<em> &#8220;/Library/WebServer/Documents/repo/myproject.git&#8221;</em>. This allows to follow the later steps in the <a title="Setting up a git server on MacOS X Lion" href="http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/" target="_blank">setup article</a>.</p>
<p>We start inside the directory of our project, so the<em> &#8220;.git&#8221;</em> repo is on the top level.</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">$ sudo git clone --bare . \
   /Library/WebServer/Documents/repo/myproject.git
$ sudo chown -R _www:_www \
   /Library/WebServer/Documents/repo/myproject.git
$ cd /Library/WebServer/Documents/repo/myproject.git
$ sudo -u _www mv hooks/post-update.sample \
   hooks/post-update
$ sudo -u _www hooks/post-update</pre></div></div>

<p>From this point you can follow the old article about <a title="Setting up a git server on MacOS X Lion" href="http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/#Apache" target="_blank">&#8220;Set up your Apache server for sharing&#8221;</a></p>
<p>Enjoy your new git experience!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2011/09/publishing-your-existing-git-repo-xcode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Morbo as a service on MacOS X</title>
		<link>http://www.pkgbox.org/wordpress/2011/09/morbo-as-a-service-on-macos-x/</link>
		<comments>http://www.pkgbox.org/wordpress/2011/09/morbo-as-a-service-on-macos-x/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 21:04:04 +0000</pubDate>
		<dc:creator>rhaen</dc:creator>
				<category><![CDATA[Ironman]]></category>
		<category><![CDATA[MacOS X]]></category>
		<category><![CDATA[Mojolicious]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.pkgbox.org/wordpress/?p=51</guid>
		<description><![CDATA[I am a developer and a sysadmin &#8211; this qualifies me as a lazy person. I don&#8217;t want to do &#8230; <a href="http://www.pkgbox.org/wordpress/2011/09/morbo-as-a-service-on-macos-x/" class="more-link">Learn more</a>]]></description>
			<content:encoded><![CDATA[<p>I am a developer and a sysadmin &#8211; this qualifies me as a lazy person. I don&#8217;t want to do things more often than needed. If I can automate my sysadmin part of my life I am happy to do so. One thing about developing stuff with Mojolicious is to start the development server by hand. Sebastian (<a title="Sebastian Riedel (@sri on Twitter)" href="http://twitter.com/#!/kraih" target="_blank">sri</a>) did a fantastic job in writing morbo, the development server for Mojolicious. morbo is a very capable HTTP 1.1 compliant web server and it&#8217;s part of the Mojolicious distribution. The generic syntax to use the daemon with a Mojolicious::Lite application is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ morbo <span style="color: #7a0874; font-weight: bold;">&#91;</span>options <span style="color: #000000; font-weight: bold;">if</span> needed<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&lt;</span>scriptname<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Everytime you change the script, morbo will detect this and will reload the application. Best part of it, it will detect syntax errors and warn you about them. This is very helpful for me as it separates a few steps. First you develop the Mojolicious::Lite application, then you&#8217;ll save it, morbo does the syntax check for you and you see if things are broken from the code side, next you&#8217;ll test the web application with a browser and check if everything is working there. To run unit tests all the time is self explanatory.</p>
<p>So yes, I am a fan of it. Oh, there is something even nicer about it. morbo doesn&#8217;t only check the script for changes, it subscribes automatically to the lib and to the templates directory, too. If they don&#8217;t exist, morbo will just do the right thing. So once you&#8217;ve a basic Mojolicious::Lite application and decide to inflate it from one file to a directory structure your setup doesn&#8217;t need to be changed. That&#8217;s cool. Speaking from the sysadmin side of life: It&#8217;s a horror to track changes in your deployment configuration. If you are part of the development team you might find ways to deal with it. If you are a sysadmin which only cares for the platform you are doomed.</p>
<p>Here is the simple way I like to work with morbo in my MacOS X environment. I am doing my development stuff in a subfolder of my home directory. I&#8217;ve put the folder as a subfolder of my Library folder so I won&#8217;t see it all the time. Nothing is more annoying as millions of folders around! Please note: The Library folder is not visible by default, you might want to create the structure in your home directory, if you are uncomfortable with the Unix shell.</p>
<p>You can unhide the Library folder in your home directory by running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ chflags nohidden ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>in the <em>Terminal.app</em>.</p>
<p>I&#8217;ve used <a title="Perlbrew - Perl installation utility" href="https://metacpan.org/module/perlbrew" target="_blank">perlbrew</a> to install Perl version 5.14.1 in my home directory. This way I can install modules and play with them without messing around with the MacOS X system stuff. As I&#8217;ve said before &#8211; I like to keep things separated &#8211; call it sysadmin paranoia. Let&#8217;s create the basic structure.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mojolicious<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>external,external<span style="color: #000000; font-weight: bold;">/</span>repo,log<span style="color: #7a0874; font-weight: bold;">&#125;</span>
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mojolicious<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>static,templates<span style="color: #7a0874; font-weight: bold;">&#125;</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> Library<span style="color: #000000; font-weight: bold;">/</span>Mojolicious
$ mojo generate lite_app default.pl</pre></div></div>

<p>Voila, we now have a basic directory structure and a standard Mojolicious::Lite application named default.pl. Let&#8217;s see what else do we have.</p>
<p><strong>external</strong><br />
directory for external resources, I clone mojo from github into this directory. I use it as reference as well as for installations of the latest code of Mojolicious.<br />
<strong>external/repo</strong><br />
directory for my personal git repositories which are Mojolicious related<br />
<strong>log</strong><br />
log directory for Mojolicious (default setting)<em><br />
</em></p>
<p><strong>static</strong><br />
directory for static resources such as images, css, js files<br />
<strong>templates</strong><br />
template directory for Mojolicious applications (default setting)</p>
<p>Now that we have a basic structure and a basic setup we should look on the automatic startup of the morbo server and our just created <em>default.pl</em> Mojolicious::Lite application.</p>
<p>MacOS X uses a special daemon for launching services which is called launchd. The daemon is controlled by a command which is named launchctl. launchctl will be used to load a xml style description of the service into the daemon and start it. You can specify custom services and you&#8217;t have to be the user root to work with the daemon, that&#8217;s nice. So, let&#8217;s look into the xml service file for our morbo service.</p>
<p>&nbsp;</p>
<div id="attachment_52" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/09/morbo-launchd-service-description.png" rel="lightbox[51]"><img class="size-medium wp-image-52" title="launchd property file for morbo - the Moljolicous web server" src="http://www.pkgbox.org/wordpress/wp-content/uploads/2011/09/morbo-launchd-service-description-300x190.png" alt="launchd property file for morbo - the Moljolicous web server" width="300" height="190" /></a><p class="wp-caption-text">launchd property file for morbo - the Moljolicous web server (see gist)</p></div>
<p>That&#8217;s an image, click to enlarge it. I&#8217;ve used it for better visibility, you can find the full source file in the <a title="launchd service description for morbo - the Mojolicious web server" href="https://gist.github.com/1191781" target="_blank">following gist</a>.</p>
<p>Here is a quick review of the important parts:</p>
<p><em>&lt;key&gt;Label&lt;/key&gt;</em><br />
<em>&lt;string&gt;us.mojolicio.default&lt;/string&gt;</em></p>
<p>Every application/service needs to have it&#8217;s own label. The label is used to identify the service at a later point. Use a dsl syntax to keep things sorted. My own applications will be named de.pkgbox.mojolicious.&lt;name&gt;.</p>
<p><em>&lt;key&gt;ProgramArguments&lt;/key&gt;</em><br />
<em>&lt;array&gt;</em><br />
<em>    &lt;string&gt;morbo&lt;/string&gt;</em><br />
<em>    &lt;string&gt;&#8211;listen&lt;/string&gt;</em><br />
<em>    &lt;string&gt;http://*:8080&lt;/string&gt;</em><br />
<em>    &lt;string&gt;/Users/rhaen/Library/Mojolicious/default.pl&lt;/string&gt;</em><br />
<em>&lt;/array&gt;</em></p>
<p>This is a little bit tricky. I don&#8217;t need to specify the full path to morbo as launchd will use my user environment to run the ProgrammArguments. However, I have to specify the full path to my Mojolicious::Lite application named <em>default.pl</em>. I am using some arguments to morbo to keep it more usuable for me but let&#8217;s work down the way. Usually you have to use a <em>Program</em> key and specify <em>ProgramArguments</em> as an array for more arguments. If you discard the Program key it will use the first element of the ProgramArguments as Program key. Simple.<br />
I like to have morbo running on port 8080. Maybe during my development phase I want to run another Mojo application on the default port 3000. That&#8217;s just a good way to make sure that normal development doesn&#8217;t interfere with your basic environment.</p>
<p>Ok, here is the next part of the setup:</p>
<p><em>&lt;key&gt;RunAtLoad&lt;/key&gt;</em><br />
<em>&lt;true/&gt;</em><br />
<em>&lt;key&gt;WorkingDirectory&lt;/key&gt;</em><br />
<em>&lt;string&gt;/Users/rhaen/Library/Mojolicious&lt;/string&gt;</em><br />
<em>&lt;key&gt;StandardErrorPath&lt;/key&gt;</em><br />
<em>&lt;string&gt;/Users/rhaen/Library/Mojolicious/log/output.log&lt;/string&gt;</em><br />
<em>&lt;key&gt;StandardOutPath&lt;/key&gt;</em><br />
<em>&lt;string&gt;/Users/rhaen/Library/Mojolicious/log/output.log&lt;/string&gt;</em><br />
<em>&lt;/dict&gt;</em></p>
<p><em>RunAtLoad</em> means that we want to start the morbo server right from the start. We don&#8217;t want to run it on demand neither we just want to register it, we want it running! The <em>WorkingDirectory</em> is an important setting. launchd will chdir to this directory before running the <em>Program</em> and the <em>ProgramArguments</em>. That&#8217;s needed to get the correct environment for Mojolicious for the log, static and templates directory. Last but not the least we use a <em>StandardErrorsPath</em>/<em>StandardOutPath</em> for some basic log files of the launchd daemon. Does something fail? Was there an error? Did morbo crash? We&#8217;ll find the information in this file!<br />
Please note: There is an optional setting named <em>KeepAlive</em> which will try to restart the morbo server once it fails. This can be set, however, I would like to know when morbo crashes and why it crashes. That&#8217;s why I am not using this setting.</p>
<p>That was alot of stuff! Store all the information above in a file named &#8220;<em>us.mojolicio.default.plist</em>&#8221; and save it in the external directory of our basic structure. I like to keep the main copy there &#8211; just for separation, you know sysadmins paranoia.</p>
<p>In order to activate everything we need to run a few commands. First we need to place a symlink inside the <em>~/Library/LaunchAgent</em> folder. After that we need to register aka load the file and we are done.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents
$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mojolicious<span style="color: #000000; font-weight: bold;">/</span>external<span style="color: #000000; font-weight: bold;">/</span>us.mojolicio.default.plist .
$ launchctl load us.mojolicio.default.plist</pre></div></div>

<p>Why do we use a symlink? Why don&#8217;t we just place the file in the correct place? The answer is simple. We kept everything Mojolicious related together. We can run git init inside the Mojolicious folder and have everything version controlled. One place &#8211; one repo, sysadmin paranoia&#8230;you know.<br />
By loading the configuration file we informed launchd about a new service and launchd already took over. The new service has been started and the morbo server is serving default.pl at port 8080. Why don&#8217;t you fire up a web browser to check it?</p>
<p><strong>Uninstalling everything</strong></p>
<p>Got lost? Want to get rid of everything and start from scratch? That&#8217;s simple. First we need to unload the morbo service from launchd. Next we&#8217;ll remove the symlink and delete the Mojolicious folder. Voila &#8211; finished. Dear developers, that&#8217;s sysadmin style. Clean up after your play &#8211; dear sysadmins, start coding!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents<span style="color: #000000; font-weight: bold;">/</span>
$ launchctl unload us.mojolicio.default.plist
$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents<span style="color: #000000; font-weight: bold;">/</span>us.mojolicio.default.plist
$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mojolicious</pre></div></div>

<p>Make sure to leave some feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pkgbox.org/wordpress/2011/09/morbo-as-a-service-on-macos-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

