<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for hugoduncan</title>
    <link>http://www.advogato.org/person/hugoduncan/</link>
    <description>Advogato blog for hugoduncan</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Wed, 19 Jun 2013 23:54:07 GMT</pubDate>
    <item>
      <pubDate>Tue, 5 Oct 2010 13:10:43 GMT</pubDate>
      <title>Configure Nagios using Pallet</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=5</link>
      <guid>http://hugoduncan.org/post/2010/configure_nagios_using_pallet.xhtml</guid>
      <description>&lt;content type="xhtml"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;Basic Nagios support was recently added to &lt;a href="http://github.com/hugoduncan/pallet" &gt;pallet&lt;/a&gt;, and while very simple to use, this blog post should make it even simpler. The overall philosophy is to configure the nagios service monitoring definitions along with the service itself, rather than have monolithic nagios configuration, divorced from the configuration of the various nodes.&lt;/p&gt;&lt;p&gt;As an example, we can configure a machine to have it's ssh service, CPU load, number of processes and number of users monitored. Obviously, you would normally be monitoring several different types of nodes, but there is no difference as far as pallet is concerned.&lt;/p&gt;&lt;p&gt;We start by requiring various pallet components.  These would normally be part of a &lt;code&gt;ns&lt;/code&gt; declaration, but are provided here for ease of use at the REPL.&lt;/p&gt;&lt;pre class="clojure"&gt;
(require
  '[pallet.crate.automated-admin-user
    :as admin-user]
  '[pallet.crate.iptables :as 'iptables]
  '[pallet.crate.ssh :as ssh]
  '[pallet.crate.nagios-config
     :as nagios-config]
  '[pallet.crate.nagios :as nagios]
  '[pallet.crate.postfix :as postfix]
  '[pallet.resource.service :as service])
&lt;/pre&gt;&lt;h2&gt;Node to be Monitored by Nagios&lt;/h2&gt;&lt;p&gt;Now we define the node to be monitored. We set up a machine that has &lt;abbr&gt;SSH&lt;/abbr&gt; running, and configure &lt;code&gt;iptables&lt;/code&gt; to allow access to &lt;abbr&gt;SSH&lt;/abbr&gt;, with a throttled connection rate (six connections/minute by default).&lt;/p&gt;&lt;pre class="clojure"&gt;
(pallet.core/defnode monitored
  []
  :bootstrap [(admin-user/automated-admin-user)]
  :configure [;; set iptables for restricted access
              (iptables/iptables-accept-icmp)
              (iptables/iptables-accept-established)
              ;; allow connections to ssh
              ;; but throttle connection requests
              (ssh/iptables-throttle)
              (ssh/iptables-accept)])
&lt;/pre&gt;&lt;p&gt;Monitoring of the &lt;abbr&gt;SSH&lt;/abbr&gt; service is configured by simply adding
&lt;code&gt;(ssh/nagios-monitor)&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Remote monitoring is implemented using nagios' &lt;code&gt;nrpe&lt;/code&gt; plugin, which we add with &lt;code&gt;(nagios-config/nrpe-client)&lt;/code&gt;.  To make nrpe accessible to the nagios server, we open the that the nrpe agent runs on using &lt;code&gt;(nagios-config/nrpe-client-port)&lt;/code&gt;, which restricts access to the nagios server node. We also add a phase, :restart-nagios, that can be used to restart the nrpe agent.&lt;/p&gt;&lt;p&gt;Pallet comes with some configured nrpe checks, and we add &lt;code&gt;nrpe-check-load&lt;/code&gt;, &lt;code&gt;nrpe-check-total-proces&lt;/code&gt; and &lt;code&gt;nrpe-check-users&lt;/code&gt;. The final configuration looks like this:&lt;/p&gt;&lt;pre class="clojure"&gt;
(pallet.core/defnode monitored
  []
  :bootstrap [(admin-user/automated-admin-user)]
  :configure [;; set iptables for restricted access
              (iptables/iptables-accept-icmp)
              (iptables/iptables-accept-established)
              ;; allow connections to ssh
              ;; but throttle connection requests
              (ssh/iptables-throttle)
              (ssh/iptables-accept)
              ;; monitor ssh
              (ssh/nagios-monitor)
              ;; add nrpe agent, and only allow
              ;; connections from nagios server
              (nagios-config/nrpe-client)
              (nagios-config/nrpe-client-port)
              ;; add some remote checks
              (nagios-config/nrpe-check-load)
              (nagios-config/nrpe-check-total-procs)
              (nagios-config/nrpe-check-users)]
  :restart-nagios [(service/service
                    "nagios-nrpe-server"
                    :action :restart)])
