<?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>My Wushu Blog &#187; Puppet</title>
	<atom:link href="http://www.mywushublog.com/tag/puppet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mywushublog.com</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 18:42:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using CouchDB with Puppet and Bacula</title>
		<link>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/</link>
		<comments>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 04:48:07 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[Bacula]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1648</guid>
		<description><![CDATA[On aspect that I was never happy with the Bacula environment I built while at LLNL was the fact that I could no look up certain values for each client. Values like: Passwords Storage Devices Certificates (if you are using Encryption) Well, over the past few week&#8217;s I&#8217;ve been able ...]]></description>
			<content:encoded><![CDATA[<p>On aspect that I was never happy with the Bacula environment I built while at LLNL was the fact that I could no look up certain values for each client. Values like:</p>
<ul>
<li>Passwords</li>
<li>Storage Devices</li>
<li>Certificates (if you are using Encryption)</li>
</ul>
<p>Well, over the past few week&#8217;s I&#8217;ve been able to work around this problem by storing additional information in a CouchDB DB.</p>
<p>It is not the ideal solution, but it is a start and I&#8217;m okay with that. I should also warn you, I do HORRIBLE things here with Bash and JSON. Since Bash doesn&#8217;t know about JSON, I rely upon awk. I know, I know, I should re-write all of this in a nice new language like Python or Ruby&#8230;</p>
<p>First thing is first, I had to create a new database:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ curl <span style="color: #660033;">-kX</span> PUT https:<span style="color: #000000; font-weight: bold;">//</span>puppet.bayphoto.local<span style="color: #000000; font-weight: bold;">/</span>bacula_meta
<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;ok&quot;</span>:<span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>I&#8217;m not going to worry about that name, to me it is a database that contains some metadata of our clients.</p>
<p>My client creation tool that I posted in my previous <a href="/2011/07/bacula-in-the-enterprise-part-2/">Bacula</a> article has been updated to do a little bit more. Aside from no longer using TEMPLATE files, I&#8217;ve added some additional code to push a few details into this new bacula_meta database. Here is my &#8220;write_json&#8221; function:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Some NEW Variables:</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">COUCH_SERVER</span>=<span style="color: #ff0000;">&quot;https://puppet.bayphoto.local&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DB</span>=<span style="color: #ff0000;">&quot;bacula_meta&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CERTDIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$BDIR</span>/certs&quot;</span>
&nbsp;
write_json<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
   curl <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/json&quot;</span> <span style="color: #660033;">-kX</span> PUT <span style="color: #660033;">-d</span> <span style="color: #ff0000;">'{ &quot;_id&quot;: &quot;'</span><span style="color: #800000;">${HOSTNAME}</span><span style="color: #ff0000;">'&quot;,&quot;passhash&quot;: &quot;'</span><span style="color: #800000;">${PASSHASH}</span><span style="color: #ff0000;">'&quot; }'</span> <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>The document I create is simple, it is named after the short hostname of the client added to backups, and for this first run we store that and the password.</p>
<p>The &#8220;main&#8221; function of the script first tests to see if a document in the bacula_meta db exists, and if not it will create a new client. If it does exist, you can either continue and re-create the bacula client&#8217;s configuration, or quite:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">TEST</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$TEST</span> == <span style="color: #000000; font-weight: bold;">*</span>not_found<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
       <span style="color: #666666; font-style: italic;"># Generate a bacula password.</span>
       <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PASSHASH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>random <span style="color: #007800;">bs</span>=<span style="color: #000000;">6</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">4</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">|</span> openssl base64<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
       <span style="color: #666666; font-style: italic;"># This is the actual .conf configuration</span>
       print_client_conf
&nbsp;
       <span style="color: #666666; font-style: italic;"># Create a new client document in $DB</span>
       write_json
&nbsp;
       <span style="color: #666666; font-style: italic;"># Create SSL key-pair</span>
       create_keys
&nbsp;
       <span style="color: #666666; font-style: italic;"># Adding the client .conf file for the director to source.</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
&nbsp;
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'created client definition: '</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'for '</span><span style="color: #007800;">$HOSTNAME</span>
<span style="color: #000000; font-weight: bold;">else</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'client '</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #ff0000;">'already exists.'</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Do you want to override the current configuration for:'</span>
       <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'      '</span><span style="color: #007800;">$HOSTNAME</span>
       <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;[y/N] &quot;</span> prompt
       <span style="color: #007800;">prompt</span>=<span style="color: #800000;">${prompt,,}</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$prompt</span> =~ ^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #000000; font-weight: bold;">|</span>y<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
       <span style="color: #000000; font-weight: bold;">then</span>
               <span style="color: #666666; font-style: italic;"># if we choose to override, a new client conf will be generated and added and commited.</span>
&nbsp;
               <span style="color: #666666; font-style: italic;"># Lets re-obtain our stored client password first</span>
               <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PASSHASH</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span>  <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F: <span style="color: #ff0000;">'gsub(&quot;{|}&quot;,&quot;&quot;) { print $5 }'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
               <span style="color: #666666; font-style: italic;"># print out a new cliend.conf</span>
               print_client_conf
&nbsp;
               <span style="color: #666666; font-style: italic;"># Push the clients key-pair back to couchdb       </span>
               curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FQDN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$CERTDIR</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FQDN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span>
&nbsp;
                <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-w</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'client '</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #ff0000;">'already exists...'</span>
                <span style="color: #000000; font-weight: bold;">else</span>
                        <span style="color: #7a0874; font-weight: bold;">echo</span> \<span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span>.conf <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$BDIR</span><span style="color: #000000; font-weight: bold;">/</span>clients.conf
                <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">else</span>
               <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Ok, no clients were modified or added!&quot;</span>
       <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>The other addition was a create_keys function. Our clients encrypt their data to the storage node (we send some backup volumes to S3 storage, which is over http and not stored in any sort of encrypted format), and we needed a decent way to distribute the keys (using Puppet&#8230;).</p>
<p>This was difficult for me to do. What I failed to understand about adding attachments to CouchDB is you have to reference the current document _rev, and after a LOT of trial and error I finally got it. The DOC_REV variable grabs the current documents revision:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DOC_REV</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">':|&quot;'</span> <span style="color: #ff0000;">'{ print $10}'</span><span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>Which is then used when I actually PUT the file in there:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">create_keys<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">DOC_REV</span>=<span style="color: #000000; font-weight: bold;">`</span>curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-X</span> GET <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">':|&quot;'</span> <span style="color: #ff0000;">'{ print $10}'</span><span style="color: #000000; font-weight: bold;">`</span>
  <span style="color: #007800;">C</span>=<span style="color: #ff0000;">&quot;US&quot;</span>
  <span style="color: #007800;">ST</span>=<span style="color: #ff0000;">&quot;California&quot;</span>
  <span style="color: #007800;">L</span>=<span style="color: #ff0000;">&quot;Santa Cruz&quot;</span>
  <span style="color: #007800;">O</span>=<span style="color: #ff0000;">&quot;Bay Photo Lab&quot;</span>
  <span style="color: #007800;">OU</span>=<span style="color: #ff0000;">&quot;IT&quot;</span>
  <span style="color: #007800;">CN</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${HOSTNAME}</span>.bayphoto.local&quot;</span>
  <span style="color: #007800;">EMAIL</span>=<span style="color: #ff0000;">&quot;bayit@bayphoto.com&quot;</span>
&nbsp;
openssl genrsa <span style="color: #660033;">-out</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #000000;">2048</span>
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #660033;">-x509</span> <span style="color: #660033;">-out</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.cert <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
${C}
${ST}
${L}
${O}
${OU}
${CN}
$EMAIL
EOF</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.key <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>.cert <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${CN}</span>-fd.pem
&nbsp;
curl <span style="color: #660033;">-k</span> <span style="color: #660033;">-X</span> PUT <span style="color: #007800;">$COUCH_SERVER</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$DB</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOSTNAME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem?<span style="color: #007800;">rev</span>=<span style="color: #007800;">$DOC_REV</span> <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${CERTDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$CN</span>-fd.pem  <span style="color: #660033;">-H</span> <span style="color: #ff0000;">&quot;Content-Type: application/octet-stream&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>So what does adding a new client look like using this updated tool?</p>
<pre>
# ./cclient.bash -s Standard -h client-a
INSERT 0 1
{"ok":true,"id":"client-a","rev":"1-0841684988ec85c6d2b16cb941a739ac"}
Generating RSA private key, 2048 bit long modulus
..............................................................+++
..............+++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:State or Province Name (full name) [Some-State]:Locality Name (eg, city) []:Organization Name (eg, company) [Internet Widgits Pty Ltd]:Organizational Unit Name (eg, section) []:Common Name (eg, YOUR name) []:Email Address []:
{"ok":true,"id":"client-a","rev":"2-21d4e7bc019c2176dfa2583b320387ab"}
created client definition: /usr/local/etc/bacula/clients.d/client-a.conf
for client-a
</pre>
<p>And my new record in CouchDB has all the right data:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-kX</span> GET https:<span style="color: #000000; font-weight: bold;">//</span>puppet.bayphoto.local<span style="color: #000000; font-weight: bold;">/</span>bacula_meta<span style="color: #000000; font-weight: bold;">/</span>client-a
<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;_id&quot;</span>:<span style="color: #ff0000;">&quot;client-a&quot;</span>,<span style="color: #ff0000;">&quot;_rev&quot;</span>:<span style="color: #ff0000;">&quot;2-21d4e7bc019c2176dfa2583b320387ab&quot;</span>,<span style="color: #ff0000;">&quot;hostname&quot;</span>:<span style="color: #ff0000;">&quot;client-a&quot;</span>,<span style="color: #ff0000;">&quot;passhash&quot;</span>:<span style="color: #ff0000;">&quot;y9WBgacrd8JbZjrefeZHKbPk9Kda5UQc&quot;</span>,<span style="color: #ff0000;">&quot;_attachments&quot;</span>:<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;client-a.bayphoto.local-fd.pem&quot;</span>:<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;content_type&quot;</span>:<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span>,<span style="color: #ff0000;">&quot;revpos&quot;</span>:<span style="color: #000000;">2</span>,<span style="color: #ff0000;">&quot;digest&quot;</span>:<span style="color: #ff0000;">&quot;md5-kqi8ODloPxT6D6IxZbCoVg==&quot;</span>,<span style="color: #ff0000;">&quot;length&quot;</span>:<span style="color: #000000;">3411</span>,<span style="color: #ff0000;">&quot;stub&quot;</span>:<span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Thats ugly&#8230; how about a nice screenshot!<br />
<a href="http://www.mywushublog.com/wp-content/uploads/2012/01/client-a.png"><img src="http://www.mywushublog.com/wp-content/uploads/2012/01/client-a-300x173.png" alt="" title="client-a" width="300" height="173" class="aligncenter size-medium wp-image-1649" /></a></p>
<p>Now that we have the Bacula tool pushing passwords and and certificates, we need to get Puppet to pull the data.</p>
<p>I found a github project called couchdblookup:<br />

https://github.com/camptocamp/puppet-couchdb/blob/master/lib/puppet/parser/functions/couchdblookup.rb</p>

<p>I placed that couchdblookup.rb file into one of my Puppet modules (etc/puppet/environments/production/bacula/lib/puppet/parser/functions/couchdblookup.rb), and created a bacula::fd::cert class:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> bacula::fd::cert inherits bacula::fd <span style="color:#006600; font-weight:bold;">&#123;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Pull bacula client password from our</span>
  <span style="color:#008000; font-style:italic;"># CouchDB server</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_bind_address</span> = <span style="color:#996600;">&quot;puppet.bayphoto.local&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_port</span> = <span style="color:#996600;">&quot;5984&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$couchdb_base_url</span> = <span style="color:#996600;">&quot;https://${couchdb_bind_address}:${couchdb_port}&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$bacula_meta</span> = <span style="color:#996600;">&quot;${couchdb_base_url}/bacula_meta/${hostname}&quot;</span>
  <span style="color:#ff6633; font-weight:bold;">$bacula_fd_cert</span> = <span style="color:#996600;">&quot;${couchdb_base_url}/bacula_meta/${hostname}/${fqdn}-fd.pem&quot;</span>
&nbsp;
  <span style="color:#ff6633; font-weight:bold;">$bacula_fd_passhash</span> = couchdblookup<span style="color:#006600; font-weight:bold;">&#40;</span>$bacula_meta, <span style="color:#996600;">&quot;passhash&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  file <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;master.cert&quot;</span>:
    name    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff6633; font-weight:bold;">$operatingsystem</span> ? <span style="color:#006600; font-weight:bold;">&#123;</span>
      FreeBSD  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/usr/local/etc/bacula/certs/master.cert&quot;</span>,
      windows  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;C:<span style="color:#000099;">\P</span>rogram Files<span style="color:#000099;">\B</span>acula<span style="color:#000099;">\m</span>aster.cert&quot;</span>,
      default  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/etc/bacula/certs/master.cert&quot;</span>,
    <span style="color:#006600; font-weight:bold;">&#125;</span>,
    owner   <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">0</span>,
    mode    <span style="color:#006600; font-weight:bold;">=&gt;</span> 0640,
    source  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;puppet:///bacula/master.cert&quot;</span>,
  <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  <span style="color:#CC0066; font-weight:bold;">exec</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;fd.cert&quot;</span>:
    path    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;/usr/bin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/bin&quot;</span>,<span style="color:#996600;">&quot;/bin&quot;</span>,<span style="color:#996600;">&quot;/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/sbin&quot;</span>,<span style="color:#996600;">&quot;/usr/local/libexec&quot;</span>,<span style="color:#996600;">&quot;/usr/libexec&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
    command <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff6633; font-weight:bold;">$operatingsystem</span> ? <span style="color:#006600; font-weight:bold;">&#123;</span>
      FreeBSD  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;fetch -o /usr/local/etc/bacula/certs/${fqdn}-fd.pem $bacula_fd_cert&quot;</span>,
      windows  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;C:/scripts/curl.exe -sk $bacula_fd_cert -o <span style="color:#000099;">\&quot;</span><span style="color:#000099;">\P</span>rogram Files<span style="color:#000099;">\B</span>acula<span style="color:#000099;">\\</span>${::fqdn}-fd.pem<span style="color:#000099;">\&quot;</span>&quot;</span>,
      default  <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;curl -sk $bacula_fd_cert -o /etc/bacula/certs/${fqdn}-fd.pem&quot;</span>,
    <span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>As you can see, I&#8217;m also working on getting Windows systems into our Puppet environment.</p>
<p>It is incredibly immature right now, and Windows lacks a lot of tools I take for granted. It would make my life a lot easier if Microsoft just tool all the BSD licensed userland tools like diff, fetch (or curl), md5, ssh, etc&#8230; to make my Puppet automation easier. You NEED diff.exe to use Puppet on windows, otherwise templating won&#8217;t work.</p>
<p>Aside from the windows side of things being a pain, this has been working out well enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2012/01/using-couchdb-with-puppet-and-bacula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchDB and Ruby on FreeBSD</title>
		<link>http://www.mywushublog.com/2011/06/couchdb-and-ruby-on-freebsd/</link>
		<comments>http://www.mywushublog.com/2011/06/couchdb-and-ruby-on-freebsd/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 02:47:41 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Puppet]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=1389</guid>
		<description><![CDATA[I&#8217;ve been using Puppet at work for the handful of FreeBSD and, recently, Ubuntu desktops. Aside from some very simple system configuration management (I&#8217;ve not yet dived too deep into puppet. I mostly use it for configuring system authentication and ensuring a particular computer security baseline), I though it would ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Puppet at work for the handful of FreeBSD and, recently, Ubuntu desktops.</p>
<p>Aside from some very simple system configuration management (I&#8217;ve not yet dived too deep into puppet. I mostly use it for configuring system authentication and ensuring a particular computer security baseline), I though it would have been great to store the client&#8217;s &#8220;facts&#8221; into a accessable database.</p>
<p>Sometime last year, Puppet added the ability to store facts into a Couch Database: <a href="http://www.puppetlabs.com/blog/couchdb-facts-terminus-for-puppet/">http://www.puppetlabs.com/blog/couchdb-facts-terminus-for-puppet/</a></p>
<p>I&#8217;m not using CentOS/RHEL or a Yum backed package system. I&#8217;m using FreeBSD with its Ports tree, so here is the equivalent command:</p>
<pre>
$ portinstall databases/couchdb
</pre>
<p><br/>Why one instead of the 3? Because Ruby 1.8 already exists on the system, as it get installed with the necessary tools such as portupgrade. That also includes the gem tool.</p>
<p>The next component the article listed was the couchrest rubygem:</p>
<pre>
$ gem install couchrest -v1.0.0
</pre>
<p><br/>That is where I had a slight problem. FreeBSD has a bunch of <strong>rubygem-*</strong> Ports, but not this one.</p>
<p>It is not that I can&#8217;t install the couchrest gem this way, FreeBSD can use Gem&#8217;s just like any OS. My problem is when you move out of the package management system your updating process ends up fragmented. I try very hard not to let this happen.</p>
<p>So how do I continue? I make a Port!</p>
<p>This was actually REALLY simple. First, I found another rubygem based port and copied it to a new structure called <strong>databases/rubygem-couchrest</strong>. I pulled up the <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index.html">FreeBSD&#8217;s Porters Handbook</a> and followed the quick instructions.</p>
<p>What is pretty handy about the Ports tree is all the heavy lifting it does for you. For example, if a project is hosted on SourceForge, you can define the MASTER_SITE variable as:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MASTER_SITE</span>=    SF</pre></div></div>

<p><br/>And it will look up the project on SF (using other variables such as PORTNAME and PORTVERSION).</p>
<p>Ruby Forge is also supported, so I just had to set the MASTER_SITES to RG and define the name and version. It took all but 5 minutes to make, build a checksum, and create this shell archive:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># This is a shell archive.  Save it in a file, remove anything before</span>
<span style="color: #666666; font-style: italic;"># this line, and then unpack it by entering &quot;sh file&quot;.  Note, it may</span>
<span style="color: #666666; font-style: italic;"># create directories; files and directories will be owned by you and</span>
<span style="color: #666666; font-style: italic;"># have default permissions.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This archive contains:</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#	rubygem-couchrest</span>
<span style="color: #666666; font-style: italic;">#	rubygem-couchrest/Makefile</span>
<span style="color: #666666; font-style: italic;">#	rubygem-couchrest/distinfo</span>
<span style="color: #666666; font-style: italic;">#	rubygem-couchrest/pkg-descr</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> c - rubygem-couchrest
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> rubygem-couchrest <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> x - rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>Makefile
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/^X//'</span> <span style="color: #000000; font-weight: bold;">&gt;</span>rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>Makefile <span style="color: #cc0000; font-style: italic;">&lt;&lt; '656a34e951167ae5d8b3571b3b30bce9'
X# Ports collection makefile for:	rubygem-couchrest
X# Date created:				20 June 2011
X# Whom:						Mike Carlson (carlson39@llnl.gov)
X#
X
XPORTNAME=	couchrest
XPORTVERSION=	1.0.2
XCATEGORIES=	databases rubygems
XMASTER_SITES=	RG
X
XMAINTAINER=	ruby@FreeBSD.org
XCOMMENT=	provides a simple interface on top of CouchDBs RESTful HTTP API
X
XRUN_DEPENDS=	rubygem-json&gt;=${PORTVERSION}:${PORTSDIR}/devel/rubygem-json \
X		rubygem-mime-types&gt;=${PORTVERSION}:${PORTSDIR}/misc/rubygem-mime-types \
X		rubygem-rest-client&gt;=${PORTVERSION}:${PORTSDIR}/www/rubygem-rest-client
X
XUSE_RUBY=   yes
XUSE_RUBYGEMS=   yes
XRUBYGEM_AUTOPLIST=  yes
X
X.include &lt;bsd.port.mk&gt;
656a34e951167ae5d8b3571b3b30bce9</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> x - rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>distinfo
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/^X//'</span> <span style="color: #000000; font-weight: bold;">&gt;</span>rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>distinfo <span style="color: #cc0000; font-style: italic;">&lt;&lt; 'fed48567690d00cc0666b4be7236926b'
XSHA256 (rubygem/couchrest-1.0.2.gem) = 55b62424feedba1cb936d7187c94875fbea8daf17962813deba0cf0c41c93c72
XSIZE (rubygem/couchrest-1.0.2.gem) = 45056
fed48567690d00cc0666b4be7236926b</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> x - rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>pkg-descr
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/^X//'</span> <span style="color: #000000; font-weight: bold;">&gt;</span>rubygem-couchrest<span style="color: #000000; font-weight: bold;">/</span>pkg-descr <span style="color: #cc0000; font-style: italic;">&lt;&lt; '72aefcf6ac70736e90967f68ab1bb671'
XCouchRest provides a simple interface on top of CouchDB's RESTful HTTP API, as well as including some utility scripts for managing views and attachments.
X
XWWW: http://rubygems.org/gems/couchrest
72aefcf6ac70736e90967f68ab1bb671</span>
<span style="color: #7a0874; font-weight: bold;">exit</span></pre></div></div>

<p><br/><br />
After running the gamut of &#8220;make&#8221; tests listed in the <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-testing.html">handbook</a>, I submitted a PR with the command-line tool called <a href="http://www.freebsd.org/cgi/man.cgi?query=send-pr&#038;sektion=1">send-pr(1)</a> that is build in to FreeBSD. You can see it in the queue <a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=158129">here</a></p>
<p>I don&#8217;t know if it will get approved, or how long it will take, but I&#8217;m happy that I took a step in contributing to the project. I&#8217;ve filed a few bugs, and I write about FreeBSD a lot, so this seems to be a good logical progression.</p>
<p>The end result is now I can follow the Puppet Blog entry on setting up and maintaining a CouchDB store for facts, and have a consistent updating method (via Ports that is). My hope is to have this become a source for our configuration management tool, and help us reconcile and keep hardware and OS information up to date.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2011/06/couchdb-and-ruby-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PuppetCamp09</title>
		<link>http://www.mywushublog.com/2009/10/puppetcamp09/</link>
		<comments>http://www.mywushublog.com/2009/10/puppetcamp09/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 22:17:30 +0000</pubDate>
		<dc:creator>Mike Carlson</dc:creator>
				<category><![CDATA[Geekyness]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Jenny]]></category>
		<category><![CDATA[kickassery]]></category>
		<category><![CDATA[port management]]></category>
		<category><![CDATA[Puppet]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.mywushublog.com/?p=512</guid>
		<description><![CDATA[This was a very cool conference. I picked up a lot of useful information on both the open source tool, Puppet, and some ideas on infrastructure. What also made this conference unique, is how honest the Puppet team and community were about the projects strength and weaknesses. Those that have ...]]></description>
			<content:encoded><![CDATA[<p>This was a very cool conference. I picked up a lot of useful information on both the open source tool, <a href="http://reductivelabs.com">Puppet</a>, and some ideas on infrastructure.</p>
<p>What also made this conference unique, is how honest the Puppet team and community were about the projects strength and weaknesses. Those that have deployed Puppet on a larger scale (MessageOne and Google) seemed to go through the same iterations in attempting to scale out their Puppetmaster&#8217;s. From WEBrick (which is what I&#8217;m currently running Puppet with :) ), which is hated by all since its a single process/thread web server that can only handle one request at a time. To Mongrel, which you have to manage a mongrel cluster script, feed it lots of memory, and then throw an apache proxy server in front of them. Now, people are starting to settle on using Passenger/mod_rack, which is what I spent most of yesterday looking into and setting up. This allows apache to mount a rails instance, and then you don&#8217;t actually have to run puppetmasterd. This still requires some decent hardware, and I&#8217;m currently running my puppetmaster on a VM with 2GB or memory, so I&#8217;ll have to watch out for that. <a href="http://www.zeus.com/resources/case_studies/greatschools.html">Chris</a>, the one who introduced me to Puppet, said he still uses WEBrick for all of his DB, Tomcat, and Apache servers (I think he said something like 200 systems) and it has been working out nicely. He, like the guys at Google, also doesn&#8217;t run puppet as a daemon.</p>
<p>Anyway, the point is, we learned a lot about the project, way more than if a sales person had come to us and just told us the things puppet does well, or how it operates on paper (*cough* LANDesk *cough*). It was really awesome to talk with Andrew Pollock and <a href="http://explanatorygap.net/">Nigel Kersten</a> from Google. See, I was a little unsure about Puppet in our environment, where we have multi-purpose servers, computer servers, and desktops that we have to manage. It seemed, at a first glance, that most of the Puppet users out there have a homogeneous environment, and <a href="http://stochasticresonance.wordpress.com/">Andrew (Shafer)</a> had stressed the concept of single role servers. After talking with them, I felt a lot more comfortable pursuing Puppet across our servers and desktops. Did I mention they were super cool and friendly?</p>
<p>We also learned a lot about the Puppet developers, which had its own interesting advantage. I have a lot of respect for what <a href="http://madstop.com/">Luke Kanies</a> has been able to do, and by the end of the conference, he showed significant mastery in what he has done, as well as some humility and admitting what he has not been able to do and why. I was a little put off the first day though, when both him and Andrew came off a little arrogant and crass. It did make me step back and think, &#8220;Is this project going to be well managed in the future with personalities like this in charge? Is their answer of &#8216;don&#8217;t do that!&#8217; tongue in cheek, or are they not supportive of a diverse environment?&#8221;. In the end, I have more respect for the project than ever, and with it still being a young project, I hope they listened to some of the feedback, and I also can&#8217;t wait to see where it ends up in the next year.</p>
<p>Andrew, the Puppet Andrew, came up to us a lot during the conference, and he was fun to talk too, and he&#8217;s very academic and he had a lot of abstract concepts to talk about. Also, he said this was the first conference he has arranged, and I think he did a fantastic job. Jenny had commented that this was the first conference she had lasted the entire duration, so that says a lot about the pacing and content of PuppetCamp. I felt the same way, every session was incredibly engaging, and how Andrew had setup the democratic and chaotic Open Sessions was very impressive. Lets put it this way, I even got up there and pitched a topic, which is something I would have never done. Hurray for me stepping outside of my comfort zone!</p>
<h2>Warning: side topic!</h2>
<p>Now that I&#8217;ve had the weekend to google all the cool technologies I was exposed too, I&#8217;m also reminded why I really like having a FreeBSD server at my disposal. They had talked about CouchDB, so on a whim I did a<br />
<code><br />
~> cd /usr/ports<br />
/usr/ports> make search name=couchdb<br />
Port:	couchdb-0.9.0_1,1<br />
Path:	/usr/ports/databases/couchdb<br />
Info:	A document database server, accessible via a RESTful JSON API<br />
Maint:	till@php.net<br />
B-deps:	ca_root_nss-3.11.9_2 curl-7.19.6_1 erlang-lite-r13b01_6,1 gettext-0.17_1 gmake-3.81_3 icu-3.8.1_2 libiconv-1.13.1 libtool-2.2.6a nspr-4.8 perl-5.8.9_3 spidermonkey-1.7.0<br />
R-deps:	ca_root_nss-3.11.9_2 curl-7.19.6_1 erlang-lite-r13b01_6,1 gettext-0.17_1 gmake-3.81_3 icu-3.8.1_2 libiconv-1.13.1 libtool-2.2.6a nspr-4.8 perl-5.8.9_3 spidermonkey-1.7.0<br />
WWW:	http://couchdb.org/</code><br />
<code><br />
Port:	py26-simplecouchdb-0.9.26<br />
Path:	/usr/ports/databases/py-simplecouchdb<br />
Info:	Simple Librairy to Allow Python Applicationto Use CouchDB<br />
Maint:	wenheping@gmail.com<br />
B-deps:	py26-httplib2-0.5.0 py26-py-restclient-1.3.2 py26-setuptools-0.6c9 python26-2.6.2_3<br />
R-deps:	py26-httplib2-0.5.0 py26-py-restclient-1.3.2 py26-setuptools-0.6c9 python26-2.6.2_3<br />
WWW:	http://code.google.com/p/py-simplecouchdb/<br />
</code><br />
I did a &#8216;make install&#8217;, and I had a cool little couchdb up and running. What is also cool is FreeBSD likes to give you very helpful information when you install something. For example, this is what is printed out when you install the CouchDB port:<br />
<code><br />
===>  COMPATIBILITY NOTE:<br />
      CouchDB is still pre-stable; between 0.8 and 0.9 the database format<br />
      changed which breaks BC. In current trunk, the format changed again, so<br />
      please double-check in case you are updating an existing installation.</p>
<p>      More info:<br />
        * http://wiki.apache.org/couchdb/Breaking_changes?action=show&#038;redirect=BreakingChanges<br />
        * http://wiki.apache.org/couchdb/BreakingChangesUpdateTrunkTo0Dot9<br />
</code><br />
See, isn&#8217;t that helpful? Best of all, I didn&#8217;t have to enable additional repositories, or fetch the src manually, and its dependencies and then figure out how to run the right configure script flags&#8230; FreeBSD makes it easy, and since it automatically uses what you already have with what is required, its an incredibly stable build. Removing it is pretty simple as well, just:<br />
<code><br />
> pkg_deinstall -R couchdb<br />
--->  Deinstalling 'couchdb-0.9.0_1,1'<br />
--->  Deinstalling 'erlang-lite-r13b02,1'<br />
[Updating the pkgdb<br />
<format:bdb_btree> in /var/db/pkg ... - 118 packages found (-1 +0) (...) done]<br />
--->  Deinstalling 'curl-7.19.6_1'<br />
[Updating the pkgdb<br />
<format:bdb_btree> in /var/db/pkg ... - 117 packages found (-1 +0) (...) done]<br />
--->  Deinstalling 'ca_root_nss-3.11.9_2'<br />
--->  Deinstalling 'spidermonkey-1.7.0'<br />
--->  Deinstalling 'nspr-4.8'<br />
[Updating the pkgdb<br />
<format:bdb_btree> in /var/db/pkg ... - 116 packages found (-1 +0) (...) done]<br />
--->  Deinstalling 'gmake-3.81_3'<br />
[Updating the pkgdb<br />
<format:bdb_btree> in /var/db/pkg ... - 115 packages found (-1 +0) (...) done]<br />
--->  Deinstalling 'perl-threaded-5.8.9_3'<br />
[Updating the pkgdb<br />
<format:bdb_btree> in /var/db/pkg ... - 114 packages found (-1 +0) (...) done]<br />
--->  Deinstalling 'gettext-0.17_1'<br />
--->  Deinstalling 'libiconv-1.13.1'<br />
--->  Deinstalling 'icu-3.8.1_2'<br />
--->  Deinstalling 'libtool-2.2.6a'<br />
** Listing the failed packages (-:ignored / *:skipped / !:failed)<br />
	! curl-7.19.6_1	(pkg_delete failed)<br />
	! ca_root_nss-3.11.9_2	(pkg_delete failed)<br />
	! perl-threaded-5.8.9_3	(pkg_delete failed)<br />
	! gettext-0.17_1	(pkg_delete failed)<br />
	! libiconv-1.13.1	(pkg_delete failed)<br />
</code><br />
This does a upwards recursive dependency removal. Also, if one dependency is relied on by another, it wont get removed. Like, if Perl58 was a dependency of a package, it wouldn&#8217;t be removed if perl58 is used by many other packages. This is smart. So, above, the packages that failed to deinstall where ones that are required dependencies of other installed packages.</p>
<p>Speaking of package management; have you ever installed something that ended up having a few dozen dependencies, then you want to uninstall that package with a &#8220;rpm -e cba8&#8243;, or something equivalent, but what about all the other cruft that came along with it? You would have to keep track of each dependency, and specify all of them and hope you don&#8217;t break another program. FreeBSD has a few tools to do this, one in particular, <strong>portmaster</strong> can remove all ports that were once a dependency but no longer used:<br />
<code><br />
> portmaster -s<br />
Information for neon28-0.28.4:<br />
Comment:<br />
An HTTP and WebDAV client library for Unix systems<br />
===>>> neon28-0.28.4 is no longer depended on, delete? [n] y<br />
===>>> Delete old and new distfiles for www/neon28<br />
       without prompting? [n] y<br />
===>>> Running pkg_delete -f neon28-0.28.4<br />
Information for rubygem-actionwebservice-1.2.6:<br />
...<br />
</code><br />
I ended up removing 4 packages that were no longer used.</p>
<p>CentOS and RHEL are the larger Puppet consumers, I&#8217;m still a big proponent for FreeBSD, and at work, it has allowed me to quickly build an Apache + Puppet + RubyPassenger/mod_rack stack with the minimal dependencies installed. So, the puppet server is still pretty lean, which means updates are smaller and faster. It still surprises me that its relatively unknown, even though Netcraft always has it listed in the top domains with the best uptime and consistently growing over the years. Why do I feel like an AmigaOS fan sometimes?</p>
<p>Hmm, it is sort of weird that this turned into a FreeBSD ports management entry :)</p>
<p>Okay, final word: PuppetCamp09 was Freaking awesome. There were a lot of smart developers and sysadmins there. We even got a very cool git howto, which I found useful. It was very diverse, which is strange for a conference based on one project in particular.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mywushublog.com/2009/10/puppetcamp09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.mywushublog.com/tag/puppet/feed/ ) in 0.47135 seconds, on Feb 5th, 2012 at 10:58 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 5th, 2012 at 11:58 am UTC -->