&lt;/pre&gt;&lt;h2&gt;Nagios Server&lt;/h2&gt;&lt;p&gt;We now configure the nagios server node. The nagios server is installed with &lt;code&gt;(nagios/nagios "nagiospwd")&lt;/code&gt;, specifying the password for the nagios web interface, and add a phase, :restart-nagios, that can be used to restart nagios.&lt;/p&gt;&lt;p&gt;Nagios also requires a &lt;abbr&gt;MTA&lt;/abbr&gt; for notifications, and here we install postfix.  We add a contact, which we make a member of the "admins" contact group, which is notified as part of the default host and service templates.&lt;/p&gt;&lt;pre class="clojure"&gt;
(pallet.core/defnode nagios
  []
  :bootstrap [(admin-user/automated-admin-user)]
  :configure [;; restrict access
              (iptables/iptables-accept-icmp)
              (iptables/iptables-accept-established)
              (ssh/iptables-throttle)
              (ssh/iptables-accept)
              ;; configure MTA
              (postfix/postfix
               "pallet.org" :internet-site)
              ;; install nagios
              (nagios/nagios "nagiospwd")
              ;; allow access to nagios web site
              (iptables/iptables-accept-port 80)
              ;; configure notifications
              (nagios/contact
              {:contact_name "hugo"
               :service_notification_period "24x7"
               :host_notification_period "24x7"
               :service_notification_options
                  "w,u,c,r"
               :host_notification_options
                  "d,r"
               :service_notification_commands
                 "notify-service-by-email"
               :host_notification_commands
                  "notify-host-by-email"
               :email "my.email@my.domain"
               :contactgroups [:admins]})]
  :restart-nagios [(service/service "nagios3"
                     :action :restart)])
&lt;/pre&gt;&lt;h2&gt;Trying it out&lt;/h2&gt;&lt;p&gt;That's it. To fire up both machines, we use pallet's &lt;code&gt;converge&lt;/code&gt; command.&lt;/p&gt;&lt;pre class="clojure"&gt;
(pallet.core/converge
  {monitored 1 nagios 1} service
  :configure :restart-nagios)
&lt;/pre&gt;&lt;p&gt;The nagios web interface is then accessible on the &lt;code&gt;nagios&lt;/code&gt; node with the &lt;code&gt;nagiosadmin&lt;/code&gt; user and specified password.  Real world usage would probably have several different monitored configurations, and restricted access to the &lt;code&gt;nagios&lt;/code&gt; node.&lt;/p&gt;&lt;h2&gt;Still to do...&lt;/h2&gt;&lt;p&gt;Support for nagios is not complete (e.g. remote command configuration still needs to be added, and it has only been tested on Ubuntu), but I would appreciate any feedback on the general approach.&lt;/p&gt;&lt;/div&gt;&lt;/content&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 14 Sep 2009 04:10:18 GMT</pubDate>
      <title>A Clojure library for FluidDB</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=4</link>
      <guid>http://hugoduncan.org/post/2009/a_clojure_library_for_fluiddb.xhtml</guid>
      <description>&lt;content type="xhtml"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;&lt;a href="http://fluidinfo.com/" &gt;FluidDB&lt;/a&gt;, a "cloud" based triple-store, where the objects are immutable and can be tagged by anyone, launched about a month ago. As a another step to getting up to speed with &lt;a href="http://clojure.org" &gt;Clojure&lt;/a&gt;, I decided to write a client library, and &lt;a href="http://github.com/hugoduncan/clj-fluiddb" &gt;clj-fluiddb&lt;/a&gt; was born.  The code was very simple, especially as I could base the library on &lt;a href="http://github.com/hdurer/cl-fluiddb" &gt;cl-fluiddb&lt;/a&gt;, a Common-Lisp library.&lt;/p&gt;&lt;p&gt;I have some ideas I want to try out using FluidDB.  It's permission system is one of it's &lt;a href="http://abouttag.blogspot.com/2009/09/permissions-worth-getting-excited-about.html" &gt;best features&lt;/a&gt;, together with the ability to &lt;a href="http://www.xavierllora.net/2009/08/25/liquid-rdf-meandering-in-fluiddb/" &gt;use it for RDF like triples&lt;/a&gt; means that it could provide a usable basis for growing the semantic web.  My ideas are less grandiose, but might take as long to develop, we'll see...&lt;/p&gt;&lt;/div&gt;&lt;/content&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 31 Aug 2009 04:15:18 GMT</pubDate>
      <title>Product Development Flow</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=3</link>
      <guid>http://hugoduncan.org/post/2009/product_development_flow.xhtml</guid>
      <description>&lt;content type="xhtml"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;I have spent the last few months with my latest start-up, &lt;a href="http://artfox.com" &gt;Artfox&lt;/a&gt;, where I have been trying to push home some of the lean start-up advice expounded by &lt;a href="http://startuplessonslearned.blogspot.com" &gt;Eric Lie's&lt;/a&gt; and &lt;a href="http://steveblank.com/" &gt;Steve Blank&lt;/a&gt;.  I was hoping that "The Principles of Product Development Flow", by &lt;a href="http://www.reinertsenassociates.com/" &gt;Donald Reinertsen&lt;/a&gt;, might help me in making a persuasive argument for some of the more troublesome concepts around minimum viable product and ensuring that feedback loops are in place with your customers as soon as possible. Unfortunately, I don't think that this is the book if you are looking for immediate, practical prescription, but it is a thought provoking, rigorous view of the product development process, that pulls together ideas from manufacturing, telecommunications and the Marines.&lt;/p&gt;&lt;p&gt;Perhaps Reinertsen's most accessible advice is that decisions in product development should be based on a strong economic foundation, pulled together by a concept of the "Cost of Delay".  Rather than on relying on prescriptions for each of several interconnected metrics, such as efficiency and utilisation, Reinertsen suggests that economics will provide different targets for each of these metrics depending on the costs of the project at hand.&lt;/p&gt;&lt;p&gt;His proposition that product development organisations should measure "Design in Process", similar to the idea of "Intellectual Working In Process" proposed by Thomas Stewart in his book "Intellectual Capital", is what allows him to make the parallels to manufacturing and queueing theory and enables the application of the wide body of work in these fields to product development.&lt;/p&gt;&lt;p&gt;His practical advice, such as working in small batches and using a cadence for activities that require coordination, will come as no surprise to practitioners of agile development, and Reinertsen provides clear reasoning of why these practices work.&lt;/p&gt;&lt;p&gt;During my time at Alcan, and later Novelis, I gave a lot of thought to scheduling, queues and cycle times in a transformation based manufacturing environment, and I found that this had many parallels to his view of the product development process, and little in common with what Reinertsen describes as manufacturing, which seems to be limited to high volume assembly type operations.  I found many ideas that could be usefully taken back to a manufacturing context.&lt;/p&gt;&lt;p&gt;If you look at this book as an introduction to scheduling, queueing theory and the reason's behind some of agile development practices, then you will not be disappointed.&lt;/p&gt;&lt;/div&gt;&lt;/content&gt;</description>
    </item>
    <item>
      <pubDate>Wed, 8 Apr 2009 04:08:15 GMT</pubDate>
      <title>Rails Environments For Lisp</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=2</link>
      <guid>http://hugoduncan.org/post/2009/rails_environments_for_lisp.xhtml</guid>
      <description>&lt;content type="xhtml"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;The facility of Ruby on Rails' test, development and production environments is one of those features that goes almost unremarked, but which makes using rails more pleasant.  No doubt everyone has their own solution for this in other environments, and while I am sure Common Lisp is not lacking in examples, I have not seen an idiomatic implementation.  In developing &lt;a href="http://github.com/hugoduncan/cl-blog-generator" &gt;cl-blog-generator&lt;/a&gt; I came up with the following solution.&lt;/p&gt;&lt;p&gt;Configuration in Common Lisp usually depends on using special variables, which can be rebound across any block of code.  I started by putting the configuration of my blog into s-expressions in files, but got tired of specifying the file names for different blogs.  Instead, I created an association list for each configuration, and registered each using a symbol as key.  I can now switch to a given environment by specifying the symbol for the environment.
&lt;/p&gt;&lt;p&gt;The implementation (in &lt;code&gt;src/configure.lisp&lt;/code&gt; under the &lt;a href="http://github.com/hugoduncan/cl-blog-generator" &gt;GitHub repository&lt;/a&gt;) consists of two functions and a special variable.  &lt;code&gt;SET-ENVIRONMENT&lt;/code&gt; is used to register an environment, and &lt;code&gt;CONFIGURE&lt;/code&gt; is used to make an environment active.  The environments are stored in &lt;code&gt;*ENVIRONMENTS*&lt;/code&gt; special as an association list.  An example of setting up the configurations can be seen in the &lt;code&gt;config.lisp&lt;/code&gt; file.  In creating the configurations I drop the '*' from the special names.&lt;/p&gt;&lt;p&gt;I'm relatively new to CL, so let me now if I have overlooked anything.  Writing this post makes me think I am missing a &lt;code&gt;WITH-ENVIRONMENT&lt;/code&gt; macro ...&lt;/p&gt;&lt;/div&gt;&lt;/content&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 31 Mar 2009 05:13:58 GMT</pubDate>
      <title>cl-blog-generator Gets Comments</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=1</link>
      <guid>http://hugoduncan.org/post/2009/cl_blog_generator_gets_comments.xhtml</guid>
      <description>&lt;content type="xhtml"&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;I have now added a comment system to &lt;a href="http://github.com/hugoduncan/cl-blog-generator" &gt;cl-blog-generator&lt;/a&gt;.  My requirements were for a simple, low overhead, commenting system, preferable one that could possibly be fully automated.&lt;/p&gt;&lt;p&gt;The comment system was inspired by &lt;a href="http://www.steve.org.uk/Software/chronicle/" &gt;Chronicle&lt;/a&gt;'s, with a slight modification in approach - the comments are never saved on the web server, and are just sent by email to a dedicated email address.  Spam filtering is delegated to the whatever spam filtering is implemented on the mail server, or in your email client.  The comment emails are then processed in CL using &lt;a href="http://common-lisp.net/project/mel-base/" &gt;mel-base&lt;/a&gt; and written to the local filesystem.  Moderation can optionally occur on the CL side, if that is preferable to using the email client.&lt;/p&gt;&lt;p&gt;There is still some work left to do - I would like to be able to switch off comments on individual posts, either on demand on after a default time period - but I thought I would let real world usage drive my development.&lt;/p&gt;&lt;/div&gt;&lt;/content&gt;</description>
    </item>
    <item>
      <pubDate>Fri, 27 Mar 2009 16:24:24 GMT</pubDate>
      <title>27 Mar 2009</title>
      <link>http://www.advogato.org/person/hugoduncan/diary.html?start=0</link>
      <guid>http://www.advogato.org/person/hugoduncan/diary.html?start=0</guid>
      <description>&lt;p&gt;&#xD;
I recently uploaded some links to my &#xD;
&lt;a href="http://github.com/hugoduncan/cl-blog-generator" &gt;&#xD;
cl-blog-generator&lt;/a&gt; project, and have been getting some &#xD;
feedback with comparisons to other blog site generators, or &#xD;
compilers, such as &#xD;
&lt;a href="http://www.advogato.org/person/Stevey/" &gt;Steve &#xD;
Kemp&lt;/a&gt;'s &#xD;
&lt;a href="http://www.steve.org.uk/Software/&#xD;
chronicle/" &gt;Chronicle&lt;/a&gt;, or &#xD;
&lt;a href="http://github.com/mojombo/jekyll" &gt;Jekyll&lt;/a&gt; as &#xD;
used on &#xD;
&lt;a href="http://github.com/blog/272-github-pages" &gt;GitHub &#xD;
Pages&lt;/a&gt;.  Compared to these, cl-blog-generator is &#xD;
immature, but takes a different approach in several areas &#xD;
that &lt;a href="http://advogato.org/person/chalst/" &gt;Charles &#xD;
Stewart&lt;/a&gt; suggested might be worth exploring.  I look &#xD;
forward to any comments you might have.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;&lt;b&gt;Formatting&lt;/b&gt;&#xD;
&lt;p&gt;&#xD;
All the blog generators seem to use a file based approach &#xD;
for writing content, but they differ in the choice of input &#xD;
formats supported, and in the approach to templating.&#xD;
&lt;code&gt;cl-blog-generator&lt;/code&gt; is the least flexible, &#xD;
requiring input in XHTML, while &lt;code&gt;Chronicle&lt;/code&gt; &#xD;
allows HTML, Textile or Markdown, and &lt;code&gt;Jekyll&lt;/code&gt; &#xD;
Textile or Markdown.  For templates, &lt;code&gt;Chronicle&lt;/code&gt; &#xD;
uses Perl's &lt;a href="http://search.cpan.org/~samtregar/HTML-&#xD;
Template-2.9/Template.pm" &gt;HTML::Template&lt;/a&gt;, and &#xD;
&lt;code&gt;Jekyll&lt;/code&gt; uses &lt;a href="http://&#xD;
www.liquidmarkup.org/" &gt;Liquid&lt;/a&gt;. &#xD;
&lt;code&gt;cl-blog-generator&lt;/code&gt; uses an approach which &#xD;
substitutes content into &#xD;
elements identified with specific id's or classes, similar &#xD;
to transforming the templates with XSLT.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;&#xD;
&lt;code&gt;cl-blog-generator&lt;/code&gt;'s choice of XHTML input was &#xD;
driven by a requirement to enable the validation of post &#xD;
content in the editor, which is not possible using &#xD;
&lt;code&gt;Chronicle&lt;/code&gt;'s HTML input because of the headers &#xD;
and lack of a &lt;code&gt;body&lt;/code&gt; or &lt;code&gt;head&lt;/code&gt; &#xD;
element, and a desire to be able to use any CSS tricks I &#xD;
wanted, which ruled out Textile and Markdown, or any other &#xD;
markup language.  The lack of an external templating engine &#xD;
in &lt;code&gt;cl-blog-generator&lt;/code&gt; was driven by simplicity; &#xD;
I couldn't see a use for conditionals or loops given the &#xD;
fixed structure of the content, and this choice leads to &#xD;
templates that validate, unlike &lt;code&gt;Jekyll&lt;/code&gt;, and &#xD;
which are not full of HTML comments.  The current id and &#xD;
class naming scheme in &lt;code&gt;cl-blog-generator&lt;/code&gt; could &#xD;
certainly use some refinement to improve the flexibility of &#xD;
the output content format, and I would definitely welcome &#xD;
requests for enhancements should the scheme not fit your &#xD;
requirements.&#xD;
&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;b&gt;Database and Two Phase Publishing&lt;/b&gt;&#xD;
&lt;p&gt;&#xD;
Perhaps the most significant difference in approach for &#xD;
&lt;code&gt;cl-blog-generator&lt;/code&gt; is its use of a database and &#xD;
an explicit publish step.  &#xD;
With &lt;code&gt;cl-blog-generator&lt;/code&gt; a draft can exist &#xD;
anywhere in the filesystem, and &#xD;
must be "published" to be recognised by the blog site &#xD;
generator.  The publishing process fills in some default &#xD;
metadata, such as post date, if this is not originally &#xD;
specified, copies the modified draft to a configurable &#xD;
location, and enters the metadata into the database.  This &#xD;
ensures that the post is completely specified by its &#xD;
representation in the filesystem, and that the database is &#xD;
recreatable.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt;&#xD;
The database enables the partial regeneration of the site, &#xD;
without having to parse the whole site, and makes the &#xD;
linking of content much simpler.&#xD;
However, having &lt;a href="http://common-lisp.net/project/&#xD;
elephant/" &gt;Elephant&lt;/a&gt; as a dependency is probably the &#xD;
largest impediment to installation at present.&#xD;
&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;b&gt;On Titles, Dates, Tags and Filenames&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;code&gt;cl-blog-generator&lt;/code&gt;'s input XHTML has &#xD;
been &#xD;
augmented to add elements for specifying post title, date, &#xD;
update date (which I believe is missing from the other &#xD;
systems), slug, description, and tags.  On publising (see &#xD;
next section), any of these elements that is missing, &#xD;
except the mandatory title, is filled in with defaults.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;Both &lt;code&gt;Chronicle&lt;/code&gt; and &lt;code&gt;Jekyll&lt;/code&gt; &#xD;
use &#xD;
a preamble to specify metadata, with the filename being &#xD;
used to generate the post's slug. &lt;code&gt;Jekyll&lt;/code&gt; also &#xD;
uses the filename and its path for specifying the post &#xD;
date, and tags.&#xD;
&#xD;
&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;b&gt;Bells and Whistles&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;Finally, here is a grab bag of features.&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;&#xD;
&lt;code&gt;Chronicle&lt;/code&gt; comes with a commenting system.&#xD;
&#xD;
&lt;p&gt; &lt;li&gt;&#xD;
&lt;code&gt;cl-blog-generator&lt;/code&gt; generates a &lt;code&gt;meta&#xD;
&lt;/code&gt; description element, which is used by search &#xD;
engines &#xD;
to generate link text.  It also generates &lt;code&gt;meta&lt;/code&gt; &#xD;
elements with links to the previous and next posts.&#xD;
&#xD;
&lt;p&gt; &lt;li&gt;&#xD;
&lt;code&gt;Jekyll&lt;/code&gt; has a "Related posts" feature for &#xD;
generating links to similar posts.&#xD;
&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;li&gt; &lt;code&gt;Chronicle&lt;/code&gt; and &lt;code&gt;Jekyll&lt;/code&gt; &#xD;
both &#xD;
have migration scripts for importing content. &#xD;
&lt;li&gt; &lt;code&gt;Chronicle&lt;/code&gt; has a spooler for posting pre-&#xD;
written content at specific times&#xD;
&lt;/ul&gt;&#xD;
</description>
    </item>
  </channel>
</rss>
