<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom"
  xml:lang="en"
  xml:base="http://www.greenhills.co.uk/">
  <title>Martijn Koster&#39;s Pages</title>
  <link href="http://www.greenhills.co.uk/"/>
  <link type="application/atom+xml" rel="self" href="http://www.greenhills.co.uk/atom.xml"/>
  <updated>2013-05-22T16:25:30+00:00</updated>
  <id>http://www.greenhills.co.uk/</id>
  <author>
    <name>Martijn Koster</name>
    <email>makuk66@gmail.com</email>
  </author>

  
  <entry>
    <id>http://www.greenhills.co.uk/2013/05/22/installing-distributed-solr-4-with-fabric</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2013/05/22/installing-distributed-solr-4-with-fabric.html"/>
    <title>Installing Distributed Solr 4 with Fabric</title>
    <updated>2013-05-22T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I wrote an article &lt;a href=&quot;http://searchhub.org/2013/05/22/installing-distributed-solr-4-with-fabric/&quot;&gt;“Installing Distributed Solr 4 with Fabric”&lt;/a&gt;
about deploying SolrCloud with &lt;a href=&quot;http://www.fabfile.org/&quot;&gt;Fabric&lt;/a&gt;.
Code is on &lt;a href=&quot;https://github.com/LucidWorks/solr-fabric&quot;&gt;github.com/LucidWorks/solr-fabric&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My &lt;a href=&quot;http://www.greenhills.co.uk/2013/03/24/cloning-vms-with-kvm.html&quot;&gt;VM strategy&lt;/a&gt;
and &lt;a href=&quot;http://www.greenhills.co.uk/2013/03/16/supermicro-server-for-virtualisation.html&quot;&gt;server&lt;/a&gt; worked great for developing/testing this!&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2013/05/12/a-mini-itx-server</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2013/05/12/a-mini-itx-server.html"/>
    <title>A Mini-ITX server</title>
    <updated>2013-05-12T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I put together a small server today, to serve as DVR server for a CCTV system.&lt;/p&gt;

&lt;h2 id=&quot;requirements&quot;&gt;Requirements&lt;/h2&gt;

&lt;p&gt;This server connects to an office LAN and a separate LAN for the IP cameras,
so I needed two network interfaces.
It lives in a small, minimally ventilated room, so I wanted a small form factor,
 but with sufficient airflow and enough space to work with comfortably.
The room is used as an office, so I wanted minimal noise.
The software is used remotely; there is no permanently connected
screen/keyboard, so I wanted remote management.
I wanted virtualisation support (VT-x and VT-d), but have no need for too much
CPU power.
This machine is not mission-critical, so there is no need for RAID.&lt;/p&gt;

&lt;h2 id=&quot;parts&quot;&gt;Parts&lt;/h2&gt;

&lt;p&gt;To satisfy the minimal size/noise requirements I chose a Mini-ITX case.
There are not many Mini-ITX motherboards that offer dual ethernet,
virtualisation, and remote management.
I’ve been intrigued by the DQ77KB’s unusual features for some time, and
after some further research, and some advice from
&lt;a href=&quot;http://www.mini-itx.com/&quot;&gt;mini-itx.com&lt;/a&gt; (thanks Ewan!),
I settled on the following specification:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Silverstone SUGO &lt;a href=&quot;http://www.silverstonetek.com/product.php?pid=210&quot;&gt;SG05B&lt;/a&gt; Mini-ITX Chassis&lt;/li&gt;
  &lt;li&gt;Intel &lt;a href=&quot;http://www.intel.com/content/www/us/en/motherboards/desktop-motherboards/desktop-board-dq77kb.html&quot;&gt;DQ77KB&lt;/a&gt; Socket 1155 Thin-ITX Motherboard&lt;/li&gt;
  &lt;li&gt;Intel &lt;a href=&quot;http://ark.intel.com/products/68315/Intel-Core-i5-3470S-Processor-6M-Cache-up-to-3_60-GHz&quot;&gt;i5-3470S&lt;/a&gt; 3rd Gen Core 2.9GHz CPU&lt;/li&gt;
  &lt;li&gt;External 160W AC Adapter 19V&lt;/li&gt;
  &lt;li&gt;Akasa &lt;a href=&quot;http://www.akasa.co.uk/update.php?tpl=product/cpu.product.tpl&amp;amp;no=181&amp;amp;type=CPU%20coolers&amp;amp;type_sub=Low%20Profile&amp;amp;model=AK-CCE-7106HP&quot;&gt;7106HP&lt;/a&gt; Low Profile Heatsink&lt;/li&gt;
  &lt;li&gt;Kingston &lt;a href=&quot;http://www.valueram.com/datasheets/KVR1333D3S9_8G.pdf&quot;&gt;8GB DDR3 1333 SODIMM&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Intel &lt;a href=&quot;http://www.intel.com/content/www/us/en/solid-state-drives/solid-state-drives-525-series.html&quot;&gt;525 Series&lt;/a&gt; 60GB mSATA Solid State Hard Drive, from &lt;a href=&quot;http://www.overclockers.co.uk]&quot;&gt;overclockers.co.uk&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;3.5in SATA HD, re-purposed&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;observations&quot;&gt;Observations&lt;/h2&gt;
&lt;p&gt;Of note:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For remote management, the CPU needs graphics and Intel vPro Technology support. The &lt;a href=&quot;http://ark.intel.com/products/68315/Intel-Core-i5-3470S-Processor-6M-Cache-up-to-3_60-GHz&quot;&gt;i5-3470S&lt;/a&gt; was the cheapest CPU with those features that my supplier stocked.&lt;/li&gt;
  &lt;li&gt;The DQ77KB is a &lt;a href=&quot;http://www.intel.com/content/www/us/en/hardware-developers/thin-mini-itx.html&quot;&gt;Thin-ITX&lt;/a&gt; board that needs a 19V PSU. I picked an external supply to keep the heat out of the case, keep the noise low, and allow for easy future replacement.&lt;/li&gt;
  &lt;li&gt;I selected the SG05B for its good ventilation (large slow chassis fan), sturdiness (steel body) and internal space.&lt;/li&gt;
  &lt;li&gt;The SG05B comes with a PSU that I do not need. The recently announced a &lt;a href=&quot;http://www.silverstonetek.com/product.php?pid=413&amp;amp;area=en&quot;&gt;SG05-Lite&lt;/a&gt; comes without a PSU, but that is not yet widely available in the UK. I simply removed the PSU, and covered the case hole with some hexagonal mesh scavenged from a junk ATX PSU and cut to size.&lt;/li&gt;
  &lt;li&gt;The DQ77KB has mSATA support, which I like for keeping the build clean a simple. The mSATA board fits into a slot at one end, and is supported by screwposts on the other. The screws were very tight, and unscrewing actually unscrewed the posts; I had to hold them with pliers.&lt;/li&gt;
  &lt;li&gt;The low-profile heatsink was not strictly required, but I like how quiet this model is, and how its design encloses the fan which helps keep it away from cables.&lt;/li&gt;
  &lt;li&gt;I’m not delighted by the Thin-ITX power specification: having to source a specific 19V supply is a hassle, and the power socket has no lock and could easily be accidentally knocked out. For this particular build, the low-profile of Thin-ITX didn’t matter; I would have been quite happy with a standard Mini-ITX board.&lt;/li&gt;
  &lt;li&gt;The total bill of materials is higher than a typical Mini-ITX build; if you can drop some of the requirements, you can save money by choosing a smaller case, a more mainstream board frmo a more cost-conscious manufacturer, and a cheaper CPU.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some photos:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/sugo-case.jpg&quot; alt=&quot;SG05B case&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/sugo-size.jpg&quot; alt=&quot;SG05B size&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/sugo-internal.jpg&quot; alt=&quot;SG05B internal&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/sugo-ports.jpg&quot; alt=&quot;SG05B ports&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/dq77kb-msata-sodimm.jpg&quot; alt=&quot;mSATA/SODDIMM&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;remote-management&quot;&gt;Remote Management&lt;/h2&gt;

&lt;p&gt;Setting up remote management was more involved than say my SuperMicro server
with IPMI. There is good information in these two sources:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How-To Geek “&lt;a href=&quot;http://www.howtogeek.com/56538/how-to-remotely-control-your-pc-even-when-it-crashes/&quot;&gt;How to Remotely Control Your PC (Even When it Crashes)&lt;/a&gt;”&lt;/li&gt;
  &lt;li&gt;Michael Kuron: “&lt;a href=&quot;http://blog.michael.kuron-germany.de/2011/10/using-intel-amts-vnc-server/&quot;&gt;Using Intel AMT’s VNC server&lt;/a&gt;”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used a separate IP address for AMT, with the same ethernet interface also
using a second address for normal LAN access.&lt;/p&gt;

&lt;p&gt;The biggest head-ache was the display resolution: Ubuntu (grub and the
framebuffer) happily chose the largest resolution supported by the Intel
graphics card, which ended up making my Chicken-of-the-VNC window for AMT
too large to use on my Macbook Pro. After various fruitless experiments
with &lt;code&gt;GRUB_GFXMODE&lt;/code&gt;/&lt;code&gt;GRUB_GFXPAYLOAD_LINUX&lt;/code&gt; in the &lt;code&gt;/etc/default/grub&lt;/code&gt;,
I eventually fixed that by specifying:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;GRUB_CMDLINE_LINUX=&quot;video=1024x768-24&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;See &lt;a href=&quot;https://wiki.archlinux.org/index.php/Kernel_Mode_Setting#Forcing_modes&quot;&gt;the ArchLinux page about KMS&lt;/a&gt; for details.&lt;/p&gt;

&lt;h2 id=&quot;software-install&quot;&gt;Software Install&lt;/h2&gt;

&lt;p&gt;I upgraded the BIOS to the latest KBQ7710H.86A.0051 (from KBQ7710H.86A.0038),
using the F7 method and a USB stick.&lt;/p&gt;

&lt;p&gt;Ubuntu 12.04 LTS installed without any problems.&lt;/p&gt;

&lt;p&gt;It takes 25 seconds from Power-on to login, and from reboot to login,
including 2 seconds of grub delay.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kvm-ok&lt;/code&gt; reports “KVM acceleration can be used”, VirtualBox runs fine.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It’s small, quiet, powerful; good stuff.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2013/03/24/cloning-vms-with-kvm</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2013/03/24/cloning-vms-with-kvm.html"/>
    <title>Cloning VMs with KVM</title>
    <updated>2013-03-24T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Now that I have &lt;a href=&quot;http://www.greenhills.co.uk/2013/03/16/supermicro-server-for-virtualisation.html&quot;&gt;my shiny new server&lt;/a&gt;, it needs virtual machines.&lt;/p&gt;

&lt;p&gt;I have two usecases:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;long-running VMs to run services (such as OpenLDAP, Postfix, Jenkins), 
to do development, and be the target of ongoing deploys. These should
be isolated, dependable, and have fast and consistent performance.&lt;/li&gt;
  &lt;li&gt;short-lived VMs to run single-node or multi-node tests. These should 
be quick to bring up in a consistent known state, and scriptable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I use KVM, because it is open source, part of the kernel, widely supported
and reliable. I’ve run it on a colo for years, and various ISP use it for
production cloud platforms (&lt;a href=&quot;http://blog.bytemark.co.uk/wp-content/uploads/2012/04/DesignAndImplementationOfBigV.pdf&quot;&gt;ByteMark&lt;/a&gt;, 
&lt;a href=&quot;http://www.dutchcloud.com/files/DutchCloudCaseStudy.pdf&quot;&gt;Dutch Cloud&lt;/a&gt;, 
&lt;a href=&quot;https://www.digitalocean.com/features&quot;&gt;Digital Ocean&lt;/a&gt;). 
I manage it with &lt;a href=&quot;http://virt-manager.org/&quot;&gt;virt-manager&lt;/a&gt;
and script it with &lt;a href=&quot;http://libvirt.org&quot;&gt;libvirt&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Not everything is rosy:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Documentation is scattered.&lt;/li&gt;
  &lt;li&gt;Virt-manager’s UI is basic.&lt;/li&gt;
  &lt;li&gt;Libvirt’s snapshot support is incomplete:
    &lt;ul&gt;
      &lt;li&gt;“&lt;code&gt;snapshots of inactive domains not implemented yet&lt;/code&gt;”&lt;/li&gt;
      &lt;li&gt;“&lt;code&gt;revert to external disk snapshot not supported yet&lt;/code&gt;”&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;the virt-clone tool canot write to a fresh LVM volume (“&lt;code&gt;Clone onto existing storage volume is not supported&lt;/code&gt;”). &lt;/li&gt;
  &lt;li&gt;on Ubuntu AppArmor gets in the way when you manage multiple snapshot image files (see &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/696318&quot;&gt;this Launchpad bug&lt;/a&gt;).&lt;/li&gt;
  &lt;li&gt;libvirt’s use of XML for domain configuration is a bit annoying to script.&lt;/li&gt;
  &lt;li&gt;QCow2’s internal snapshots take longer than I would like; about 10 seconds instead of 1 second for external snapshots.&lt;/li&gt;
  &lt;li&gt;and whenever you do any virtualisation, networking details are always fiddly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So here is the workflow that I settled on:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a base image with a standard OS install&lt;/li&gt;
  &lt;li&gt;For the long-running VMs, I use separate LVM volumes to serve as raw virtual disk,
clone a base image, and configure the guest. That takes under a minute.&lt;/li&gt;
  &lt;li&gt;For the short-lived VMs, I convert the disk of a long-running VM to qcow2 to serve
as a backing image, and then create qcow2 images for each domain that use this backing
store, configure that guest, and then create another backing store based on that, which
is what the domain is configured to use. Rolling back is then simply a matter of
re-creating the last qcow image. That takes a few seconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’ll illustrate these in more detail.&lt;/p&gt;

&lt;h2 id=&quot;base-image-creation&quot;&gt;Base Image Creation&lt;/h2&gt;

&lt;p&gt;I like to install the base from a GUI, using the standard installer, and
complete it manually, so that it matches what users will see.&lt;/p&gt;

&lt;p&gt;I run vn4server, and connect from my workstation. I install &lt;code&gt;virt-manager&lt;/code&gt;,
define a storage pool (my &lt;code&gt;/dev/vg_vms&lt;/code&gt; LVM volume group), then create an 8G
image base on &lt;code&gt;ubuntu-12.10-server-amd64.iso&lt;/code&gt;, and name that domain &lt;code&gt;ubuntu-base-vm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For disk partitioning I use “Guided – use entire disk” rather than my usual
“Guided – use entire disk and set up LVM”. There are three reasons for this:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I don’t really need LVM on these fairly small virtual disks&lt;/li&gt;
  &lt;li&gt;the installer names the volume group after the host, which will look strange on the clones&lt;/li&gt;
  &lt;li&gt;the volume group ends up in an extended partition, where virt-resize doesn’t resize logical volumes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the Software selection I pick “OpenSSH server”.&lt;/p&gt;

&lt;p&gt;Finally I login to the console, and add my ssh public key to
&lt;code&gt;.ssh/authorized_keys&lt;/code&gt; so that I can login to clones remotely later, and do an
&lt;code&gt;aptitude update; aptitude upgrade&lt;/code&gt; for good measure.&lt;/p&gt;

&lt;p&gt;At some point I might swith to &lt;code&gt;virt-install&lt;/code&gt; for this step.&lt;/p&gt;

&lt;h2 id=&quot;network-preparation&quot;&gt;Network Preparation&lt;/h2&gt;

&lt;p&gt;First, I’m making a list of VM names, IP addresses and MAC addresses.
I’ll later use this list to configure the network interface of the KVM domain configuration,
and the networking configuration files in the guest. For convenience I match vm names with
ip addresses, such that vm&lt;em&gt;111&lt;/em&gt; is on 192.168.0.&lt;em&gt;111&lt;/em&gt;. I wrote a little script that generates the address and the MAC (per &lt;a href=&quot;https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/sect-Virtualization-Tips_and_tricks-Generating_a_new_unique_MAC_address.html&quot;&gt;this tip&lt;/a&gt;). For long-term VMs you can just edit the resulting file and change the name.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# generate vm network range

import virtinst.util
for num in range(110, 130+1):
    print(&quot;vm{0}\t192.168.0.{0}\t{1}&quot;.format(num, virtinst.util.randomMAC()))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which I can use like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;python generate-ips.py  &amp;gt; ips.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and produces:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ head -n 2 ips.txt 
vm110   192.168.0.110   00:16:3e:39:a5:53
vm111   192.168.0.111   00:16:3e:1e:0b:51
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The instructions in this document do not rely on DNS configuration,
but it is nice to give your VMs DNS names. On my LAN I use OpenWRT,
and I can generate the configuration for its &lt;code&gt;/etc/config/dhcp&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# generate openwrt /etc/config/dhcp config

import sys
for line in sys.stdin:
    (ip, name, mac) = line.split()
    print(&quot;config domain\n\toption name '{0}'\n\toption ip '{1}'\n\n&quot;.format(name, ip))
    print(&quot;config host\n\toption mac '{0}'\n\toption name '{1}'\n\toption ip '{2}'\n\n&quot;.format(mac, name, ip))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;run like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;python generate-openwrt.py &amp;lt; ips.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and copy/paste into my router.&lt;/p&gt;

&lt;h2 id=&quot;long-term-vms-clone-to-raw-lvm-guests&quot;&gt;Long-term VMs: Clone to raw LVM guests&lt;/h2&gt;

&lt;p&gt;Here are the steps to do a tichk provisioning of a VM.
I’ll use bash variable &lt;code&gt;$VM&lt;/code&gt; for the VM name.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;VM=vm111
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;First create the volume, of the same size as the original. For example, for a
VM named &lt;code&gt;vm111&lt;/code&gt;, I create a volume named &lt;code&gt;vms-vm111&lt;/code&gt; in the volume group
&lt;code&gt;vg_vms&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;size=`sudo lvs -o lv_size --unit=b --noheadings /dev/vg_vms/ubuntu-base-vm | sed 's/^ *//'`
echo size=$size
sudo lvcreate --size=$size --name=vms-$VM vg_vms
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Alternatively you can specify a large size, e.g.:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo lvcreate --size=20G --name=vms-$VM vg_vms
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, I copy the base image:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo virt-resize --expand sda1 \
    /dev/vg_vms/ubuntu-base-vm /dev/vg_vms/vms-$VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The ‘sda1’ parameter indicates the partition inside the guest that should be exanded;
in this case the root partition.&lt;/p&gt;

&lt;p&gt;Now we need to create a KVM domain to use that disk. I can copy the XML
definition of the base image, and update the device path, the MAC address, and
generate a new UUID. To make that easier, I use this python script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# modify-domain.py -- modify a KVM domain
#
# Copyright (C) 2013 Martijn Koster
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the &quot;Software&quot;), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:  The above copyright notice and
# this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import re, sys, uuid
from lxml import etree
from optparse import OptionParser

parser = OptionParser()
parser.add_option(&quot;--name&quot;)
parser.add_option(&quot;--new-uuid&quot;, action=&quot;store_true&quot;)
parser.add_option(&quot;--device-path&quot;)
parser.add_option(&quot;--mac-address&quot;)
(options, args) = parser.parse_args()

tree = etree.parse(sys.stdin)

if options.name:
    name_el = tree.xpath(&quot;/domain/name&quot;)[0]
    name_el.text = options.name

if options.new_uuid:
    uuid_el = tree.xpath(&quot;/domain/uuid&quot;)[0]
    uuid_el.text = str(uuid.uuid1())

if options.device_path is not None:
    if options.device_path[0] is not '/':
        sys.exit(&quot;device_path is not an absolute path&quot;)
    source_el = tree.xpath(&quot;/domain/devices/disk[@device='disk']/source&quot;)[0]
    source_el.set('dev', options.device_path)
    if re.match('.*\.qcow2$', options.device_path):
        driver = 'qcow2'
    else:
        driver = 'raw'
    driver_el = tree.xpath(&quot;/domain/devices/disk[@device='disk']/driver&quot;)[0]
    driver_el.set('type', driver)

if options.mac_address is not None:
    if not re.match(&quot;([0-9a-f][0-9a-f]:){5}[0-9a-f][0-9a-f]&quot;, options.mac_address):
        sys.exit(&quot;{0} is not a valid MAC address&quot;.format(options.mac_address))
    mac_el = tree.xpath(&quot;/domain/devices/interface[@type='bridge']/mac&quot;)[0]
    mac_el.set('address', options.mac_address)

print(etree.tostring(tree, pretty_print=True))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;so that I can do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mkdir -p tmp
virsh dumpxml ubuntu-base-vm &amp;gt; tmp/ubuntu-base-vm.xml
mac=`egrep &quot;^$VM&quot;'\s' ips.txt | awk '{print $3}'`; echo $mac
python ./modify-domain.py \
    --name $VM \
    --new-uuid \
    --device-path=/dev/vg_vms/vms-$VM \
    --mac-address $mac \
    &amp;lt; tmp/ubuntu-base-vm.xml &amp;gt; tmp/$VM.xml
virsh define tmp/$VM.xml
virsh dumpxml $VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, we need to configure the guest’s networking details. The &lt;code&gt;virt-sysprep&lt;/code&gt; tool
can help with that, but doesn’t regenerate openssh keys, or /etc/hosts. So I wrap it
with some scripting. I use some some templates:&lt;/p&gt;

&lt;p&gt;For the networking:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mkdir -p templates
cat &amp;gt; templates/network-interfaces &amp;lt;&amp;lt;NET
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address IP_ADDRESS_GOES_HERE
    network 192.169.0.0
    netmask 255.255.255.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1
    dns-search vlab1.stalworthy.net
NET
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The hosts file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat &amp;gt; templates/hosts &amp;lt;&amp;lt;HOSTS
127.0.0.1   localhost
IP_ADDRESS_GOES_HERE   VM_NAME_GOES_HERE

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
HOSTS
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And a script to run in the host:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat &amp;gt; templates/configure.sh &amp;lt;&amp;lt;SCRIPT
#!/bin/bash
# Run in the host, with the cwd being the root of the guest

set -x
cp tmp/network_interfaces.VM_NAME_GOES_HERE etc/network/interfaces
cp tmp/hosts.VM_NAME_GOES_HERE etc/hosts

# re-generate the keys. Letting virt-sysprep remove the keys
# is insufficient, and they don't get automatically regenerated
# on boot by Ubuntu. A dpkg-reconfigure fails for some reason,
# and doing a boot-time script is overkill, so just do it now explicitly.
rm etc/ssh/ssh_host_rsa_key etc/ssh/ssh_host_rsa_key.pub
rm etc/ssh/ssh_host_dsa_key etc/ssh/ssh_host_dsa_key.pub
rm etc/ssh/ssh_host_ecdsa_key etc/ssh/ssh_host_ecdsa_key.pub
ssh-keygen -h -N '' -t rsa -f etc/ssh/ssh_host_rsa_key
ssh-keygen -h -N '' -t dsa -f etc/ssh/ssh_host_dsa_key
ssh-keygen -h -N '' -t ecdsa -f etc/ssh/ssh_host_ecdsa_key
SCRIPT
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we can use those templates to generate host-specific versions,
and prepare the image:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ip=`egrep &quot;^$VM\s&quot; ips.txt | awk '{print $2}'`; echo $ip
sed -e &quot;s/IP_ADDRESS_GOES_HERE/$ip/g&quot; -e &quot;s/VM_NAME_GOES_HERE/$VM/g&quot; &amp;lt; templates/hosts &amp;gt; tmp/hosts.$VM
sed -e &quot;s/IP_ADDRESS_GOES_HERE/$ip/g&quot; -e &quot;s/VM_NAME_GOES_HERE/$VM/g&quot; &amp;lt; templates/network-interfaces &amp;gt; tmp/network-interfaces.$VM
sed -e &quot;s/IP_ADDRESS_GOES_HERE/$ip/g&quot; -e &quot;s/VM_NAME_GOES_HERE/$VM/g&quot; &amp;lt; templates/configure.sh &amp;gt; tmp/configure.sh.$VM
chmod a+x tmp/configure.sh.$VM
sudo virt-sysprep -d $VM \
  --verbose \
  --enable udev-persistent-net,bash-history,hostname,logfiles,utmp,script \
  --hostname $VM \
  --script `pwd`/tmp/configure.sh.$VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now the guest is ready and can be started:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;virsh start $VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now that you’ve gone through this once, and the templates are in place, you can use
&lt;a href=&quot;https://gist.github.com/makuk66/5233855&quot;&gt;this script&lt;/a&gt; to make this a one-liner:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ time ./clone.sh vm112
...
Domain vm112 started

real    0m55.401s
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which is nice.&lt;/p&gt;

&lt;h2 id=&quot;short-term-vms-thin-provisioning-with-qcow2&quot;&gt;Short-term VMs: Thin-provisioning with Qcow2&lt;/h2&gt;

&lt;p&gt;Ubuntu’s libvirt installation has AppArmor configuration which limits what guests can
write to. Here we’ll be using different files, and you’ll get permission errors.
The easiest way around this is to use &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/696318/comments/9&quot;&gt;this workaround&lt;/a&gt; and reboot:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat &amp;gt;&amp;gt; /etc/apparmor.d/abstractions/libvirt-qemu &amp;lt;&amp;lt;OEM
/var/lib/libvirt/images/** r,
EOM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For the short-lived VMs, we start by creating a clone of the base, in qcow2 format:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo qemu-img convert -O qcow2 /dev/vg_vms/ubuntu-base-vm /var/lib/libvirt/images/ubuntu-base-vm-readonly.qcow2
sudo chmod u-w /var/lib/libvirt/images/ubuntu-base-vm-readonly.qcow2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This can be used as backing file by multiple VMs, and must not be modified.
From that base image, create a thin clone image for this specific VM:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;VM=vm114
sudo qemu-img create -f qcow2 -b /var/lib/libvirt/images/ubuntu-base-vm-readonly.qcow2 /var/lib/libvirt/images/$VM.qcow2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then define a KVM domain for it, and configure it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mkdir -p tmp
virsh dumpxml ubuntu-base-vm &amp;gt; tmp/ubuntu-base-vm.xml
mac=`egrep &quot;^$VM&quot;'\s' ips.txt | awk '{print $3}'`
python ./modify-domain.py \
    --name $VM \
    --new-uuid \
    --device-path=/var/lib/libvirt/images/$VM.qcow2 \
    --mac-address $mac \
    &amp;lt; tmp/ubuntu-base-vm.xml &amp;gt; tmp/$VM.xml
virsh define tmp/$VM.xml
virsh start $VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;at this point you can start the VM and check it works.
Next we make a snapshot to serve as a clean starting point for future runs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;virsh destroy $VM
sudo qemu-img create -f qcow2 -b /var/lib/libvirt/images/$VM.qcow2 /var/lib/libvirt/images/$VM-start.qcow2
virsh dumpxml $VM &amp;gt; tmp/$VM.xml
python ./modify-domain.py \
    --device-path=/var/lib/libvirt/images/$VM-start.qcow2 \
    &amp;lt; tmp/$VM.xml &amp;gt; tmp/$VM-start.xml
virsh define tmp/$VM-start.xml

virsh start $VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we can use it. When we’re done and want to reset the VM, we can do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;virsh destroy $VM
rm /var/lib/libvirt/images/$VM-start.qcow2
qemu-img create -f qcow2 -b /var/lib/libvirt/images/$VM.qcow2 /var/lib/libvirt/images/$VM-start.qcow2
virsh start $VM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which takes less than 2 seconds:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ time sudo ./reset-vm.sh vm114
Domain vm114 destroyed

Formatting '/var/lib/libvirt/images/vm114-start.qcow2', fmt=qcow2 size=8388608000 backing_file='/var/lib/libvirt/images/vm114.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off 
Domain vm114 started

real    0m1.311s
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;

&lt;p&gt;We’ve seen you can automate thick-provisioning VMs through cloning in under a
minute, and rollback thin-provisioned VMs in seconds. Which is nice.&lt;/p&gt;

&lt;p&gt;I’m really looking forward to future versions of libvirt/virt-manager adding
support for these things through their API/UI.&lt;/p&gt;

&lt;p&gt;For now, I’ll see how well this setup works in practice, and perhaps experiment
with some alternatives.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2013/03/16/supermicro-server-for-virtualisation</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2013/03/16/supermicro-server-for-virtualisation.html"/>
    <title>SuperMicro server for virtualisation</title>
    <updated>2013-03-16T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve acquired a new lab machine, for virtualisation and deployment development.
The goal is quickly spinning up VMs based on snapshots, do a deploy and end-to-end test of cluster software, and spin it all down again.
I’m doing that regularly on remote machines, but wanted that capability locally, for ease of use, speed, and lack of resource competition.
In addition I want to have some VMs running distro repository cache, run Jenkins, do development etc.
My existing server hardware is old and not very scalable, so it was time to invest in better capability.&lt;/p&gt;

&lt;p&gt;The requirements were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;support virtualisation (VT-X/VT-d)&lt;/li&gt;
  &lt;li&gt;scale to lots of VMs, so:
    &lt;ul&gt;
      &lt;li&gt;CPU: many cores. No need to be super fast. Keep electricity consumption low and heat down. Dual CPU to get the core count up while keeping CPU costs in check.&lt;/li&gt;
      &lt;li&gt;RAM: a decent amount to start, with future expansion potential. ECC. 64G to start with.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;fast IO for installs, but no huge requirements for large datasets. Dual SSD (one for the system, one for VMs), with one fixed disk for storing distributions. No need for RAID.&lt;/li&gt;
  &lt;li&gt;pedestal case (no rackmount), and reasonably quiet, because it gets deployed in a test lab / office.&lt;/li&gt;
  &lt;li&gt;remote management&lt;/li&gt;
  &lt;li&gt;get a system that will last and be useful for many years, but not spend silly money.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;which gets you into professional server territory.
I’ve been self-building workstations for years, but this time I resisted temptation and decided to save myself the time and risk.
I opted for the following specification from &lt;a href=&quot;http://www.sentralsystems.com&quot;&gt;Sentral&lt;/a&gt;, where I had sourced a 1U Tyan server some years back:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-case.png&quot; alt=&quot;SuperMicro case&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-X9DRi-F.png&quot; alt=&quot;X9DRi-F motherboard&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Case: SuperMicro 4U SM Tower c/w 665W Super Quiet (25dB) PSU (CSE &lt;a href=&quot;http://www.supermicro.com/products/chassis/tower/733/sc733tq-665.cfm&quot;&gt;733TQ-665B&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;Motherboard: SuperMicro &lt;a href=&quot;http://www.supermicro.com/products/motherboard/xeon/c600/x9dri-f.cfm&quot;&gt;X9DRi-F&lt;/a&gt;. Dual Socket R (LGA 2011). IPMI 2.0 and KVM, 16 DIMM sockets.&lt;/li&gt;
  &lt;li&gt;CPU(s): Dual Intel &lt;a href=&quot;http://ark.intel.com/products/64586/Intel-Xeon-Processor-E5-2630L-15M-Cache-2_00-GHz-7_20-GTs-Intel-QPI&quot;&gt;E5 2630L&lt;/a&gt;  (6/12*2Ghz/15Mb cache) 60W. Note that this is the low-power variant.&lt;/li&gt;
  &lt;li&gt;Memory: 64GB DDR3 1600 ECC REG (4*16GB)&lt;/li&gt;
  &lt;li&gt;HDD: 1* 3TB SATA Seagate Barracuda (ST3000DM001-1CH166)&lt;/li&gt;
  &lt;li&gt;SSD: 2* 240GB &lt;a href=&quot;http://www.intel.co.uk/content/www/us/en/solid-state-drives/solid-state-drives-520-series.html&quot;&gt;Intel 520 Series SSD&lt;/a&gt; (SSDSC2CW240A3)&lt;/li&gt;
  &lt;li&gt;CDRW: LITE-ON DVD Burner (&lt;a href=&quot;http://us.liteonit.com/us/dvd-internal/item/dvdinternal/ihas124&quot;&gt;iHAS124-04&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cost a bit over £2500 ex VAT delivered, which I think is good value, if quite an investment.
The build and delivery took two weeks; a bit longer than normal because of my non-standard CPU choice, and testing that much RAM.
Sentral was pleasant to deal with: no on-line configuring ordering of credit card payment, but a few quick emails back and forth, a BACS transfer, plus regular pro-active updates worked as well. Plus, it’s actually nice to have the personal interaction (hi Dave).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-unboxed.jpg&quot; alt=&quot;SuperMicro unboxed&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-inside.jpg&quot; alt=&quot;SuperMicro inside&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-motherboard.jpg&quot; alt=&quot;SuperMicro motherboard&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-frontpanel.jpg&quot; alt=&quot;SuperMicro frontpanel&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-trays.jpg&quot; alt=&quot;SuperMicro trays&quot; /&gt;
&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-back.jpg&quot; alt=&quot;SuperMicro back&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Initial impressions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Nice looking case. The side door is a bit fiddly to close, seems to work best lying on its side.&lt;/li&gt;
  &lt;li&gt;Quality of components is good. Sentral did a nice job of cable management.&lt;/li&gt;
  &lt;li&gt;It’s much quieter than a 1U rackmount, but louder than my self-builds where I optimise for quiet. In particular the front case fan is noisy; the vents in front of the fan and the shroud behind probably don’t help. I may decide to move the machine, or look into replacing the front fan, but for now it’s not too bad.&lt;/li&gt;
  &lt;li&gt;I connected the management interface and first normal interface to the LAN, found the new MAC address on my router, connected to IPMI, and configured it from there.&lt;/li&gt;
  &lt;li&gt;It feels &lt;em&gt;fast&lt;/em&gt;.&lt;/li&gt;
  &lt;li&gt;Ubuntu 12.10, KVM and VirtualBox run fine.&lt;/li&gt;
  &lt;li&gt;It’s sipping around 120 Watt at idle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obligatory screendump, 2 CPUs x 6 cores x 2 HyperThreads = 24 processors in htop:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://cdn.greenhills.co.uk/img/blog/supermicro-htop.png&quot; alt=&quot;htop output&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It will take some time to do some experimentation and complete the full setup of the lab environment.
I’m looking forward to it already.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2013/03/01/boto-with-iam-roles</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2013/03/01/boto-with-iam-roles.html"/>
    <title>Boto with IAM roles</title>
    <updated>2013-03-01T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;In &lt;a href=&quot;http://www.greenhills.co.uk/2012/12/25/s3cmd-with-iam-roles.html&quot;&gt;a previous blog post&lt;/a&gt; I explored IAM roles, with a patched s3cmd.
I have since discovered that &lt;a href=&quot;https://github.com/boto/boto&quot;&gt;boto&lt;/a&gt; supports IAM roles too, and that makes things even easier.
It even comes with a &lt;code&gt;fetch_file&lt;/code&gt; command to use without writing any Python code.&lt;/p&gt;

&lt;p&gt;So overall, what I want to happen during EC2 instance creation (in a VPC) is:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;set the hostname to the EC2 instance ID, and configure /etc/hosts&lt;/li&gt;
  &lt;li&gt;add minimal packages&lt;/li&gt;
  &lt;li&gt;register this instance in the DNS&lt;/li&gt;
  &lt;li&gt;use IAM roles to securely download bootstrap code and data from S3, and execute that&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The userdata I use for this looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Content-Type: multipart/mixed; boundary=&quot;===============0933669979118751095==&quot;
MIME-Version: 1.0

--===============0933669979118751095==
Content-Type: text/cloud-config; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=&quot;my-cloudconfig.txt&quot;

#cloud-config

preserve_hostname: true
manage_etc_hosts: false

bootcmd:
- cloud-init-per instance my_set_hostname sh -xc &quot;echo $INSTANCE_ID &amp;gt; /etc/hostname; hostname -F /etc/hostname&quot;
- cloud-init-per instance my_etc_hosts sh -xc &quot;sed -i -e '/^127.0.1.1/d' /etc/hosts; echo 127.0.1.1 $INSTANCE_ID.MYDOMAIN $INSTANCE_ID &amp;gt;&amp;gt; /etc/hosts&quot;

cloud_final_modules:
 - rightscale_userdata
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - [scripts-user, always]
 - keys-to-console
 - phone-home
 - final-message

apt_sources:
- source: deb http://archive.ubuntu.com/ubuntu precise multiverse
- source: deb-src http://archive.ubuntu.com/ubuntu precise multiverse
- source: deb http://archive.ubuntu.com/ubuntu precise-updates multiverse
- source: deb-src http://archive.ubuntu.com/ubuntu precise-updates multiverse
- source: deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
- source: deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse

packages:
- language-pack-en
- python-pip

--===============0933669979118751095==
Content-Type: text/x-shellscript; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=&quot;my-userdata-userscript.txt&quot;

#!/bin/sh

cd /root

pip install --upgrade boto

python &amp;lt;&amp;lt;PY
import boto
from boto.s3.key import Key

route53 = boto.connect_route53()
changes = ResourceRecordSets(route53, &quot;MY_HOSTED_ZONE_ID&quot;)
change = changes.add_change(&quot;CREATE&quot;, instance_id + &quot;.MY.DOMAIN&quot;,&quot;A&quot;)
change.add_value(local_ipv4)
changes.commit()

c = boto.connect_s3()
b = c.get_bucket('MYBUCKET')
k = Key(b)
k.key = '/MYBOOTSTRAP.sh'
k.get_contents_to_filename('MYBOOTSTRAP.sh')
PY

chmod u+x ./MYBOOTSTRAP.sh
./MYBOOTSTRAP.sh
--===============0933669979118751095==--
EOM
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Fun stuff.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2012/12/25/s3cmd-with-iam-roles</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2012/12/25/s3cmd-with-iam-roles.html"/>
    <title>s3cmd with IAM roles</title>
    <updated>2012-12-25T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;In &lt;a href=&quot;http://aws.amazon.com&quot;&gt;AWS&lt;/a&gt;, delivering credentials to an instance has
traditionally been problematic.
You can pass them in via &lt;a href=&quot;http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html#instancedata-user-data-retrieval&quot;&gt;instance user data&lt;/a&gt;
at instance creation time, but that’s somewhat inconvenient, and instance data
cannot be changed after the instance has started.
You can pass them in by pre-loading on an AMI, but that’s even more hassle and
static.
Or you can have the instance fetch them from somewhere else at boot time,
for example through &lt;a href=&quot;https://help.ubuntu.com/community/CloudInit&quot;&gt;CloudInit&lt;/a&gt;,
but that then only moves the problem because you then need to secure that fetch.
And of course you can copy credentials to the instance after it has booted,
but then you have to wait until the ssh sever has regenerated its keys,
and you must have security groups and VPC routes to allow access, and it
precludes you running an instance manually from the AWS Console.&lt;/p&gt;

&lt;p&gt;I’ve ignored that problem for a while, simply relying on 
&lt;a href=&quot;http://www.opscode.com/chef/&quot;&gt;Chef&lt;/a&gt; to distribute credentials.
But for a current project I’m trying to do without custom AMIs and a
Chef server: I want to run an instance, and have it do some setup and secure
configuration at creation time. For example, it could setup an OpenVPN server
in a VPC, or could create a shared secret for
&lt;a href=&quot;http://wiki.opscode.com/display/chef/Encrypted+Data+Bags&quot;&gt;Chef Encrypted Data Bags&lt;/a&gt;
prior to registering as a Chef client.&lt;/p&gt;

&lt;p&gt;In June 2012, AWS announced &lt;a href=&quot;http://aws.typepad.com/aws/2012/06/iam-roles-for-ec2-instances-simplified-secure-access-to-aws-service-apis-from-ec2.html&quot;&gt;IAM roles for EC2 instances –
Simplified Secure Access to AWS service APIs from
EC2&lt;/a&gt;
which addresses this very use case: it allows you to pass IAM credentials to
instances.&lt;/p&gt;

&lt;p&gt;So my plan was:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;make credentials available to the instance, using IAM roles&lt;/li&gt;
  &lt;li&gt;create a script to download further scripts and credentials from a private S3 bucket&lt;/li&gt;
  &lt;li&gt;fetch and execute this script at boot time, using CloudInit&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;creating-the-iam-role&quot;&gt;Creating the IAM Role&lt;/h2&gt;
&lt;p&gt;For the first step, the user guide has a section
&lt;a href=&quot;http://docs.aws.amazon.com/IAM/latest/UserGuide/role-usecase-ec2app.html&quot;&gt;Granting Applications that Run on Amazon EC2 Instances Access to AWS Resources&lt;/a&gt;
which explains the approach, and illustrates it with a video that uses the AWS Console.
I prefer doing IAM configuration from the command-line, so that I can
document and script it more easily, and track changes in a git repo.
What is not obvious is that when you use the command line,
you need to explicitly create a instance profile as a separate step.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;iam-rolecreate -r myrole -p / -s ec2.amazonaws.com -v
iam-roleuploadpolicy -r myrole -p mypolicy -f ./mypolicy.txt
iam-instanceprofilecreate -p / -r mypolicy -s myrole
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;See the &lt;a href=&quot;http://docs.amazonwebservices.com/IAM/latest/CLIReference/Commands.html&quot;&gt;AWS Identity and Access Management CLI
Reference&lt;/a&gt;
for details.&lt;/p&gt;

&lt;p&gt;I first ran an instance from the AWS Console by hand, and then determined
how to do this from my ruby scripts that use &lt;a href=&quot;http://fog.io/&quot;&gt;Fog&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;server = @compute.servers.create(
        ...
        :iam_instance_profile_name =&amp;gt; 'myrole'
    )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With the instance running, I verified that the metadata service made the
credentials available:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;wget -O - -q 'http://169.254.169.254/latest/meta-data/iam/security-credentials/'
wget -O - -q 'http://169.254.169.254/latest/meta-data/iam/security-credentials/myrole'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and verified that they worked by downloading the latest
&lt;a href=&quot;http://aws.amazon.com/developertools/351&quot;&gt;EC2 API Tools&lt;/a&gt;
and Java, and running &lt;code&gt;ec2-describe-instances&lt;/code&gt;, which was one of the permissions
granted in the policy file.&lt;/p&gt;

&lt;h2 id=&quot;temporary-credentials-in-s3cmd&quot;&gt;Temporary credentials in s3cmd&lt;/h2&gt;

&lt;p&gt;I tried using the AccessKeyId and SecretAccessKey from the metadata in by s3cmd &lt;code&gt;.s3cfg&lt;/code&gt; file,
with a simple &lt;code&gt;s3cmd ls s3://mybucket/&lt;/code&gt; command, but got:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ERROR: S3 error: 403 (InvalidAccessKeyId): The AWS Access Key Id you provided does not exist in our records.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The reason is that for IAM temporary credentials to work, you need to provide the token
from the metadata, in a separate HTTP header when talking to the AWS S3 API (see
&lt;a href=&quot;http://aws.amazon.com/iam/faqs/#How_can_temporary_security_credentials_be_used_to_call_AWS_service_APIs&quot;&gt;this FAQ&lt;/a&gt;).
Some googling found 
&lt;a href=&quot;https://github.com/robtuley/debian.rcx-app/blob/master/bin/rcxbkup&quot;&gt;someone using security token for s3cmd put&lt;/a&gt;
(with &lt;a href=&quot;https://github.com/robtuley/debian.rcx-app/commit/df14dbf08e7a8947bc796aab1a5844adaceba3b9&quot;&gt;this change&lt;/a&gt;)
but just using &lt;code&gt;--add-header=x-amz-security-token&lt;/code&gt; didn’t work; it looks like s3cmd only uses that for &lt;code&gt;put/sync/cp/mv&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There is a popular &lt;a href=&quot;https://github.com/s3tools/s3cmd/issues/63&quot;&gt;open feature request to Support IAM roles / instance
profiles&lt;/a&gt;; it’d be great if you could just tell s3cmd to disengage its
config file and “use the metadata service”. But, I found &lt;a href=&quot;http://sourceforge.net/mailarchive/forum.php?thread_name=1352400669.18089.13.camel%40naima.tasker.network&amp;amp;forum_name=s3tools-general&quot;&gt;this post and patch&lt;/a&gt;
which at least adds minimal support.
For convenience I &lt;a href=&quot;https://github.com/makuk66/s3cmd/commit/05257e337692dfb1ef95a4438955250df9fe41a8&quot;&gt;pulled it into my fork&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So then it’s just a matter of copying the credentials from the metadata to the s3 config file.
Bear in mind that they expire; you’ll need to re-generate them, and the simplest is to do that for every use.
Here is an example with bash and &lt;a href=&quot;http://stedolan.github.com/jq/&quot;&gt;jq&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;wget -O mycreds -q 'http://169.254.169.254/latest/meta-data/iam/security-credentials/myrole'
SECRET_KEY=`jq -r '.SecretAccessKey' &amp;lt;mycreds`
ACCESS_KEY=`jq -r '.AccessKeyId' &amp;lt;mycreds`
TOKEN=`jq -r '.Token' &amp;lt;mycreds`
cat &amp;gt;s3cfg &amp;lt;&amp;lt;EOM
[default]
access_key = $ACCESS_KEY
secret_key = $SECRET_KEY
security_token = $TOKEN
EOM
s3cmd --config s3cfg ls s3://mybucket/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I’d like to see this (or better) support in s3cmd, but the last release was nearly a year ago,
and it sounds like the project has a lack of &lt;a href=&quot;http://thread.gmane.org/gmane.comp.file-systems.s3.s3tools/484&quot;&gt;leadership&lt;/a&gt; problem.
I think it’d be great it Amazon could take this project over, or if they could provide similar functionality
on top of its &lt;a href=&quot;http://aws.amazon.com/sdkforjava/&quot;&gt;AWS SDK for Java&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As for my project, all the pieces seem to be in place; doing the whole end-to-end CloudInit bootstrap is for another day.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2012/12/18/webcrawler-screenshots</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2012/12/18/webcrawler-screenshots.html"/>
    <title>WebCrawler Screenshots</title>
    <updated>2012-12-18T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;The Register posted “&lt;a href=&quot;http://www.theregister.co.uk/2012/12/18/search_engines_we_have_known/&quot;&gt;Search engines we have known … before Google crushed them&lt;/a&gt;”, mentioning WebCrawler on &lt;a href=&quot;http://www.theregister.co.uk/2012/12/18/search_engines_we_have_known/page3.html&quot;&gt;page 3&lt;/a&gt; but without a screenshot! Let’s fix that.&lt;/p&gt;

&lt;p&gt;From &lt;a href=&quot;http://www.thinkpink.com/bp/&quot;&gt;Brian Pinkerton&lt;/a&gt;,
the WebCrawler 1995 search page:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/webcrawler-1995-searchpage.png&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;and the results:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/webcrawler-1995-searchresults.png&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;From my archive, the 1997 front page:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img width=&quot;585&quot; src=&quot;/img/blog/webcrawler-excite.png&quot; /&gt;
&lt;/div&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2012/04/25/metal-as-a-service</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2012/04/25/metal-as-a-service.html"/>
    <title>Metal as a Service</title>
    <updated>2012-04-25T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;There was some hype around Canonical’s “Metal as a Service” (MAAS) a few weeks back.
Coverage:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.canonical.com/content/“metal-service”-provisioning-tool-canonical-ubuntu-1204-lts-beta&quot;&gt;Ubuntu Press Release&lt;/a&gt;; full of marketing buzzwords&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://wiki.ubuntu.com/ServerTeam/MAAS&quot;&gt;Metal as a Service: MAAS&lt;/a&gt; wiki&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/UbuntuCloudInfrastructure&quot;&gt;Ubuntu Cloud Infrastructure&lt;/a&gt; which describes using MAAS to deploy an OpenStack cloud&lt;/li&gt;
  &lt;li&gt;Press: &lt;a href=&quot;http://www.h-online.com/open/news/item/Ubuntu-12-04-to-come-with-MAAS-driver-1511880.html&quot;&gt;The H Open Source&lt;/a&gt;, &lt;a href=&quot;http://www.theregister.co.uk/2012/04/04/ubuntu_maas/&quot;&gt;The Register&lt;/a&gt;, &lt;a href=&quot;http://www.linuxtoday.com/developer/2012040400541OSUB&quot;&gt;Linux Today&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what actually is it?&lt;/p&gt;

&lt;p&gt;Datacenter system administrators have for years used &lt;a href=&quot;http://en.wikipedia.org/wiki/Preboot_Execution_Environment&quot;&gt;PXE&lt;/a&gt; to do remote automated installs of machines.
See
&lt;a href=&quot;http://www.debian-administration.org/articles/478&quot;&gt;Debian’s “Setting up a server for PXE network booting”&lt;/a&gt;, 
&lt;a href=&quot;https://help.ubuntu.com/community/PXEInstallServer&quot;&gt;Ubuntu’s “PXE Install Server”&lt;/a&gt;, 
&lt;a href=&quot;http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.4/html/Getting_Started_Guide/sect-Getting_Started_Guide-Kickstart-Kickstarting_a_Machine.html&quot;&gt;Redhat’s “Kickstarting a Machine”&lt;/a&gt;
and &lt;a href=&quot;http://en.wikipedia.org/wiki/Jumpstart_(Solaris)&quot;&gt;Solaris “JumpStart”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The way that works is that when a server boots:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;its BIOS looks for a DHCP server, and gets some parameters like IP address and the address of a TFTP server&lt;/li&gt;
  &lt;li&gt;gets a config file from the TFTP server with a boot menu&lt;/li&gt;
  &lt;li&gt;executes a chosen selection from the menu (or a default) which then downloads the OS installer and installs it on the machine&lt;/li&gt;
  &lt;li&gt;then the machine reboots, and starts into its own OS&lt;/li&gt;
  &lt;li&gt;you can also preconfigure different configs for specific machine ethernet MAC addresses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which is all great, but fiddly to setup and painful to maintain.&lt;/p&gt;

&lt;p&gt;PXE itself doesn’t address OS configuration or package installation, but you can script that in various ways.
Traditionally it involves making a custom installer, configuring package selection mechanisms like &lt;a href=&quot;http://wiki.debian.org/DebianInstaller/Preseed&quot;&gt;Debian Preseed&lt;/a&gt;, and executing scripts at first boot from /etc/init.d or &lt;a href=&quot;https://help.ubuntu.com/community/CloudInit&quot;&gt;cloudinit&lt;/a&gt; or similar.&lt;/p&gt;

&lt;p&gt;Newer tools help here. From Redhat pedigree comes &lt;a href=&quot;http://cobbler.github.com/&quot;&gt;Cobbler&lt;/a&gt; (see &lt;a href=&quot;https://github.com/cobbler/cobbler/wiki/Start%20Here&quot;&gt;Start Here&lt;/a&gt; and &lt;a href=&quot;http://magazine.redhat.com/2007/08/10/cobbler-how-to-set-up-a-network-boot-server-in-10-minutes/&quot;&gt;Cobbler: How to set up a network boot server in 10 minutes&lt;/a&gt;) which lets you define profiles for different types of machines or roles, and then use kickstart templates to do appropriate installs (&lt;a href=&quot;http://venkataraoss.blogspot.co.uk/2011/02/kickstart-server-in-10-steps.html&quot;&gt;example&lt;/a&gt;) to perform custom installation in the target. Ubuntu 11.10 introduced &lt;a href=&quot;https://wiki.ubuntu.com/ServerTeam/Orchestra&quot;&gt;Orchestra&lt;/a&gt; (See &lt;a href=&quot;http://blog.dustinkirkland.com/2011/10/getting-started-with-ubuntu-orchestra.html&quot;&gt;Dustin Kirkland’s “Getting Started with Ubuntu Orchestra”&lt;/a&gt;), the predecessor of MAAS.&lt;/p&gt;

&lt;p&gt;So, MAAS is basically a Web interface that does the PXE/DHCP server config for you, manages the install ISOs, and integrates with &lt;a href=&quot;https://juju.ubuntu.com/&quot;&gt;Juju&lt;/a&gt; (&lt;a href=&quot;https://juju.ubuntu.com/Documentation&quot;&gt;Docs&lt;/a&gt;) for role based package management on the nodes. Juju is more analogous to &lt;a href=&quot;http://www.opscode.com/chef/&quot;&gt;Chef&lt;/a&gt;: you can define “Nodes”, which run “charms” defining services, but it also deals with “relations” dependencies between nodes, somewhat like &lt;a href=&quot;http://aws.amazon.com/cloudformation/&quot;&gt;AWS CloudFormation&lt;/a&gt;. I wonder how that deals with staged provisioning and metadata sharing.&lt;/p&gt;

&lt;p&gt;Some interesting aspects are the use of “wake on LAN” to remotely switch machines on, and the ability to use this for &lt;a href=&quot;https://help.ubuntu.com/community/LXC&quot;&gt;LXC&lt;/a&gt;. If you just want to test, &lt;a href=&quot;https://wiki.edubuntu.org/SecurityTeam/TestingMAAS&quot;&gt;TestingMAAS&lt;/a&gt; explains a VM-based setup. &lt;/p&gt;

&lt;p&gt;I don’t support any large scale hardware deployments currently, so I’m not really in the target market for MAAS.
For my EC2 customer deployments I don’t think MAAS is particularly useful; though Juju may be.
For my office lab I can imagine MAAS being convenient: I could run the MAAS server in a KVM VM, then use it to install my physical lab servers for specific test projects.
Definitely something for the list of weekend projects. &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://wiki.ubuntu.com/PrecisePangolin/TechnicalOverview/Beta2&quot;&gt;Ubuntu 12.04 “Precise Pangolin”&lt;/a&gt; has the latest support for the above and should be available form April 26th.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2012/04/17/some-blog-changes</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2012/04/17/some-blog-changes.html"/>
    <title>Some minor blog changes</title>
    <updated>2012-04-17T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Some minor changes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;updated &lt;a href=&quot;https://github.com/mojombo/jekyll&quot;&gt;Jekyll&lt;/a&gt;, which involved a round of ruby/rvm updates, which in turn required &lt;a href=&quot;https://github.com/kennethreitz/osx-gcc-installer&quot;&gt;osx-gcc-installer&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;made the ajax main content loading scroll back the window to the top (thanks Neil)&lt;/li&gt;
  &lt;li&gt;linkify #hashtags, @messages, and links in the twitter webclip (inspired by uudashr’s &lt;a href=&quot;https://github.com/uudashr/jquery-linkify&quot;&gt;linkify&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;remove the Google webclip after their whole Google Plus +1 change broke my flow.&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2012/04/17/apple-mounting-the-nas</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2012/04/17/apple-mounting-the-nas.html"/>
    <title>OSX mounting the NAS</title>
    <updated>2012-04-17T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;For years I’ve accessed my Linux files from the Mac via NFS, CIFS/SMB (&lt;a href=&quot;http://www.samba.org/&quot;&gt;Samba&lt;/a&gt;,
and &lt;a href=&quot;http://panic.com/transmit/&quot;&gt;Transmit&lt;/a&gt;’s Disk feature.
When I tried the latter to stream some video on my HP MicroServer NAS I found it was too slow (presumably
it pre-downloads the entire file) and it actually crashed my Airport Extreme half-way through.
I’ve always wanted to setup &lt;a href=&quot;http://netatalk.sourceforge.net/&quot;&gt;Netatalk&lt;/a&gt; AFP, so this provided the perfect opportunity.&lt;/p&gt;

&lt;p&gt;Tips and inspiration on:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Kremalicious’s &lt;a href=&quot;http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/&quot;&gt;HowTo: Make Ubuntu A Perfect Mac File Server And Time Machine Volume &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Trollop’s &lt;a href=&quot;http://www.trollop.org/2011/07/23/os-x-10-7-lion-time-machine-netatalk-2-2/&quot;&gt;OS X 10.7 Lion, Time Machine &amp;amp; Netatalk 2.2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn’t run into any particular problems with Netatalk or Avahi on this Debian Squeeze install,
and can now browse the Network list and connect to the volumes (just ext3 on LVM).
&lt;a href=&quot;http://www.videolan.org/&quot;&gt;VideoLan&lt;/a&gt; happilly streams. All good.
Next (at some point) is Time Machine.&lt;/p&gt;

&lt;p&gt;I briefly considered iSCSI, but I’ve read of people hitting problems with the
&lt;a href=&quot;http://www.studionetworksolutions.com/products/product_detail.php?pi=11&quot;&gt;globalSAN&lt;/a&gt; ($89),
and having more success with
&lt;a href=&quot;http://www.attotech.com/products/product.php?scat=17&amp;amp;sku=INIT-MAC0-001&quot;&gt;ATTO’s Xtend SAN iSCSI Initiator&lt;/a&gt; ($195),
but that’s a little steep for just an experiment when AFP works fine.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/08/06/rabbitmq-first-look</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/08/06/rabbitmq-first-look.html"/>
    <title>RabbitMQ First Look</title>
    <updated>2011-08-06T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I spent some time looking at &lt;a href=&quot;http://www.rabbitmq.com/&quot;&gt;RabbitMQ&lt;/a&gt; this week.
It does what it says on the tin, but I encountered a couple of gotchas.&lt;/p&gt;

&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;

&lt;p&gt;There is a &lt;a href=&quot;https://github.com/opscode/cookbooks/tree/master/rabbitmq&quot;&gt;Chef cookbook for
RabbitMQ&lt;/a&gt;
which made installation easy. It uses the &lt;code&gt;node[:hostname]&lt;/code&gt;
(in the &lt;a href=&quot;https://github.com/opscode/cookbooks/blob/master/rabbitmq/attributes/default.rb&quot;&gt;default attributes&lt;/a&gt;),
which ends up being used by the /etc/rabbitmq/rabbitmq-env.conf and is used
in the name of data directories.
But I’m installing on EC2, where stopping and starting change change the
hostname, which then causes problems.
This is mentioned on the &lt;a href=&quot;http://www.rabbitmq.com/ec2.html&quot;&gt;RabbitMQ on EC2
page&lt;/a&gt;, where the recommended action is
to change the hostname and give it a localhost address in /etc/hosts.
I’m not particularly happy about that, because it could cause problems to
other parts of the system: &lt;code&gt;hostname --fqdn&lt;/code&gt; no
longer gives a fully qualified name; and other software may have started
using the old name and get confused.
In my case this runs on a dedicated host and I can from Chef script the
hostname changing to occur before the RabbitMQ install, so it will have to do.&lt;/p&gt;

&lt;h2 id=&quot;clients&quot;&gt;Clients&lt;/h2&gt;

&lt;p&gt;There are a bunch of clients available (see
&lt;a href=&quot;http://www.rabbitmq.com/devtools.html&quot;&gt;Client &amp;amp; Developer Tools&lt;/a&gt;).
My first requirement was for Ruby, and there is a collection of
clients on &lt;a href=&quot;https://github.com/ruby-amqp&quot;&gt;ruby-amqp on github&lt;/a&gt;,
with an &lt;a href=&quot;https://github.com/ruby-amqp/amq-client/blob/master/README.textile&quot;&gt;overview of their relations here&lt;/a&gt;.
I initially used &lt;a href=&quot;https://github.com/ruby-amqp&quot;&gt;amqp&lt;/a&gt;, but switched to
&lt;a href=&quot;https://github.com/ruby-amqp/bunny&quot;&gt;bunny&lt;/a&gt; which is easier in scripts
because it’s synchronous.&lt;/p&gt;

&lt;p&gt;For future Java integration I tried
&lt;a href=&quot;http://www.rabbitmq.com/java-client.html&quot;&gt;rabbitmq-java-client&lt;/a&gt;
which worked from a simple project in IDEA.&lt;/p&gt;

&lt;h2 id=&quot;learning&quot;&gt;Learning&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.rabbitmq.com/getstarted.html&quot;&gt;get started&lt;/a&gt; guide takes you
from a simple queue to full topics, and I recommend you follow all of them.
One thing that irked me was that the simple use cases turn out to be just
gloss over the complex use cases. That means that what you learn in the
first lesson actually misleads you (you can’t send message directly to a queue,
it just looks like it), and as you try to move to more complex models it’s
not always clear what smoke and mirrors was used to make the simpler ones
work (Is it because you’re using the default exchange? Is it because there is 
special queuename/routing_key combination? etc). I would have preferred
being told the full model, and have explicit declaration of those
configuration items that affect routing.&lt;/p&gt;

&lt;p&gt;When I look at a message queue, I expect it to work like a mail server:
when I inject a message I expect the MQ to do its damndest to make sure that
a receiver gets it. What I found that with RabbitMQ and bunny, the default
configuration doesn’t: unless you deliver to a queue that has been
explicitly marked durable, via an exchange that is explicitly marked
durable, with a message that is explicitly marked persistent, a simple
server restart can lose messages. This is documented,
in &lt;a href=&quot;http://www.rabbitmq.com/tutorials/tutorial-two-python.html&quot;&gt;tutorial 2&lt;/a&gt;
under “Message durability”, and
in the &lt;a href=&quot;http://www.rabbitmq.com/faq.html#scenarios&quot;&gt;scenarios FAQ&lt;/a&gt;
under “Reliable persistent message delivery” and “Store-and-forward”.
I just find it strange that that’s not the default.&lt;/p&gt;

&lt;p&gt;While experimenting, I used
&lt;a href=&quot;http://www.rabbitmq.com/man/rabbitmqctl.1.man.html&quot;&gt;rabbitmqctl&lt;/a&gt;
to inspect the server state, which is useful, but the
&lt;a href=&quot;http://www.rabbitmq.com/management.html&quot;&gt;Management Plugin&lt;/a&gt;.
looks even more promising.
I had not found a tool to drink from the
&lt;a href=&quot;http://www.rabbitmq.com/firehose.html&quot;&gt;firehose&lt;/a&gt;,
but it didn’t take long to make a quick-and-dirty
&lt;a href=&quot;https://gist.github.com/1122629&quot;&gt;rabbitmq-trace-logger&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now I’m looking forward to introducing this into my system architecture
and put it to real work.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/08/06/code-in-a-blog</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/08/06/code-in-a-blog.html"/>
    <title>Code in a blog</title>
    <updated>2011-08-06T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;My blog posts occasionally have some code, and I’ve been wondering
for a while what the current/best way is to do that.&lt;/p&gt;

&lt;p&gt;I was using embedded &lt;a href=&quot;https://gist.github.com/&quot;&gt;gist&lt;/a&gt;s, which look
good, have line-numbers, let you select and copy code without including
the line numbers, let you later modify the code using git goodness,
and have handy view/raw links.
But, I ran into a few problems:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;it only works with JavaScript enabled&lt;/li&gt;
  &lt;li&gt;the script tags didn’t get executed with my fancy DOM-modifying JavaScript&lt;/li&gt;
  &lt;li&gt;sometimes not all embedded snippets would turn up (I’ve not tried to debug that)&lt;/li&gt;
  &lt;li&gt;I don’t really want to depend on inline content hosted by third parties&lt;/li&gt;
  &lt;li&gt;I’m not wild about the “This Gist brought to you by GitHub” advertising&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So for grins I spent some time evaluating some JavaScript highlighters (from this
&lt;a href=&quot;http://www.webdesignbooth.com/9-useful-javascript-syntax-highlighting-scripts/&quot;&gt;list of 9&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/&quot;&gt;SyntaxHighlighter&lt;/a&gt; line-numbers
got easily confused by long wrapping lines&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://code.google.com/p/google-code-prettify/&quot;&gt;Prettify&lt;/a&gt; which wouldn’t show up right&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://softwaremaniacs.org/soft/highlight/en/&quot;&gt;highlight.js&lt;/a&gt; which documents
&lt;a href=&quot;http://softwaremaniacs.org/soft/highlight/en/description/&quot;&gt;custom initialisation&lt;/a&gt; that
allowed me to integrate it with my jQuery DOM manipulation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But in the end I gave up in disgust with JavaScript solutions,
and went with a solution that was right under my nose all along:
Jekyll supports Pygments syntax highlighting (see
&lt;a href=&quot;https://github.com/mojombo/jekyll/wiki/Liquid-Extensions&quot;&gt;docs&lt;/a&gt; and
this &lt;a href=&quot;http://recursive-design.com/blog/2010/10/12/static-blogging-the-jekyll-way/&quot;&gt;blog&lt;/a&gt;).
The easy_install is trivial, I used the
&lt;a href=&quot;https://github.com/mojombo/tpw/blob/master/css/syntax.css&quot;&gt;github syntax.css&lt;/a&gt;,
enabled pygments in &lt;code&gt;_config.yml&lt;/code&gt;, and that was that.
It doesn’t do non-selecting line-numbers, and there’s no raw/view/download etc functionality,
but that’s fine; I can always link to a gist.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/07/28/creating-machines-with-chef</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/07/28/creating-machines-with-chef.html"/>
    <title>Creating Machines with Chef</title>
    <updated>2011-07-28T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;After &lt;a href=&quot;/2011/07/19/chef-0.10-environments.html&quot;&gt;ugrading Chef to use environments&lt;/a&gt;, I needed to update my custom AMIs.
These custom AMIs were based on Ubuntu’s &lt;a href=&quot;http://uec-images.ubuntu.com/&quot;&gt;Amazon EC2 Published AMIs&lt;/a&gt;, have some extra software pre-installed, and have a custom chef client.rb which
gets configuration (chef server info, and client roles) from EC2 userdata to bootstrap itself. I then use scripts
to instantiate machines from those AMIs, and pass them the appropriate userdata.
This has been working great, but is not “the chef way” – the recommendation is to use &lt;code&gt;knife ec2 server create&lt;/code&gt;,
which creates a machine, and then ssh’es in to bootstrap it. In Chef 0.9 I ran into various routing and ssh timing bugs
that made this approach too unreliable, but in 0.10 that appears to have been resolved.
The main advantage of this approach is that you don’t need to make special AMIs; you just use the latest official Ubuntu ones, in any region/arch/store.
The disadvantage of that is that you then have to wait for &lt;code&gt;chef-client&lt;/code&gt; to install all the software, which in the case of Java and RVM/Ruby is a long time. &lt;/p&gt;

&lt;p&gt;So the challenge is to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;make sure that the “knife ec2 server create” method produces functional machines from stock AMIs for all my roles&lt;/li&gt;
  &lt;li&gt;use custom AMIs to preload software, and use them from my existing scripts (which use ec2-run-instances) for selected roles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also wanted to take the opportunity to upgrade OS and sanitise my Ruby install.&lt;/p&gt;

&lt;p&gt;For the OS I wanted to switch from &lt;a href=&quot;|http://www.ubuntu.com/&quot;&gt;Ubuntu&lt;/a&gt; 10.4 Maverick Meerkat to 11.4 Natty Narwhal.
Chef 0.10.2 includes only templates for [&lt;a href=&quot;https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb&quot;&gt;ubuntu10.04-apt&lt;/a&gt;,
&lt;a href=&quot;https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb&quot;&gt;ubuntu10.04-gems.erb&lt;/a&gt;], which can be adapted for 11.4 by changing the “lucid” to “natty”
(or pull the release name out of &lt;code&gt;lsb_release&lt;/code&gt;), but then you end up with Chef 0.9, so you want to add “-0.10”.&lt;/p&gt;

&lt;p&gt;Here I ran into an interesting issue: the apt template does a &lt;code&gt;apt-get install -y chef&lt;/code&gt;, and then writes settings to the &lt;code&gt;client.rb&lt;/code&gt;,
and then runs chef-client for the initial bootstrap.
The problem is that the install also starts the &lt;code&gt;/etc/init.d/chef-client&lt;/code&gt; service, so that executes before the modifications to &lt;code&gt;client.rb&lt;/code&gt; 
are made, and before the chef-client bootstrap runs. In my template modifications I set the &lt;code&gt;node_name&lt;/code&gt;, and as a result the first chef-client
registered the client with the default name (the host name), and the subsequent invocation failed; and I ended up with nodes in the
wrong environment. I think there is actually a generic template bug here.&lt;/p&gt;

&lt;p&gt;We’re using &lt;a href=&quot;http://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; and &lt;a href=&quot;https://rvm.beginrescueend.com/&quot;&gt;RVM&lt;/a&gt; for applications on some machine roles,
and I’ve run into various situations where there has been confusion between
the system ruby, apt, RVM in &lt;code&gt;/usr/local&lt;/code&gt;, RVM in user home directories, various gemsets, and the chef-client and our applications. To reduce that confusion I wanted to try the apt install rather than the default gem install, and limit RVM to a per-user install.
[Update: there are some unique issues, such as knife not finding plugins (&lt;a href=&quot;http://tickets.opscode.com/browse/CHEF-2483&quot;&gt;CHEF-2483&lt;/a&gt;)]&lt;/p&gt;

&lt;h2 id=&quot;the-knife-template&quot;&gt;The Knife Template&lt;/h2&gt;

&lt;p&gt;Pulling it all together I ended up with this &lt;code&gt;knife&lt;/code&gt; template &lt;a href=&quot;https://gist.github.com/1093016&quot;&gt;ubuntu11.04-apt.erb&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;erb&quot;&gt;&lt;span class=&quot;x&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# This is a knife ec2 server create template for Ubuntu 11.4.&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# It is based on the ubuntu10.04-apt.erb version in the 0.10.2 Chef distribution&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# available here:&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# with modifications to:&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# - use the natty APT repository&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# - install Chef 0.10.2&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# - avoid starting the /etc/init.d/chef-client service until the client.rb&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;#   has been written&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# - let a CHEF_NODE_NAME_PREFIX environment variable prefix the node name&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;bash -c &amp;#39;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# MAK: use lsb-release to pick up release name, and add -0.10 to get chef 0.10&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chef_server_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:chef_server_url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validation_client_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:validation_client_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:environment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;if [ ! -f /usr/bin/chef-client ]; then&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;  echo &amp;quot;chef    chef/chef_server_url    string  &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chef_server_url&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;   | debconf-set-selections&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;  [ -f /etc/apt/sources.list.d/opscode.list ] || \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    echo &amp;quot;deb http://apt.opscode.com &amp;quot;`lsb_release -cs`&amp;quot;-0.10 main&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &amp;gt; /etc/apt/sources.list.d/opscode.list&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;  wget -O- http://apt.opscode.com/packages@opscode.com.gpg.key | apt-key add -&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;apt-get update&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;# MAK: use policy-rc.d to prevent chef-client starting and registering&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# before we write client.rb&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;(cat &amp;lt;&amp;lt;&amp;#39;EOP&amp;#39;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;exit 101&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;EOP&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;) &amp;gt; /usr/sbin/policy-rc.d&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;chmod 755 /usr/sbin/policy-rc.d&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;apt-get install -y chef&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;# MAK: remove policy.rc&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;rm -f /usr/sbin/policy-rc.d&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validation_client_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;chef-validator&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;[  `grep -qx &amp;quot;validation_client_name \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validation_client_name&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    /etc/chef/client.rb` ] \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt; || echo &amp;quot;validation_client_name \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validation_client_name&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt; &amp;gt;&amp;gt; /etc/chef/client.rb&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;

&lt;span class=&quot;x&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;cat &amp;lt;&amp;lt;&amp;#39;EOP&amp;#39;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Chef&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:validation_key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;EOP&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;) &amp;gt; /tmp/validation.pem&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;awk NF /tmp/validation.pem &amp;gt; /etc/chef/validation.pem&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;rm /tmp/validation.pem&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:chef_node_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;[ `grep -qx &amp;quot;node_name \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:chef_node_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;   /etc/chef/client.rb` ] \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt; || echo &amp;quot;node_name \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@config&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:chef_node_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt; &amp;gt;&amp;gt; /etc/chef/client.rb&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;

&lt;span class=&quot;x&quot;&gt;# MAK: use an environment variable to pass in a hostname prefix,&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;# so your node gets called e.g. web-server-i-123abc&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;CHEF_NODE_NAME_PREFIX&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nil?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exists?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/usr/bin/ec2metadata&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;cat &amp;lt;&amp;lt;&amp;#39;EOP&amp;#39;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;node_name &amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ENV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;CHEF_NODE_NAME_PREFIX&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;`ec2metadata --instance-id`&amp;quot;&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;EOP&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;) &amp;gt;&amp;gt; /etc/chef/client.rb&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;

&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;_default&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;[  `grep -qx &amp;quot;environment \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; /etc/chef/client.rb` ] \&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt; || echo &amp;quot;environment \&amp;quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;environment&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;\&amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/chef/client.rb&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;-%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;

&lt;span class=&quot;x&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;cat &amp;lt;&amp;lt;&amp;#39;EOP&amp;#39;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;run_list&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@run_list&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_json&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot; /&gt;
&lt;span class=&quot;x&quot;&gt;EOP&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;) &amp;gt; /etc/chef/first-boot.json&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;/usr/bin/chef-client -j /etc/chef/first-boot.json&lt;/span&gt;

&lt;span class=&quot;x&quot;&gt;# MAK: start chef-client because we prevented that previously&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;/etc/init.d/chef-client start&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which you can use likes this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHEF_NODE_NAME_PREFIX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;webserver-
knife ec2 server create -r &lt;span class=&quot;s2&quot;&gt;&amp;quot;role[webserver]&amp;quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -I ami-ab16d2c2 --flavor m1.large -G webserver_demo &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  -x ubuntu --ssh-key demo-kp1 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  --template ubuntu11.04-apt.erb &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  --environment demo
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This works well for bringing up a generic instance with a given role from the command line,
after which Chef kicks in and configures the machine.&lt;/p&gt;

&lt;h2 id=&quot;the-ami&quot;&gt;The AMI&lt;/h2&gt;

&lt;p&gt;To create an AMI there are two approaches: snapshot a running instance, or build an AMI using loopback mounts and chroot.
The former is somewhat easier, the latter is more secure and precise, and is recommended for public AMIs.
For a discussion, see Eric Hammond’s posts on
&lt;a href=&quot;http://alestic.com/2011/06/ec2-ami-security&quot;&gt;Creating Public AMIs Securely for EC2&lt;/a&gt; and
&lt;a href=&quot;http://alestic.com/2010/01/ec2-ebs-boot-ubuntu&quot;&gt;Building EBS Boot AMIs Using Canonical’s Downloadable EC2 Images&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For my private AMI I decided to use the simpler snapshot approach, at least initially to develop the install sequence,
and I’ve split it into separate scripts for easier testing. See &lt;a href=&quot;https://github.com/makuk66/create-ami&quot;&gt;my github create-ami repo&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/07/19/chef-0.10-environments</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/07/19/chef-0.10-environments.html"/>
    <title>Upgrading to Chef 0.12, and using Environments</title>
    <updated>2011-07-19T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve been running &lt;a href=&quot;http://wiki.opscode.com/display/chef/Home&quot;&gt;Chef&lt;/a&gt; version 0.9 for some months,
and I’ve been looking forward to trying out &lt;a href=&quot;http://www.opscode.com/blog/2011/05/02/chef-0-10-0-released/&quot;&gt;0.10&lt;/a&gt;;
in particular the “environments” feature described in OpsCode’s &lt;a href=&quot;http://www.opscode.com/blog/2011/04/21/chef-0-10-preview-environments/&quot;&gt;preview blog post&lt;/a&gt;,
and Chef’s &lt;a href=&quot;http://wiki.opscode.com/display/chef/Environments&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-old-environments&quot;&gt;The Old Environments&lt;/h2&gt;

&lt;p&gt;In Chef 0.9 I had implemented different environments as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;have separate machines running chef-server for each environment&lt;/li&gt;
  &lt;li&gt;have separate chef role definitions for each role × environment combination (e.g. &lt;code&gt;webserver_demo&lt;/code&gt;, &lt;code&gt;webserver_staging&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;use attributes overrides in the roles to have per-environment behaviour&lt;/li&gt;
  &lt;li&gt;selectively load roles into servers (e.g. &lt;code&gt;webserver_demo&lt;/code&gt; is not needed on &lt;code&gt;staging&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;assign roles at boot time from a custom client.rb (in the AMI) using JSON from instance data&lt;/li&gt;
  &lt;li&gt;the same mechanism also names the nodes to include the role and environment, e.g. &lt;code&gt;webserver-demo-i-a1b2c3d4&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;use git to share a chef repository between environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This has worked well, but the role × environment matrix size explosion was a headache to manage,
and keeping the right roles (and only the right roles) in the right servers was error-prone.&lt;/p&gt;

&lt;h2 id=&quot;the-new-environments&quot;&gt;The New Environments&lt;/h2&gt;
&lt;p&gt;In Chef 0.10 environments are a first-class concept.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://wiki.opscode.com/display/chef/Upgrading+Chef+0.9.x+to+Chef+0.10.x&quot;&gt;Upgrading&lt;/a&gt;
some of the servers involved a little trial and error,
fresh &lt;a href=&quot;http://wiki.opscode.com/display/chef/Installation+with+RubyGems&quot;&gt;gem installs&lt;/a&gt; worked fine,
and &lt;a href=&quot;http://wiki.opscode.com/display/chef/Upgrading+Chef+0.9.x+to+Chef+0.10.x#UpgradingChef0.9.xtoChef0.10.x-UpgradeClients&quot;&gt;upgrading the existing clients&lt;/a&gt; was trivial.&lt;/p&gt;

&lt;p&gt;Because I restrict port 22 on internal machines with EC2 security groups I did immediately run into a “ssh hang” bug &lt;a href=&quot;http://tickets.opscode.com/browse/KNIFE_EC2-2&quot;&gt;KNIFE_EC2-2&lt;/a&gt;,
but the &lt;a href=&quot;https://github.com/butlern/knife-ec2/commit/035a5a6515686c7310fc5de0a75afc81a82d6ec0&quot;&gt;linked patch&lt;/a&gt; works fine.&lt;/p&gt;

&lt;p&gt;To then migrate the configuration for existing machines:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;create environment &lt;code&gt;.rb&lt;/code&gt; files, applying the attributes from the old role files&lt;/li&gt;
  &lt;li&gt;create the environments with knife&lt;/li&gt;
  &lt;li&gt;move all nodes to the new enviroments using &lt;a href=&quot;http://wiki.opscode.com/display/chef/Environments#Environments-Movingnodesinbulk&quot;&gt;nodes.tranform&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;create new role files, which have the roles/recipes but not the attributes from the old roles&lt;/li&gt;
  &lt;li&gt;load the new roles, and apply to the relevant machines&lt;/li&gt;
  &lt;li&gt;remove the old roles&lt;/li&gt;
  &lt;li&gt;re-run chef-client and verify all roles succeed&lt;/li&gt;
  &lt;li&gt;verify normal system operation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And that was basically that.&lt;/p&gt;

&lt;p&gt;The next step, was to review how I &lt;a href=&quot;/2011/07/28/creating-machines-with-chef.html&quot;&gt;create machines&lt;/a&gt;.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/07/15/mistreated-by-dell</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/07/15/mistreated-by-dell.html"/>
    <title>Mistreated by Dell</title>
    <updated>2011-07-15T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve been a Dell hardware user for many years – I fondly remember my first
Dimension XPS, and I’m happy user of their curent range of LCD displays.
When I first became their customer, Dell was leading the way in on-line
purchasing of computer hardware to consumers.&lt;/p&gt;

&lt;p&gt;But, I won’t be purchasing from them any more, after the way they’ve
treated me recently.&lt;/p&gt;

&lt;p&gt;This all started when I purchased a monitor in November last year.
I ordered it, entered my credit card details, and Dell shipped the
product. There was a bit of hassle about price, because I wanted them
to honour a advertised sales price, and after several rounds with
sales and customer service, being passed from department to department
over a period of weeks, I was promised a partial refund. After that I 
didn’t think about it again.&lt;/p&gt;

&lt;p&gt;Then in May I received a letter from “Debt &amp;amp; Revenue Services - a debt
collection agency” (DRS), demanding payment. Their letter design and company
name gave me the initial impression this was a public body,
but on closer inspection this appeard to be just a company that works with Dell.
They threatened “further action” if I failed to contact them.&lt;/p&gt;

&lt;p&gt;This was news to me.&lt;/p&gt;

&lt;p&gt;I won’t bore you with the step-by-step interaction, but after several phonecalls
and emails it was obvious that DRS does not have an adequate way of looking into
the circumstances of disputed claimed oustanding payments in a timely fashion,
and never actually bothers to ring you back.
I turned to Dell customer service, where again it took a lot of time to find out more.&lt;/p&gt;

&lt;p&gt;It transpires that when I provided my credit card details to Dell, they
were unable to withdraw funds, apparently due to fraud prevention systems operated
by my credit card issuer. It seems stupid to me that they shipped the product
before receiving payment; it seems incompetent that their automated sales systems
don’t immediately notify the customer in email, or alert a customer service agent
to phone the customer or send a letter if there are problems with a payment.&lt;/p&gt;

&lt;p&gt;After many more emails and phonecalls I negotiated a settlement and re-authorized
the card, but even after I had contacted my bank the transactions continued to be
declined. Rather than trying to fix that problem and drag things out further,
I made a BACS payment on 6&lt;sup&gt;th&lt;/sup&gt; of June. Dell managed to not locate that payment,
but after further phonecalls they were able to confirm they payment had been received.
I thought that was the end of it.&lt;/p&gt;

&lt;p&gt;But, on 14&lt;sup&gt;th&lt;/sup&gt; July I received a mailed “notice of action” from DRS, saying that they will be
calling on or between the 18&lt;sup&gt;th&lt;/sup&gt; of July and the 18&lt;sup&gt;th&lt;/sup&gt; of August between 8am and 8pm.
This is clearly not adequate notice – there are only 2 business days before the
first date, and the one-month period is not adequately precise to be of any use.
But obviously I should not have received this threat at all.&lt;/p&gt;

&lt;p&gt;I rang back again, was told that if I didn’t hear anymore that would be the end of it.
But I’ve been told that before, so today I rang up again, and was told that they had
in fact received confirmation from Dell, but only after this notice of action was
sent out on the 11&lt;sup&gt;th&lt;/sup&gt; June. The envelope did not contain a timestamp, and the notice
itself was undated, but on closer inspection the address label shows “/110711/”,
suggesting that it was actually sent on the 11&lt;sup&gt;th&lt;/sup&gt; of July. Clearly DRS is incapable
of ensuring that mail is dispatched in a timely fashion, and is unable to track their
mail.&lt;/p&gt;

&lt;p&gt;In all, this has cost me many hours to sort out, and has been a stressfull experience.
My conclusion about DRS is that they are sharks that only care about extracting money,
and do not manage their interactions with debtors adequately, and are falling foul of
various aspects of the
&lt;a href=&quot;http://www.oft.gov.uk/shared_oft/business_leaflets/consumer_credit/oft664.pd&quot;&gt;Office of Fair Trading Debt collection guidance&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;They are unclear in their communication, by not detailing adequately what the claimed
debt is for (violating 2.1)&lt;/li&gt;
  &lt;li&gt;They continued demanding payment, even though they knew that the debt had been in dispute
and after it had in fact been settled (violating 2.6h)&lt;/li&gt;
  &lt;li&gt;They completely failed to investigate when I queried and disputed the debt (violating 2.6j)&lt;/li&gt;
  &lt;li&gt;They continued collection activity after I queried and disputed the debt (violating 2.6k)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nor do they confirm any progress (or final settlement) in writing, or even call back when
they say they will. I would suggest that Dell should find a more competent company, but I fear
that they’re all pretty similar, as their incentive structure does not reward good treatment
of debtors.&lt;/p&gt;

&lt;p&gt;But most of my anger is aimed squarely at Dell: sending debt collectors after customers
as a first action, when Dell fails to obtain a properly authorized payment is outrageous.&lt;/p&gt;

&lt;p&gt;Annoyingly, to the Dell and DRS beancounters this episode will be treated as a successful debt recovery
statistic, and thus an incentive to continue this practice.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/30/plugable-usb-display-adapter-uga-2k-a</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/30/plugable-usb-display-adapter-uga-2k-a.html"/>
    <title>Review - Plugable USB Display Adapter UGA-2K-A</title>
    <updated>2011-06-30T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;For some years now I’ve been using a 3 screen workstation setup,
consisting of a laptop (was Windows, now Mac) with external screen,
and an additional screen for my Linux desktop, with
&lt;a href=&quot;http://synergy-foss.org/&quot;&gt;Synergy&lt;/a&gt; providing cross-screen functionality.&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/3-screens.jpg&quot; width=&quot;640&quot; heigth=&quot;428&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;This worked well enough, but recently I’ve found myself getting frustrated:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I use an Apple Wireless Keyboard, and the mapping of Fn/Ctrl/Option/Command
on Linux is confusing&lt;/li&gt;
  &lt;li&gt;I use a &lt;a href=&quot;http://www.apple.com/magictrackpad/&quot;&gt;Apple Magic Trackpad&lt;/a&gt;
(highly recommended by the way), which doesn’t
have 3 Linux mouse buttons obviously, and which seems to scroll too fast
on Linux&lt;/li&gt;
  &lt;li&gt;Synergy occasionally crashes, and the copy-paste sometimes does not work
or does not support the content&lt;/li&gt;
  &lt;li&gt;I do most my work on the Mac, and not being able to use my third screen
for my Mac is unfortunate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some of these issues can be worked around, but it’s not ideal.
So I decided to hook up the third screen to the Mac too,
and because it had no spare display ports, decided to try going over USB.&lt;/p&gt;

&lt;p&gt;There are lots of options:
&lt;a href=&quot;http://uk.startech.com/search?search_term=usb+display&amp;amp;autocomplete=&amp;amp;f_st%20category=Usb+Dvi&amp;amp;ft_st%20category=text&amp;amp;fu_st%20category=&amp;amp;fd_st%20category=Category&quot;&gt;StarTech&lt;/a&gt;,
&lt;a href=&quot;http://www.diamondmm.com/USB-Video-Cards.php&quot;&gt;Diamond&lt;/a&gt;,
&lt;a href=&quot;http://www.evga.com/products/prodlist.asp?switch=10&quot;&gt;EVGA&lt;/a&gt;,
&lt;a href=&quot;http://us.kensington.com/html/17534.html&quot;&gt;Kensington&lt;/a&gt;,
&lt;a href=&quot;http://www.displaylink.com/shop/index.php?product=5&quot;&gt;etc&lt;/a&gt;.
I was looking for a model that was using a modern chipset,
with good support, a good company attitude, and good availability.&lt;/p&gt;

&lt;p&gt;I purchased a
&lt;a href=&quot;http://plugable.com/products/UGA-2K-A/&quot;&gt;Plugable USB Display Adapter UGA-2K-A&lt;/a&gt;
from
&lt;a href=&quot;http://www.amazon.co.uk/Plugable-Multiple-2048x1152-1920x1200-DisplayLink/dp/B0038P1TP4/ref=sr_1_1?ie=UTF8&amp;amp;s=electronics&amp;amp;qid=1309425248&amp;amp;sr=8-1&quot;&gt;Amazon UK&lt;/a&gt;.
This adapter uses the
&lt;a href=&quot;http://www.displaylink.com/technology/displaylink_hardware.php&quot;&gt;DisplayLink DL-195&lt;/a&gt;
which will do 1920x1200 and 2048x1152 on DVI,
and is well known and supported.
The product comes with VGI and HDMI adapters and a USB cable,
and is surprisingly compact at 4cm by 9cm.&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/displaylink-UGA-2K-A-outer-box.png&quot; width=&quot;250&quot; height=&quot;150&quot; /&gt;
&lt;img src=&quot;/img/blog/displaylink-UGA-2K-A-inner-box.png&quot; width=&quot;250&quot; height=&quot;141&quot; /&gt;
&lt;/div&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/displaylink-UGA-2K-A.png&quot; width=&quot;250&quot; heigth=&quot;207&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;The adapter needs a driver for OSX to recognise the display.
The product came with a 8cm CDROM, which my MacBook’s slot-loading drive
won’t take, so I headed over to
&lt;a href=&quot;http://displaylink.com/support/mac_downloads.php&quot;&gt;DisplayLink’s Mac Driver page&lt;/a&gt;
and downloaded the 1.6 driver.
OS 10.7 Lion will need a newer driver that is not yet available.
Installation was trivial, but required a system restart.
After that the display (a Dell Ultrasharp 2005FPW 20” Widescreen LCD Monitor)
was recognised. System Profiler sees the USB device, but doesn’t show a
Graphics/Displays entry:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/displaylink-system-profiler.png&quot; width=&quot;579&quot; height=&quot;373&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;At that point you can re-organise your displays as per usual in the
Displays pane in the System Preferences, which says my display runs at
1680x1050, the panel’s native resolution.&lt;/p&gt;

&lt;p&gt;In short: it works. Display quality is good. Moving windows is a little
slower than on the main displays, but plenty good enough.&lt;/p&gt;

&lt;p&gt;The hardware is passively cooled, so it’s silent,
but it does get a little warm, and needs airflow.
It’s bus powered, and no
&lt;a href=&quot;http://support.apple.com/kb/HT4049?viewlocale=en_US&quot;&gt;Extra Operating Current&lt;/a&gt;
is displayed, so I assume power draw is OK.
I couldn’t see specifications about power draw,
but note they advertise using up to 6 adapters concurrently.&lt;/p&gt;

&lt;p&gt;Some things don’t work. DisplayLink’s website says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Please note: This driver does not support 3D acceleration.
Some features of Mac OS X applications that require hardware
OpenGL acceleration, such as Keynote presentations and iPhoto
slideshows, will not function properly&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I ran into a couple of limitations:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The DVD Player window won’t work on the display – you can move the
window onto it, but it moves itself back to a main display (cute).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Command-Shift-3/4 and Take Screenshot from Preview don’t work on the
display.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.lagentesoft.com/Lagente_Software/PinPoint.html&quot;&gt;PinPoint&lt;/a&gt;
draws a semi-opaque box around the cursor which is ugly and makes it
hard to use:&lt;/p&gt;

    &lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/spinpoint-box.jpg&quot; width=&quot;320&quot; height=&quot;320&quot; /&gt;
&lt;/div&gt;

    &lt;p&gt;I’ve reported this to Lagente Software, who diagnose it as lack of support
for advanced alpha operations by USB adapters. I’ve requested a feature
to allow a user to disable PinPoint on specific displays.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of which I can live with; I’ll be using it mainly for web pages,
email, text editting and monitoring.&lt;/p&gt;

&lt;p&gt;Another minor usability niggle is due to the resolution differences between
my monitors: when you move the pointer from a larger screen to
smaller one, there are parts of the edge of the large window that fall
outside the smaller screen, and won’t let you move onto it; you have
to move down the edge until you get to the top of the smaller screen.
Because my screens are aligned at the bottom, I tend to hit this when
dragging windows, since window title bars are at the top.
If this sort of thing bothers you, get two identical screens, but
make sure the adapter supports your native resolution. In my case the larger
screen is a Dell U2711 (which I do rather like) running at 2560x1440,
which exceeds the adapter’s resolution.&lt;/p&gt;

&lt;p&gt;What about my Linux use, I hear you ask?
No, I’ve not given up on my workstation.
I’ve moved the display onto another (VGA) input on the monitor,
so that I can switch if needed.
Most of what I do is command-line work, so I just ssh from Terminal.
For GUI things I use
&lt;a href=&quot;http://sourceforge.net/projects/cotvnc/&quot;&gt;Chicken of the VNC&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I still use Synergy too, to get to other machines, but by the time
you’re scrolling to screen number 5 it does become a bit silly,
and it’s not something I do often.&lt;/p&gt;

&lt;p&gt;By the way, it looks like this product is supported under Linux too.
From the manufacturer:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;LINUX COMPATIBILITY:
As of Linux kernel 2.6.31, this adapter has open source drivers
in the kernel staging tree. As of 2.6.38, the driver was promoted
to the main kernel tree. Configuration of X Windows for USB displays
is still distribution and scenario dependent, however, and only for
very adventurous users. Plugable is involved with Linux development
work, see http://plugable.com/category/platform/linux/ for details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;which sounds good.&lt;/p&gt;

&lt;p&gt;Conclusion: recommended.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/25/making-pages-faster-still</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/25/making-pages-faster-still.html"/>
    <title>Making Pages Faster still</title>
    <updated>2011-06-25T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;The &lt;a href=&quot;http://www.greenhills.co.uk/2011/06/16/performance-testing-with-webpagetest.html&quot;&gt;previous results&lt;/a&gt;
were a good improvement in terms of webpagetest numbers,
but the visual latency caused by the SSL in the delayed Twitter/Google Reader loads
(for initial load and repeat loads) annoyed me.&lt;/p&gt;

&lt;p&gt;So now I’m pre-fetching those (in a If-Modified-Since friendly way),
store them my own server, combine both into a single file, and load that with caching enabled.
I’ve added a fallback for if the dynamic content on Greenhills is missing, and reworked the
no-Javascript case so it’s nicer.&lt;/p&gt;

&lt;p&gt;According to the
&lt;a href=&quot;http://www.webpagetest.org/result/110625_C6_XJZ4/&quot;&gt;new results&lt;/a&gt;
that has dropped the first pageload from 0.8/1.7/2.6 to 0.7/1.6/1.7,
and repeat page loads from 0.1/0.3/1.5 to 0.1/0.3/0.4.
That’s more like it; switching pages is really fast now.
But the render flicker is noticeable,
and the delayed Twitter/GoogleReader loading flickers too.&lt;/p&gt;

&lt;p&gt;So, next I switched to dynamic content loading in the DOM,
combined with the HTML5 History API per &lt;a href=&quot;http://diveintohtml5.org/history.html&quot;&gt;Dive Into HTML5&lt;/a&gt;,
and some jQuery animation. Now new content loads fast and smooth,
old content stays undisturbed. Bookmarks and links work.
This looks great in current Safari, Chrome and Firefox.
IE9 does not have history API support yet.&lt;/p&gt;

&lt;p&gt;Update: added a spinner if the ajax load takes &amp;gt;1 sec.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/22/elb-traffic-for-the-wrong-host</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/22/elb-traffic-for-the-wrong-host.html"/>
    <title>ELB traffic for the wrong host</title>
    <updated>2011-06-22T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve been using the AWS
&lt;a href=&quot;http://aws.amazon.com/elasticloadbalancing/&quot;&gt;Elastic Load Balancers&lt;/a&gt; (ELB)
for some time now.
The ease of use and scalability appeal.&lt;/p&gt;

&lt;p&gt;But I learned something unpleasant about them:
you can easily end up with misdirected traffic.&lt;/p&gt;

&lt;p&gt;When you use an ELB, your users access it via a CNAME (setup by
you and served by your DNS servers), which points to a DNS name owned
by Amazon (in the elb.amazonaws.com DNS zone).
When your client does a lookup of that name, Amazon then returns the
IP address of an ELB machine that routes the traffic to your EC2 instances.
From time to time, in response to traffic conditions,
those IP addresses change.
To accomodate such changes, the TTL on the domain name is low (60 seconds).&lt;/p&gt;

&lt;p&gt;The problem is that some clients will not honour the TTL,
and may continue using the old IP address after it has been
disassociated with your ELB, and may have been given to someone else’s ELB.
Which means that your ELB may be receiving traffic for someone else,
or that traffic meant for you goes to someone else.&lt;/p&gt;

&lt;p&gt;I found out about this because my instances behind an ELB suddenly
started receiving 15K requests per minute destined for ping.syndic8.com
(judging by the Host header), sent by Ping-O-Matic (judging by the User-Agent header)
and other clients. A DNS lookup of that name showed their ELB address, not mine.
This persisted for many hours, and impacted my application.&lt;/p&gt;

&lt;p&gt;This has been discussed in the forums at times:
&lt;a href=&quot;https://forums.aws.amazon.com/thread.jspa?messageID=212997&amp;amp;#212997&quot;&gt;28 Dec 2010&lt;/a&gt;,
&lt;a href=&quot;https://forums.aws.amazon.com/thread.jspa?messageID=219445&amp;amp;#219445&quot;&gt;28 Jan 2011&lt;/a&gt;,
&lt;a href=&quot;https://forums.aws.amazon.com/thread.jspa?messageID=231589&amp;amp;#231589&quot;&gt;21 Mar 2011&lt;/a&gt;.
It looks like it doesn’t happen (or gets noticed) all that often,
but that it’s a known issue you are meant to be aware of somehow,
and you should just accept or escalate to support.&lt;/p&gt;

&lt;p&gt;I think this is a big deal:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Clients get service errors, or have their traffic exposed to a third party.
Sure, it’s “their fault” for not honouring the TTL, but depending on the kind
of application that you serve this could be a common bug, or outside the control
of the person running the client. I imagine this is especially likely with
scripted API clients.&lt;/li&gt;
  &lt;li&gt;Being on the receiving end of misdirected traffic can affect your level of service.
Sure, if you’re using AutoScaling this may help your load and latency, but at
a financial cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think that at the very least AWS should wait longer before recycling IP addresses.
Ideally they wouldn’t recycle IPs at all – roll on IPv6.
Maybe they could add an ability to associate several elastic IPs, but I imagine that is hard.&lt;/p&gt;

&lt;p&gt;I have various other issues with ELB:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;it is slow to add new servers,&lt;/li&gt;
  &lt;li&gt;you can’t have 2 ELBs pointing to the same instance (during ELB migration)&lt;/li&gt;
  &lt;li&gt;you can’t inspect traffic before it hits the ELB,&lt;/li&gt;
  &lt;li&gt;you can’t block client IP addresses before they hit your servers&lt;/li&gt;
  &lt;li&gt;your connection closes after 60 seconds of idle time&lt;/li&gt;
  &lt;li&gt;you can’t limit your instances to only receive traffic from my ELB (only all ELBs)&lt;/li&gt;
  &lt;li&gt;it’s hard to know what logic the ELB applies to your connection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;but this one is pushing me over the edge –
time to reconsider some of the alternatives.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/16/performance-testing-with-webpagetest</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/16/performance-testing-with-webpagetest.html"/>
    <title>Performance testing with webpagetest</title>
    <updated>2011-06-16T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Oh wow, how did I miss this one?&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/webpagetest.jpg&quot; width=&quot;504&quot; height=&quot;486&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://www.webpagetest.org&quot;&gt;www.webpagetest.org&lt;/a&gt; is like
&lt;a href=&quot;http://developer.yahoo.com/yslow/&quot;&gt;YSlow&lt;/a&gt; and
Safari’s Web Inspector timeline,
but as a hosted service in multiple locations,
and is very comprehensive.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.webpagetest.org/result/110616_FT_V839/&quot;&gt;My results&lt;/a&gt;
show the homepage starts to render 0.5 seconds
is “document complete” in 2s,
and finishes delayed loading in 3s. Total bytes in: 124KB.
In repeat view it’s 0.5s, 0.8s and 1.4s, with 44KB.
Page Speed 1.9, score 95/100.
That’s what I expected based on my local testing,
and I’m happy with that.&lt;/p&gt;

&lt;p&gt;Going with
&lt;a href=&quot;http://www.webpagetest.org/result/110616_S4_V8FZ/1/details/&quot;&gt;London/Chrome config&lt;/a&gt;, I got completely caned by 1s DNS, and twitter fails alltogether.
That will need looking at another day.&lt;/p&gt;

&lt;p&gt;Things I want to improve in the short term:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;add missing epxirations tags to my static assets&lt;/li&gt;
  &lt;li&gt;making my own twitter widget will help the most (I knew that already)&lt;/li&gt;
  &lt;li&gt;consider &lt;a href=&quot;http://aws.amazon.com/cloudfront/&quot;&gt;CloudFront&lt;/a&gt; for static assets for at least template images.
I have a slight philosophical objection against using CDN resources
as URLs; I wish you could list CDN copies and your original as a fallback.&lt;/li&gt;
  &lt;li&gt;fix their IE text centering (for the screenshots)&lt;/li&gt;
  &lt;li&gt;look into delaying jQuery loading (tricky, and maybe not worth the hassle)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then there is of course pre-baking the currently-lazily-loaded content,
but that’s going to require a bunch more coding and can come later.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update. June 18&lt;sup&gt;&lt;small&gt;th&lt;/small&gt;&lt;/sup&gt;:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;added Expires with &lt;a href=&quot;http://redmine.lighttpd.net/wiki/1/Docs:ModExpire&quot;&gt;Lighttpd mod_expire&lt;/a&gt;,
disabled etags with &lt;a href=&quot;http://redmine.lighttpd.net/wiki/lighttpd/Docs:ConfigurationOptions&quot;&gt;static-file.etags&lt;/a&gt;
(fails for compressed content because of a &lt;a href=&quot;http://redmine.lighttpd.net/issues/1585&quot;&gt;lighttpd issue&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;made my own twitter widget with &lt;a href=&quot;http://api.jquery.com/jQuery.getScript/&quot;&gt;jQuery.getScript&lt;/a&gt;. This makes inital rendering fast, but actual tweet loading slower because twitter redirects to HTTPS. I don’t know if there is a way to stop that (“Always use HTTPS” is off in Twitter’s account settings),
but this issue will go away in future&lt;/li&gt;
  &lt;li&gt;moved images to S3 manually (&lt;a href=&quot;http://s3tools.org/s3cmd-sync&quot;&gt;s3cmd sync&lt;/a&gt; would help) and enabled CloudFront with a CNAME. Annoyingly CloudFront doesn’t do gzipping of text/css and text/javascript of S3 content;
workarounds are unsatisfactory and the
&lt;a href=&quot;http://www.nomitor.com/blog/2010/11/10/gzip-support-for-amazon-web-services-cloudfront/&quot;&gt;Custom Origin mechanism&lt;/a&gt;
a bit of a faff. For now I just use my own copies.&lt;/li&gt;
  &lt;li&gt;fixed the IE centering with the use of &lt;a href=&quot;http://ipinfo.info/netrenderer/index.php&quot;&gt;netrenderer&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;decided against delayed jQuery loading because of the complexity. Did combine my JS files, and delayed their loading.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.webpagetest.org/result/110618_3R_VRRD/&quot;&gt;result&lt;/a&gt; is 0.8/1.7/2.6 (139K), and 0.1/0.3/1.5 (10K).
Not much difference, but these are small margins anyway. Fixing the data flow will have more visual impact.
Log analysis on my server (excluding my browser, w3c validator and webpagetest requests) shows no meaningful reduction in traffic, a reflection of the fact that it is dominated by search engines and malware bots. Heigh-ho.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/12/www-or-bare-domain</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/12/www-or-bare-domain.html"/>
    <title>WWW or bare domain?</title>
    <updated>2011-06-12T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Should your website address have a www (e.g. &lt;code&gt;www.example.org&lt;/code&gt;) or not (e.g. &lt;code&gt;example.org&lt;/code&gt;)?
This question came up again recently, prompting me to look into it a bit more, and write down my thoughts.
Some people feel fairly strongly about this; there is even a &lt;a href=&quot;http://no-www.org/&quot;&gt;campaign&lt;/a&gt; against “www”.
The alternative, called bare domains, zone apex domains or root domains, is not without issues.&lt;/p&gt;

&lt;p&gt;Some arguments against:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The www just looks “old”&lt;/li&gt;
  &lt;li&gt;www is unpleasant to spell. In conversation the short form “web” has taken over the “world wide web” phrase, so “www” is just weird and ugly&lt;/li&gt;
  &lt;li&gt;New exciting startups use bare domains: &lt;a href=&quot;http://twitte.com/&quot;&gt;Twitter&lt;/a&gt;, &lt;a href=&quot;http://stackoverflow.com/&quot;&gt;Stack Overflow&lt;/a&gt;, lots of others&lt;/li&gt;
  &lt;li&gt;Typing www takes more effort, which on some mobile platforms can be inconvenient&lt;/li&gt;
  &lt;li&gt;Separate www used to be needed because you had separate machines serving as web servers; Layer 4 content switches make that a non-issue&lt;/li&gt;
  &lt;li&gt;In URLs the www is superfluous visually, because the “http://” in the URL indicates that it is a web site&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some arguments in favour:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the www looks familiar&lt;/li&gt;
  &lt;li&gt;Most popular websites use www: &lt;a href=&quot;http://www.facebook.com/&quot;&gt;Facebook&lt;/a&gt;, &lt;a href=&quot;http://www.google.com/&quot;&gt;Google&lt;/a&gt;, &lt;a href=&quot;http://www.zynga.com&quot;&gt;Zynga&lt;/a&gt;, most others&lt;/li&gt;
  &lt;li&gt;Typing www is hardly ever needed: browsers can prepend it for you, and you don’t often need to type URLs anyway, because you usually reach sites through existing links on other pages, bookmarks, history suggestions etc.&lt;/li&gt;
  &lt;li&gt;Separate www makes management more flexible because you can have separate addresses with different A records&lt;/li&gt;
  &lt;li&gt;The www makes a hostname visually self-identify as a web address, without needing an ugly “http://”. This is especially appealing in printed marketing materials such as business cards, TV ads etc. This may be even more important for uncommon top-level domain names (those other than .com/.org/.net), especially newly created ones and country TLDS that are used for vanity domains, which non-expert users may not recognise. Note also that some browser (e.g. Google Chrome) hide the “http://”, so it may fall further out of use.&lt;/li&gt;
  &lt;li&gt;bare domains are not allowed to have CNAMEs in the DNS, but CNAMEs are strongly recommended in some network configurations&lt;/li&gt;
  &lt;li&gt;bare domains can confuse email configurations&lt;/li&gt;
  &lt;li&gt;some DNS control panels at DNS providers don’t allow you to use bare domains&lt;/li&gt;
  &lt;li&gt;SSL configuration is easier with “www”, because that gets matched by “*.example.com” wildcard certificates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ultimately people seem to decide based on entrenched taste rather than
actual usability or technical arguments.
But I’m interested in considering the technical implications.
Having the “www” has no technical drawbacks, but bare domains have two: the CNAME problem and the mail problem,
which I would like to explore in some more detail.&lt;/p&gt;

&lt;p&gt;The CNAME problem stems from the &lt;a href=&quot;http://www.ietf.org/rfc/rfc1034.txt&quot;&gt;RFC1034&lt;/a&gt; DNS specification rule which states that:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“If a CNAME RR is present at a node, no other data should be
present; this ensures that the data for a canonical name and its aliases
cannot be different.  This rule also insures that a cached CNAME can be
used without checking with an authoritative server for other RR types.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A bare domain must have SOA and NS records (these are the basis of authority delegation in DNS),
so if it also had a CNAME, that would violate the above rule.&lt;/p&gt;

&lt;p&gt;So, what problems are caused by this restriction that you cannot use CNAMEs for your web server address?
Surely you can simply not use CNAMEs, but use A records to locate your web server?
Actually, that depends. Some
&lt;a href=&quot;http://en.wikipedia.org/wiki/Content_delivery_network&quot;&gt;CDN&lt;/a&gt;s use CNAMEs
(&lt;a href=&quot;http://www.rackspace.com/cloud/blog/2011/04/27/it’s-here-cloud-files-now-supports-cnames-for-cdn-enabled-content/&quot;&gt;RackSpace&lt;/a&gt;,
&lt;a href=&quot;http://docs.amazonwebservices.com/AmazonCloudFront/latest/GettingStartedGuide/&quot;&gt;Amazon CloudFront&lt;/a&gt;).
Likewise, load balancers from cloud hosting providers like Amazon EC2 typically require CNAMEs.
Amazon has relatively recently &lt;a href=&quot;http://aws.typepad.com/aws/2011/05/moving-ahead-with-amazon-route-53.html&quot;&gt;announced&lt;/a&gt;
a solution: &lt;a href=&quot;http://docs.amazonwebservices.com/Route53/latest/DeveloperGuide/index.html?CreatingAliasRRSets.html&quot;&gt;Amazon Route 53 alias resource record sets&lt;/a&gt;. &lt;a href=&quot;http://www.heroku.com&quot;&gt;Heroku&lt;/a&gt; documents DNS configuration for
&lt;a href=&quot;http://devcenter.heroku.com/articles/custom-domains#dns_setup&quot;&gt;custom domains&lt;/a&gt; (duly requiring A addresses for root domains),
but after a recent DDoS they &lt;a href=&quot;http://status.heroku.com/incident/156&quot;&gt;recommend against root domains&lt;/a&gt; because they don’t
allow their system administrators to update IP addresses.&lt;/p&gt;

&lt;p&gt;Next, the email issue. To deliver internet email, a message sender consults the DNS for the MX record
of the destination, then looks up the resulting DNS name, which results in an A record, listing the IP address
of the mail server (MTA) to connect to. If there is no MX record on the destination, the sender does a lookup of A records on the name itself.
With bare domains you can have A records pointing to the web server, and the MX record to a different server that
runs the mail server (MTA). The problem comes when the MX lookup fails (or is not done), and the sender falls back to the A record
– it now talks to the wrong address and fails to deliver the email. Now, wether this message sender behaviour is advisable
is debatable, and not all mail sending software will work in the same way. I think that it is likely that this is less of a
problem now than it was years ago. But if you weren’t using bare domains then you’d have no A records on your domain,
and this wouldn’t be a problem at all.&lt;/p&gt;

&lt;p&gt;So neither issues are show-stoppers, but it seems that having “www” is more straightforward all round.&lt;/p&gt;

&lt;p&gt;This topic would not be complete without the obvious recommendations that you should only have one canonical URL for a resource.
So if you use bare domains, you should also support www and redirect it to the bare domain, in case people type it out of habit.
Or if you use “www”, you could redirect your bare domain to it.&lt;/p&gt;

&lt;p&gt;As an aside: in the early days of the web the “web” hostname was sometimes used,
and I used it myself for web.nexor.co.uk before the “www” became the norm.
I still prefer it visually, and in transcription.
But, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Principle_of_least_astonishment&quot;&gt;principle of least surprise&lt;/a&gt;
directs me to continue using “www” for my own websites.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/11/spotify-pinpoint</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/11/spotify-pinpoint.html"/>
    <title>Spotify / Pinpoint Window Move Bug</title>
    <updated>2011-06-11T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;
I finally found the cause of an annoying behaviour of
&lt;a href=&quot;http://www.spotify.com/uk/download/mac/&quot;&gt;Spotify for Mac OS X&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Spotify lets you move the main window around the screen by
clicking anywhere in the window and dragging; not just in the titlebar.
This is not typical Mac behaviour, so they must have implemented this
themselves. Normally this doesn't cause a problem: Spotify recognises
when you click in a scrollbar, and operates just the scrollbar as
you expect.
&lt;/p&gt;

&lt;p&gt;
I also use
&lt;a href=&quot;http://www.lagentesoft.com/Lagente_Software/PinPoint.html&quot;&gt;PinPoint&lt;/a&gt;
which help you visually locate your mouse pointer, especially useful if you
use multiple large high-resolution screens.
I have it set to draw a subtle circle (&quot;Celtica&quot;)
around the pointer while it moves, and 0.5s after the pointer stops.
&lt;/p&gt;

&lt;p&gt;
The problem is that this appears to cause Spotify to fail to detect when
mouse moves happen in its scrollbars: it both moves the scrollbar scroller (thumb)
and also moves the window, and makes the scrolling erratic.
The &quot;workaround&quot; is not to drag in the scrollbar,
but single-click in the scrollbar in the desired location,
or to quite PinPoint.
&lt;/p&gt;
&lt;p&gt;
Here is a screen recording that demonstrates the problem:
&lt;/p&gt;
&lt;div class=&quot;photo_frame_center&quot;&gt;
 &lt;video width=&quot;480&quot; height=&quot;360&quot; controls preload=&quot;none&quot;
  poster=&quot;/img/blog/spotify-pinpoint-window-move/spotify-pinpoint-window-move.jpg&quot;&gt;
  &lt;source src=&quot;/img/blog/spotify-pinpoint-window-move/spotify-pinpoint-window-move.mp4&quot;
   type='video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;'&gt;
  &lt;source src=&quot;spotify-pinpoint-window-move.webm&quot; type='video/webm; codecs=&quot;vp8, vorbis&quot;'&gt;
  &lt;source src=&quot;/img/blog/spotify-pinpoint-window-move/spotify-pinpoint-window-move.ogv&quot;
   type='video/ogg; codecs=&quot;theora, vorbis&quot;'&gt;
  &lt;!-- also on http://vimeo.com/makuk66/spotify-pinpoint-window-move-bug --&gt;
  &lt;iframe src=&quot;http://player.vimeo.com/video/24959362?title=0&amp;amp;byline=0&amp;amp;portrait=0&quot;
   width=&quot;400&quot; height=&quot;300&quot;&gt;&lt;/iframe&gt;
 &lt;/video&gt;
&lt;/div&gt;

&lt;p&gt;
Spotify's &lt;a href=&quot;http://www.spotify.com/uk/help/faq/tech/#bug-reports&quot;&gt;FAQ&lt;/a&gt;
says to report bugs by posting in the forums.
&lt;a href=&quot;http://getsatisfaction.com/spotify/topics/spotify_scrollbar_problem_with_pinpoint&quot;&gt;Done&lt;/a&gt;.
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/11/embedded-video</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/11/embedded-video.html"/>
    <title>Embedding video in blog posts</title>
    <updated>2011-06-11T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;This is how I embed a video in a blog post on my Mac,
such that it shows up in current versions of Apple Safari (which wants MPEG 4),
Mozilla FireFox 4 (which wants Ogg Video “Theora”), and
Google Chrome (which does both).
The original video format is typically from a QuickTime Screen Recording
or some such in a &lt;code&gt;movie.mov&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;open in QuickTime Player, Save As, format iPhone, save to the Desktop. This produces a folder named &lt;code&gt;movie&lt;/code&gt; containing a &lt;code&gt;movie - iPhone.m4v&lt;/code&gt; and &lt;code&gt;movie.jpg&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;remame the &lt;code&gt;movie - iPhone.m4v&lt;/code&gt; to &lt;code&gt;movie.mp4&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;run &lt;a href=&quot;http://v2v.cc/~j/ffmpeg2theora/download.html&quot;&gt;ffmpeg2theora&lt;/a&gt; on the mp4, which produces a &lt;code&gt;movie.ogv&lt;/code&gt;. Or use &lt;a href=&quot;http://www.mirovideoconverter.com/&quot;&gt;MiroVideoConverter&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;drag the mov into &lt;a href=&quot;http://www.mirovideoconverter.com/&quot;&gt;MiroVideoConverter&lt;/a&gt; and convert it to WebM (vp8) format&lt;/li&gt;
  &lt;li&gt;upload the &lt;code&gt;movie.mov&lt;/code&gt; to &lt;a href=&quot;http://www.vimeo.com/&quot;&gt;Vimeo&lt;/a&gt;. Go to Settings, Custom URL, give it a name.&lt;/li&gt;
  &lt;li&gt;once available, click “embed”, copy the iframe tag from the code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then to embed in the blog posts:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;photo_frame_center&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;video&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;480&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;360&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;controls&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;preload=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;none&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;poster=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/img/blog/movie/movie.jpg&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/img/blog/movie/movie.mp4&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;video/mp4; codecs=&amp;quot;avc1.42E01E, mp4a.40.2&amp;quot;&amp;#39;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/img/blog/movie/movie.ogv&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;video/ogg; codecs=&amp;quot;theora, vorbis&amp;quot;&amp;#39;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;/img/blog/movie/movie.webm&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;video/webm; codecs=&amp;quot;vp8, vorbis&amp;quot;&amp;#39;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://player.vimeo.com/video/24959362?title=0&amp;amp;amp;byline=0&amp;amp;amp;portrait=0&amp;quot;&lt;/span&gt;
   &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;400&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;300&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;/video&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Here is an &lt;a href=&quot;http://localhost:4000/2011/06/11/spotify-pinpoint.html&quot;&gt;example blog post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This version works on the iPhone, but a is a bit low-quality.
The &lt;code&gt;movie - Computer.m4v&lt;/code&gt; version is much better,
but if you use that then the iPhone only displays the poster,
and doesn’t actually let you play the movie.&lt;/p&gt;

&lt;p&gt;At the moment Jekyll doesn’t seem to recognise the video tag in Markdown,
so as a workaround use a &lt;code&gt;.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.m4v&lt;/code&gt; to &lt;code&gt;.mp4&lt;/code&gt; renaming seems to work;
alternatively use
&lt;a href=&quot;http://www.mirovideoconverter.com/&quot;&gt;MiroVideoConverter&lt;/a&gt; or
Squared 5 &lt;a href=&quot;http://www.squared5.com/svideo/mpeg-streamclip-mac.html&quot;&gt;MPEG Streamclip for Mac OS X&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Instead of using Vimeo I could convert to FLV and use an embedded Flash player like
&lt;a href=&quot;http://flowplayer.org/&quot;&gt;FlowPlayer&lt;/a&gt; or
&lt;a href=&quot;http://www.longtailvideo.com/players/&quot;&gt;JW Player&lt;/a&gt;,
but that seems hardly worth the effort.&lt;/p&gt;

&lt;p&gt;For more than you ever want to know about HTML5 video, see the
&lt;a href=&quot;http://diveintohtml5.org/video.html&quot;&gt;Video chapter in Dive into HTML5&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/10/lxc</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/10/lxc.html"/>
    <title>Linux Containers (LXC)</title>
    <updated>2011-06-10T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;In this post I wrote up my first experience setting up LXC on Ubuntu 11.04 Natty,
mainly for my own reference, but possibly of interest to others.&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;In the past I’ve used various technologies to slice up a computer in various ways:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For security I’ve used &lt;a href=&quot;http://en.wikipedia.org/wiki/Chroot&quot;&gt;Linux chroot&lt;/a&gt;s and &lt;a href=&quot;http://en.wikipedia.org/wiki/FreeBSD_jail&quot;&gt;BSD jails&lt;/a&gt; for isolation, which works well but has limited control&lt;/li&gt;
  &lt;li&gt;For hosting web/mail servers I’ve used &lt;a href=&quot;http://www.xen.org/&quot;&gt;Xen&lt;/a&gt;, but got frustrated at the Dom0/DomU OS restrictions and the lack of support (then) in the mainline kernels&lt;/li&gt;
  &lt;li&gt;I switched to &lt;a href=&quot;https://help.ubuntu.com/community/KVM&quot;&gt;KVM&lt;/a&gt; (through &lt;a href=&quot;http://libvirt.org/&quot;&gt;libvirt&lt;/a&gt;), and am pleased with how well that works&lt;/li&gt;
  &lt;li&gt;I’ve experimented with &lt;a href=&quot;http://wiki.openvz.org/Main_Page&quot;&gt;OpenVZ&lt;/a&gt;, but found it complex to manage, and again there was (then) no mainline kernel support. LXC will eventually replace OpenVZ in Ubuntu.&lt;/li&gt;
  &lt;li&gt;For test environments with different OSes I’ve run &lt;a href=&quot;http://wiki.qemu.org/Main_Page&quot;&gt;Qemu&lt;/a&gt;, &lt;a href=&quot;http://www.virtualbox.org/&quot;&gt;VirtualBox&lt;/a&gt;, &lt;a href=&quot;http://www.parallels.com/&quot;&gt;Parallels&lt;/a&gt;, and &lt;a href=&quot;http://www.vmware.com/products/workstation/&quot;&gt;VMWare Workstation&lt;/a&gt;, which work well with ISOs and graphical user interfaces&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have been particularly keen on trying out
&lt;a href=&quot;http://lxc.sourceforge.net/&quot;&gt;Linux Containers&lt;/a&gt; (LXC):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the cgroups controls looks very powerful (see &lt;a href=&quot;http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch01.html&quot;&gt;RHEL docs&lt;/a&gt;) and are integrated into Linux scheduler&lt;/li&gt;
  &lt;li&gt;performance is said to be good, because there is no virtualisation overhead&lt;/li&gt;
  &lt;li&gt;it’s part of mainline kernels&lt;/li&gt;
  &lt;li&gt;the management uses command-line tools and seems reasonably straightforward&lt;/li&gt;
  &lt;li&gt;it’s actively developed so there should be community support (&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/lxc-users&quot;&gt;lxc-users&lt;/a&gt;, &lt;a href=&quot;irc://irc.freenode.net/lxcontainers&quot;&gt;irc&lt;/a&gt;, &lt;a href=&quot;http://sourceforge.net/tracker/?group_id=163076&amp;amp;atid=826303&quot;&gt;bugs&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;it’s not fragmented like the commercial product ranges&lt;/li&gt;
  &lt;li&gt;it’s backed by vendors (e.g. part of &lt;a href=&quot;http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Technical_Notes/kernel.html&quot;&gt;RHEL6&lt;/a&gt;, &lt;a href=&quot;https://help.ubuntu.com/community/LXC&quot;&gt;Ubuntu&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;it’s free as an in beer, and free as in GPL 2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes it look ideal for achieving isolation for hosting purposes.
But, it’s young technology, so I expect bumps in the road.&lt;/p&gt;

&lt;h2 id=&quot;getting-started&quot;&gt;Getting Started&lt;/h2&gt;

&lt;p&gt;My main goals:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;create a container, and get it talking to the network&lt;/li&gt;
  &lt;li&gt;document a set of instructions for preparing the host for LXC from scratch&lt;/li&gt;
  &lt;li&gt;document a set of instructions for creating a new LXC container&lt;/li&gt;
  &lt;li&gt;configure some containers for actual use&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The test machine is running Ubuntu 11.04 (Natty).&lt;/p&gt;

&lt;p&gt;I’ve found several resources:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/LXC&quot;&gt;Ubuntu Community Documentation LXC page&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/&quot;&gt;Ubuntu 10.04 instructions on the Shadows of epiphany blog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://lxc.teegra.net/&quot;&gt;Dwight Schauer’s LXC HOWTO&lt;/a&gt; and &lt;a href=&quot;http://fex.rus.uni-stuttgart.de/lxc-ubuntu&quot;&gt;Ulli Horlacher’s derivative instructions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;an &lt;a href=&quot;https://www.ibm.com/developerworks/linux/library/l-lxc-containers/&quot;&gt;article on IBM developerWorks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;some hints on &lt;a href=&quot;http://www.emanuelis.eu/2011/06/02/how-to-create-ubuntu-11-04-natty-narwhal-lxc-template/&quot;&gt;Emanuelis’ blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;but it’s not clear which are accurate, up-to-date etc.
I tried with Ulli’s instructions, but that resulted in a non-booting instance (quite possibly because I did something wrong), seems to duplicate some configuration that’s built-in, and seems to have some unique external dependencies.
I then tried Emanuelis’s method, but that looks incomplete, at least by comparison.
So I ended up with elements from each.&lt;/p&gt;

&lt;p&gt;There is also the question about what networking configuration to use.
My hosting provider has some
&lt;a href=&quot;http://www.bytemark.co.uk/support/technical_documents/vmh_start&quot;&gt;restrictions&lt;/a&gt;
for fully bridged setups, and recommend
&lt;a href=&quot;http://www.bytemark.co.uk/support/technical_documents/vmh_public_proxy_arp&quot;&gt;Proxy ARP&lt;/a&gt;
or
&lt;a href=&quot;http://www.bytemark.co.uk/support/technical_documents/vmh_public_internal_bridge&quot;&gt;internal bridge&lt;/a&gt;].
If you use an internal bridge, you can either configure a traditional subnet,
or use point-to-point transfer links using RFC1918 addresses (see &lt;a href=&quot;http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg01969.html&quot;&gt;this description by Marc Haber&lt;/a&gt;).
When I initially tried the latter, I found that I needed to specify “scope link” on the internal link
(and use “pinpoint” in /etc/network/interfaces)
or specify an explicit “src” on the default route to make sure that the packets were sent from the
public IP rather than the internal link IP (see &lt;a href=&quot;https://gist.github.com/1024578&quot;&gt;these notes&lt;/a&gt;).
Then it worked well. This scheme is appealing in that
you don’t waste IP addresses to the controlling host and subnet broadcast, and there’s something satisfying
about plumbing explicit links. But, it does make the network layout look more
complex (for things like ip &lt;code&gt;addr list&lt;/code&gt;, &lt;code&gt;ip route list&lt;/code&gt;, and outbound &lt;code&gt;traceroute&lt;/code&gt;),
and complicates the configuration in &lt;code&gt;/etc/network/interfaces&lt;/code&gt;,
so in the end I changed to a traditional subnet.&lt;/p&gt;

&lt;h2 id=&quot;preparing-the-controlling-host&quot;&gt;Preparing the controlling host&lt;/h2&gt;

&lt;p&gt;To prepare the controlling host:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;mkdir /lxc
&lt;span class=&quot;c&quot;&gt;#! mount a suitable partition (local, or NFS) on /lxc&lt;/span&gt;
ln -s /lxc /var/lib/

apt-get install lxc debootstrap

aptitude install vlan bridge-utils python-software-properties screen libpcap-dev
aptitude install tcpdump ntp

&lt;span class=&quot;c&quot;&gt;# prepare cgroup&lt;/span&gt;
mkdir -p /cgroup
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;none /cgroup cgroup defaults 0 0&amp;quot;&lt;/span&gt; &amp;gt;&amp;gt;/etc/fstab
mount /cgroup

apt-get install bridge-utils
apt-get remove network-manager network-manager-pptp

&lt;span class=&quot;c&quot;&gt;# allow ip forwarding&lt;/span&gt;
cat &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOD&amp;gt;/etc/sysctl.d/20-lxc.conf&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;net.ipv4.ip_forward = 1&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOD&lt;/span&gt;
sysctl -w net.ipv4.ip_forward&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1

&lt;span class=&quot;c&quot;&gt;# create internal bridge and allow forwarding. Adjust address for your allocation&lt;/span&gt;
brctl addbr br0
cat &amp;gt;&amp;gt; /etc/network/interfaces &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOM&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;auto br0&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;iface br0 inet static&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    address 46.43.55.73&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    netmask 255.255.255.248&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOM&lt;/span&gt;
ifup br0
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;creating-a-new-container&quot;&gt;Creating a new container&lt;/h2&gt;

&lt;p&gt;To create a new container:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# adjust these for your purposes&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;natty2
&lt;span class=&quot;nv&quot;&gt;THIS_IP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;46.43.55.74
&lt;span class=&quot;nv&quot;&gt;GW_IP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;46.43.55.73
&lt;span class=&quot;nv&quot;&gt;NETMASK&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;255.255.255.248
&lt;span class=&quot;nv&quot;&gt;BITS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/29

&lt;span class=&quot;nv&quot;&gt;LXCDIR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/lxc

&lt;span class=&quot;nv&quot;&gt;ROOTFS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$LXCDIR&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/rootfs
&lt;span class=&quot;nv&quot;&gt;CONFIG&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/root/lxc-&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;-config.tmp
cat &amp;gt; &lt;span class=&quot;nv&quot;&gt;$CONFIG&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOM&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;lxc.network.type = veth&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;lxc.network.link = br0&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;lxc.network.name = eth0&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOM&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# create (but not start) the container&lt;/span&gt;
lxc-create -n &lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt; -t natty -f &lt;span class=&quot;nv&quot;&gt;$CONFIG&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# add the root user from the controlling host to the container password file&lt;/span&gt;
grep root /etc/shadow &amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow.new
egrep -v &lt;span class=&quot;s1&quot;&gt;&amp;#39;^root:&amp;#39;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow &amp;gt;&amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow.new
mv &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow.new &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow
chgrp shadow &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow
chmod o-rwx &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/shadow

&lt;span class=&quot;c&quot;&gt;# copy authorized_keys&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -f /root/.ssh/authorized_keys &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  &lt;/span&gt;cp -a --parents /root/.ssh/authorized_keys &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# copy some configs from the controlling host&lt;/span&gt;
cp -a --parents &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  /etc/ntp.conf  &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  /etc/timezone &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# update the resolv.conf config (lxc-create put the controlling host resolv.conf into &amp;quot;original&amp;quot;)&lt;/span&gt;
cat &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/resolvconf/resolv.conf.d/original &amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/resolvconf/resolv.conf.d/base

&lt;span class=&quot;c&quot;&gt;# configure the network&lt;/span&gt;
cat &amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/network/interfaces &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOM&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;auto lo&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;iface lo inet loopback&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;auto eth0&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;iface eth0 inet static&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  address $THIS_IP&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  netmask $NETMASK&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;  gateway $GW_IP&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOM&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# update the apt sources to include multiverse&lt;/span&gt;
cat &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOD&amp;gt; $ROOTFS/etc/apt/sources.list&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;deb http://de.archive.ubuntu.com/ubuntu/ natty          main restricted universe multiverse&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;deb http://de.archive.ubuntu.com/ubuntu/ natty-updates  main restricted universe multiverse&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;deb http://de.archive.ubuntu.com/ubuntu/ natty-security main restricted universe multiverse&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOD&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# remove unneeded postinstall scripts (container does not have udev or the graphical boot animation)&lt;/span&gt;
rm &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/var/lib/dpkg/info/udev.postinst
rm &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/var/lib/dpkg/info/plymouth.postinst

&lt;span class=&quot;c&quot;&gt;# copy kernel modules&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;kernel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;uname -a | awk &lt;span class=&quot;s1&quot;&gt;&amp;#39;{print $3}&amp;#39;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
mkdir -p &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/lib/modules/&lt;span class=&quot;nv&quot;&gt;$kernel&lt;/span&gt;/kernel
cp /lib/modules/&lt;span class=&quot;nv&quot;&gt;$kernel&lt;/span&gt;/modules.dep &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/lib/modules/&lt;span class=&quot;nv&quot;&gt;$kernel&lt;/span&gt;/
cp -R /lib/modules/&lt;span class=&quot;nv&quot;&gt;$kernel&lt;/span&gt;/kernel/net &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/lib/modules/&lt;span class=&quot;nv&quot;&gt;$kernel&lt;/span&gt;/kernel/

&lt;span class=&quot;c&quot;&gt;# add tmpfs&lt;/span&gt;
cat &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOD &amp;gt; $ROOTFS/etc/fstab&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;tmpfs  /dev/shm   tmpfs  defaults  0 0&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOD&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# add ipv6 localhost&lt;/span&gt;
cat &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOD &amp;gt;&amp;gt; $ROOTFS/etc/hosts&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;# The following lines are desirable for IPv6 capable hosts&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;::1     localhost ip6-localhost ip6-loopback&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;fe00::0 ip6-localnet&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;ff00::0 ip6-mcastprefix&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;ff02::1 ip6-allnodes&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;ff02::2 ip6-allrouters&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;ff02::3 ip6-allhosts&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOD&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# set locale info&lt;/span&gt;
cat &amp;gt;&amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/environment &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOM&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;LANG=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;LANGUAGE=&amp;quot;en_US:en&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOM&lt;/span&gt;

cat &amp;gt; &lt;span class=&quot;nv&quot;&gt;$ROOTFS&lt;/span&gt;/etc/default/locale &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOM&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;LANG=&amp;quot;en_US.UTF-8&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;LANGUAGE=&amp;quot;en_US:en&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOM&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# start the container&lt;/span&gt;
lxc-start --name &lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt; --daemon &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
       --console &lt;span class=&quot;nv&quot;&gt;$LXCDIR&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;.console &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
       --logfile&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LXCDIR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;.log

&lt;span class=&quot;c&quot;&gt;# connect to it, log in as root. Note you can escape out with Ctrl+a q&lt;/span&gt;
lxc-console --name &lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LANG&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;C

&lt;span class=&quot;c&quot;&gt;# test networking&lt;/span&gt;
ping -c 1 www.google.com

&lt;span class=&quot;c&quot;&gt;# update packages and install more&lt;/span&gt;
apt-get update
apt-get install -y apt-utils iptables rsyslog sudo
apt-get install -y ssh ntp lsof wget
apt-get install -y iputils-ping mtr-tiny dnsutils bind9-host
apt-get install -y ia32-libs libterm-readline-gnu-perl dialog
apt-get install -y aptitude tcpdump man less curl

&lt;span class=&quot;c&quot;&gt;# set supported locales&lt;/span&gt;
cat &lt;span class=&quot;s&quot;&gt;&amp;lt;&amp;lt;EOD&amp;gt; /var/lib/locales/supported.d/en&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US                   ISO-8859-15&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US.Latin1            ISO-8859-1&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US.Latin9            ISO-8859-15&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US.ISO-8859-1        ISO-8859-1&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US.ISO-8859-15       ISO-8859-15&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_US.UTF-8             UTF-8&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;en_GB.UTF-8             UTF-8&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;EOD&lt;/span&gt;
dpkg-reconfigure locales

&lt;span class=&quot;c&quot;&gt;# remove unused init.d scripts for the hardware clock&lt;/span&gt;
/usr/sbin/update-rc.d -f umountfs remove
/usr/sbin/update-rc.d -f hwclock.sh remove
/usr/sbin/update-rc.d -f hwclockfirst.sh remove
rm /etc/init.d/hwclock*

&lt;span class=&quot;c&quot;&gt;# remove unused audio devices&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /dev
rm mixer* *midi*  audio* dsp* smpte* mpu* sequencer sndstat

&lt;span class=&quot;c&quot;&gt;# remove hardware clock and boot settings&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /etc/init
rm -f hwclock*  plymouth*

&lt;span class=&quot;c&quot;&gt;# optional: reboot to test the container comes up, and log in again&lt;/span&gt;
reboot

lxc-start --name &lt;span class=&quot;nv&quot;&gt;$NAME&lt;/span&gt; --daemon &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
       --console &lt;span class=&quot;nv&quot;&gt;$LXCDIR&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;.console &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
       --logfile&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LXCDIR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;/&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;NAME&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;.log

&lt;span class=&quot;c&quot;&gt;# disconnect from the console&lt;/span&gt;
Ctrl+a q

&lt;span class=&quot;c&quot;&gt;# ssh in&lt;/span&gt;
ssh -l root &lt;span class=&quot;nv&quot;&gt;$THIS_IP&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;I imagine there will be further tweaks, but this is a good start.&lt;/p&gt;

&lt;h2 id=&quot;lxc-commands&quot;&gt;LXC Commands&lt;/h2&gt;

&lt;p&gt;We’ve already seen
&lt;code&gt;lxc-create&lt;/code&gt;,
&lt;code&gt;lxc-start&lt;/code&gt;,
&lt;code&gt;lxc-stop&lt;/code&gt;, and
&lt;code&gt;lxc-console&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To list processes belonging to all LXC containers:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;root@thunder:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lxc-ps --lxc
CONTAINER    PID TTY          TIME CMD
natty1     19126 ?        00:00:00 init
natty1     19181 ?        00:00:00 upstart-udev-br
natty1     19183 ?        00:00:00 sshd
natty1     19186 ?        00:00:00 udevd
natty1     19269 ?        00:00:00 udevd
natty1     19270 ?        00:00:00 udevd
natty1     19568 ?        00:00:00 upstart-socket-
natty1     19594 pts/4    00:00:00 getty
natty1     19596 pts/2    00:00:00 getty
natty1     19597 pts/3    00:00:00 getty
natty1     19613 pts/1    00:00:00 login
natty1     19614 pts/5    00:00:00 getty
natty1     19706 pts/1    00:00:00 bash
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;root@thunder:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;lxc-ps --lxc --forest
CONTAINER    PID TTY          TIME CMD
natty1     19126 ?        00:00:00 init
natty1     19181 ?        00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; upstart-udev-br
natty1     19183 ?        00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; sshd
natty1     19186 ?        00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; udevd
natty1     19269 ?        00:00:00  |   &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; udevd
natty1     19270 ?        00:00:00  |   &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; udevd
natty1     19568 ?        00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; upstart-socket-
natty1     19594 pts/4    00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; getty
natty1     19596 pts/2    00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; getty
natty1     19597 pts/3    00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; getty
natty1     19613 pts/1    00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; login
natty1     19706 pts/1    00:00:00  |   &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; bash
natty1     19614 pts/5    00:00:00  &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt; getty
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;I’m going to skip &lt;code&gt;lxc-ls&lt;/code&gt; because it’s needlessly confusing.&lt;/p&gt;

&lt;h2 id=&quot;sharing-a-filesystem&quot;&gt;Sharing a filesystem&lt;/h2&gt;

&lt;p&gt;The recommended way of sharing part of the controlling host filesystems with the container
is to use bind mounts. For example:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# on the controlling host&lt;/span&gt;
root@thunder:/# lxc-stop --name natty1
root@thunder:/# mkdir /mydata
root@thunder:/# mkdir /var/lib/lxc/natty1/rootfs/mydata
root@thunder:/# mount -o &lt;span class=&quot;nb&quot;&gt;bind&lt;/span&gt; /mydata /var/lib/lxc/natty1/rootfs/mydata
root@thunder:/# lxc-start --name natty1 --daemon &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&amp;gt;       --console /var/lib/lxc/natty1.console &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&amp;gt;       --logfile&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/lib/lxc/natty1.log

&lt;span class=&quot;c&quot;&gt;# in the container&lt;/span&gt;
root@natty1:/# ls -ld /mydata
drwxr-xr-x 2 root root 4096 Jun 13 11:53 /mydata
root@natty1:/# touch /mydata/hi.txt

&lt;span class=&quot;c&quot;&gt;# on the controlling host&lt;/span&gt;
root@thunder:/# ls /mydata
hi.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;so-far&quot;&gt;So far&lt;/h2&gt;

&lt;p&gt;LXC seems to work just fine. It’s fast.
Documentation is lacking, and tooling seems limited.
In terms of complexity it’s not dissimilar to the early days of Xen and KVM.
So far so good.
At this point I can see myself switching to LXC for my hosting purposes.&lt;/p&gt;

&lt;p&gt;To do next (time permitting):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;reconfigure the host and use LVM for the containers&lt;/li&gt;
  &lt;li&gt;actually use it for a while for for real work in multiple containers&lt;/li&gt;
  &lt;li&gt;try nested containers, to test the install instructions (and just because you can)&lt;/li&gt;
  &lt;li&gt;review online resources more to see what else I’m missing, and update this post accordingly&lt;/li&gt;
  &lt;li&gt;maybe do some performance tests&lt;/li&gt;
  &lt;li&gt;look into libvirt support&lt;/li&gt;
  &lt;li&gt;look into limiting CPU/IO etc through cgroups, and document that in a separate post&lt;/li&gt;
  &lt;li&gt;run some KVM guests alongside; that should just work&lt;/li&gt;
  &lt;li&gt;configure IPv6&lt;/li&gt;
  &lt;li&gt;experiment with NAT to see if I can add additional containers on RFC1918 addresses&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/10/jekyll-atom</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/10/jekyll-atom.html"/>
    <title>ATOM for jekyll</title>
    <updated>2011-06-10T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I found &lt;a href=&quot;https://github.com/coyled/coyled.com/blob/master/atom.xml&quot;&gt;ATOM
for jekyll&lt;/a&gt;, so now we have a &lt;a href=&quot;/atom.xml&quot;&gt;feed&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/10/bytemark</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/10/bytemark.html"/>
    <title>Bytemark</title>
    <updated>2011-06-10T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve got a new premium dedicated server with &lt;a href=&quot;http://www.bytemark.co.uk/&quot;&gt;Bytemark&lt;/a&gt;.
Remote console, ipv6, good support.&lt;/p&gt;

&lt;p&gt;The machine came with Maverick (Ubuntu 10.10) installed, so I upgraded to Natty (11.04).
Note: you need to first install iptables, or do-release-upgrade fails (filed as
&lt;a href=&quot;https://bugs.launchpad.net/update-manager/+bug/794590&quot;&gt;Ubuntu Update Manager Bug #794590&lt;/a&gt;).&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/10/apache-lucene-eurocon-2011</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/10/apache-lucene-eurocon-2011.html"/>
    <title>Apache Lucene Eurocon</title>
    <updated>2011-06-10T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Just announced:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;a href=&quot;http://2011.lucene-eurocon.org/pages/about&quot;&gt;&lt;img src=&quot;http://2011.lucene-eurocon.org/attachments/0001/9354/Euro-Barcelona-logoSmallest-Low-Res.png&quot; width=&quot;355&quot; height=&quot;161&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://2011.lucene-eurocon.org/pages/about&quot;&gt;Apache Lucene EuroCon 2011&lt;/a&gt;,
end of October in
&lt;a href=&quot;http://maps.google.co.uk/maps/place?q=C%2F+Avenida+Sarri%C3%A1,+50+Barcelona+-+SPAIN+08029&amp;amp;fb=1&amp;amp;gl=uk&amp;amp;hnear=0x48761aec186b9a3d:0xa1185c8c9f04020,Camden+Town&amp;amp;cid=8528999586415332161&amp;amp;t=h&amp;amp;z=14&quot;&gt;Barcelona&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/09/interests</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/09/interests.html"/>
    <title>Interests</title>
    <updated>2011-06-09T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Just testing inline image handling in Jekyll.
Here’s a tag cloud created with &lt;a href=&quot;http://www.wordle.net/&quot;&gt;Wordle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img width=&quot;640&quot; heigth=&quot;416&quot; src=&quot;/img/interests.jpg&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/09/embedded-gist</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/09/embedded-gist.html"/>
    <title>Embedded gists</title>
    <updated>2011-06-09T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Testing embedded gists. Here is a .bashrc, with code to display &lt;a href=&quot;https://rvm.beginrescueend.com/&quot;&gt;RVM&lt;/a&gt; stuff in the prompt.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1016461.js?file=.bashrc&quot;&gt;&lt;/script&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/09/alug</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/09/alug.html"/>
    <title>ALUG meet June 2011</title>
    <updated>2011-06-09T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Location: &lt;a href=&quot;http://www.thecoachthorperoad.co.uk/&quot;&gt;Coach and Horses&lt;/a&gt; pub, Norwich.
Present: Bill, David, &lt;a href=&quot;http://www.alug.org.uk/SrdjanTodorovic&quot;&gt;DralaFi&lt;/a&gt;, katsmeat, &lt;a href=&quot;http://www.greenhills.co.uk&quot;&gt;mak&lt;/a&gt;, &lt;a href=&quot;http://www.quinophex.org/&quot;&gt;quinophonex&lt;/a&gt;, StillVoid, &lt;a href=&quot;http://www.alug.org.uk/StevePearce&quot;&gt;stevepdp&lt;/a&gt;, &lt;a href=&quot;http://www.alug.org.uk/BenBewick&quot;&gt;ViperFang&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ViperFang’s &lt;a href=&quot;http://www.arduino.cc/&quot;&gt;Arduino&lt;/a&gt;
&lt;a href=&quot;http://www.arduino.cc/en/Main/ArduinoBoardNano&quot;&gt;Nano&lt;/a&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Seven-segment_display&quot;&gt;7-segment&lt;/a&gt;
display was proudly announcing the ALUG table, at least until he started “improving it”
with his USB soldering iron.
We admired katsmeat’s bicycle light mounting made from Shapelock,
as featured on WikiPedia’s &lt;a href=&quot;http://en.wikipedia.org/wiki/Polycaprolactone&quot;&gt;Polycaprolactone&lt;/a&gt; page.
Beer was consumed. Various topics were discussed (Lassange, the electricity usage of
bitcoin farming versus cannabis farming, C#/.NET, home schooling, Python, the car industry, &lt;a href=&quot;http://www.archlinux.org/&quot;&gt;Arch Linux&lt;/a&gt;,
beer and diets, Chef, much else). Sudo privileges were duly abused for the installation of computer games,
and someone felt the need to boot Linux on &lt;a href=&quot;http://bellard.org/jslinux/index.html&quot;&gt;JavaScript PC emulator&lt;/a&gt;
running on Firefox running on an Android phone, for no good reason at all.
A good time was had.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/06/08/first</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/06/08/first.html"/>
    <title>Blogging Like a Hacker</title>
    <updated>2011-06-08T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;div class=&quot;photo_frame_float_right_top&quot;&gt;
&lt;img src=&quot;/img/blog/old-greenhills200x319.jpg&quot; width=&quot;200&quot; height=&quot;319&quot; class=&quot;photo_float_right&quot; /&gt;
&lt;br /&gt;
The old look
&lt;/div&gt;

&lt;p&gt;The greenhills.co.uk website has remained mainly unchanged for over a decade.
Its main design dates back to the “homepages” of the early Web, using the most basic of HTML.
The look and feel was one of simplicity and contrast, with some minor usability features
(keyword high-lighting, breadcrumbs), and un-constrained resizing.
For its extremely limited purpose, that has been just fine.
But by today’s standards it is looking dated, is too light on content,
and doesn’t suit modern screen sizes.&lt;/p&gt;

&lt;p&gt;The implementation was based on some Perl scripts that convert XML into HTML,
applying some common page elements, with some minimal CSS. The deployment used
a simple Makefile and rsync, and a standard Apache server, later replaced by lighttpd.
I still prefer markup-based content and command-line based management over UIs,
and I still find static sites appealing, but there are better templating options available today. &lt;/p&gt;

&lt;p&gt;So, it’s time for an updated approach, and a fresh look and feel.&lt;/p&gt;

&lt;p&gt;I’m resisting the temptation to turn this into a play project
with the latest crop of server-side technologies (I’m sure there is Node.js/MongoDB fun to be had),
because that’s not conducive to either achieving a result in a reasonable timeframe, or simplifying long-term maintenance.
I could give up and migrate to some hosted blog service, but I like independence.
I could follow the path of least resistance with WordPress,
but I’ve managed to stay away from PHP for too long to admit defeat now.&lt;/p&gt;

&lt;p&gt;I decided to use &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;jekyll&lt;/a&gt;
(&lt;a href=&quot;http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html&quot;&gt;intro&lt;/a&gt;,
&lt;a href=&quot;https://github.com/mojombo/jekyll/wiki&quot;&gt;code&lt;/a&gt;,
&lt;a href=&quot;https://github.com/mojombo/jekyll/wiki&quot;&gt;wiki&lt;/a&gt;),
and named this blog post in its honour.&lt;/p&gt;

&lt;p&gt;Jekyll uses text markup (&lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt;),
is managed from the command-line, and works well with git.
It has a decent templating engine.
It’s a mature project, and open source.
It uses ruby, which I’m familiar with.
It’s a static site generator, which makes hosting easy.
All good.&lt;/p&gt;

&lt;div class=&quot;photo_frame_float_right&quot;&gt;
&lt;img src=&quot;/img/blog/new-greenhills200x248.jpg&quot; width=&quot;200&quot; height=&quot;248&quot; class=&quot;photo_float_right&quot; /&gt;
&lt;br /&gt;
The new look
&lt;/div&gt;

&lt;p&gt;For the page layout I chose a standard blog design, to make it instantly recognisable: 
header, horizontal navigation, main content, with a sidebar. Visually, I’ve toned down
the contrast, and removed the keyword highlighting and breadcrumbs, to get a more relaxed
look. I’ve applied a maximum width, and use flush left / ragged-right alignment,
to keep the content readable. Post pages work well with
&lt;a href=&quot;http://www.apple.com/safari/whats-new.html#reader&quot;&gt;Safari’s Reader&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As I don’t expect to be blogging much, but want to give visitors some updated content,
I added Twitter and Google Reader content in the sidebar. For now that uses standard
webclips, which are slow to load, but that can be addressed later.&lt;/p&gt;

&lt;p&gt;I’ve used a newer photo for accuracy, reduced it in size for modesty, and moved it to
the sidebar to make the site content more personal, and to tie in with the more real-time
elements from the sidebar.&lt;/p&gt;

&lt;p&gt;The header photo is from a recent visit to San Francisco’s Baker Beach.
I chose the photo because it has green(ish) hills, but with some rock faces and trees for interest,
and chose this crop because it is somewhat symmetrical and draws the eye to the middle of the page.&lt;/p&gt;

&lt;p&gt;While more tweaking is to be done, this a good start.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/05/25/lucene-revolution</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/05/25/lucene-revolution.html"/>
    <title>Lucene Revolution 2011 presentation</title>
    <updated>2011-05-25T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img src=&quot;/img/blog/LR2011_header_0.png&quot; width=&quot;639&quot; height=&quot;150&quot;&gt;
&lt;/div&gt;

&lt;p&gt;
Slides for my &quot;Practical Search in the Cloud&quot;
talk at
&lt;A href=&quot;http://www.lucidimagination.com/events/conferences/revolution/2011&quot;&gt;Lucene Revolution 2011 in San Francisco&lt;/a&gt;
are now &lt;a href=&quot;http://www.lucidimagination.com/files/Krellenstein%20Marc%20-%20Practical%20Search%20in%20the%20Cloud.pdf&quot;&gt;online&lt;/a&gt;.
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2011/05/19/websequencediagrams</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2011/05/19/websequencediagrams.html"/>
    <title>Web Sequence diagrams</title>
    <updated>2011-05-19T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Drawing sequence diagrams by hand in OmniGraffle or some such?
Check out &lt;a href=&quot;http://www.websequencediagrams.com/&quot;&gt;WebSequenceDiagrams&lt;/a&gt;,
a hosted service that generates beautiful sequence diagrams based on a simple domain language.&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;img class=&quot;photo&quot; src=&quot;/img/blog/websequencediagrams.png&quot; /&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/10/02/south-norfolk-sustainable-communities-day</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/10/02/south-norfolk-sustainable-communities-day.html"/>
    <title>South Norfolk Sustainable Communities Day</title>
    <updated>2010-10-02T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I spent this Saterday at the
&lt;a href=&quot;http://www.south-norfolk.gov.uk/environment/4584.asp&quot;&gt;South Norfolk Sustainable Communities Day
2010&lt;/a&gt;
at the Costessey Centre.&lt;/p&gt;

&lt;p&gt;I attended three workshops, wearing my
Wymondham Scouts and Guides Hall Management Committee
hat.&lt;/p&gt;

&lt;h2 id=&quot;the-grants-and-funding-workshop&quot;&gt;The Grants and Funding workshop&lt;/h2&gt;
&lt;p&gt;by Meryl Harding from the South Norfolk Council.&lt;/p&gt;

&lt;p&gt;This workshop was more about general fundraising processes rather than
specific funds available from the council itself. Lots of good info
about tips and pitfalls wih applications, and I look forward to
reviewing the slides. Some points that stood out:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Ensure that your project is covered under the governing documents
of your organisation&lt;/li&gt;
  &lt;li&gt;If you’re a single person, become a team of a few&lt;/li&gt;
  &lt;li&gt;Have policies for: Health and Safety, Equality, Protection of Children
and vulnerable adults. 
&lt;a href=&quot;http://www.voluntarynorfolk.org.uk/&quot;&gt;Voluntary Norfolk&lt;/a&gt;
has some templates&lt;/li&gt;
  &lt;li&gt;Quantify the amount of time volunteers at your organisation spend.
When quantifying the value of volunteer time in monetary terms,
accepted norms are £8/h per person, and £15/h for professionals.&lt;/li&gt;
  &lt;li&gt;Determine strengths in your community – even people who don’t want to
commit to time on the committee may have skills to contribute.
Note to self: at the next AGM invite, spell that out.&lt;/li&gt;
  &lt;li&gt;Personality types: “Anchor” is the person who takes pause to question
the project being suitable/feasible, which can be viewed negatively
as prohibiting progress, but also positively as a sanity check.&lt;/li&gt;
  &lt;li&gt;Obviously need a project plan, with milestones. Need a consultation.
Need a communication plan, to show partners and beneficiaries what
progress has been made. We do that as a matter of course, but it’s
not something we normally spell out in an application; we should.&lt;/li&gt;
  &lt;li&gt;Need a delivery team, which may be distinct from the funding team.&lt;/li&gt;
  &lt;li&gt;Spell out what happens after a project. Funder like a lasting
positive effect, and it’s important to show how any
obligations/costs (if any)
would be met.&lt;/li&gt;
  &lt;li&gt;Projects ideas/plans can run away with themselves, in a direction that’s
not a good match to the organisation, or you personally.&lt;/li&gt;
  &lt;li&gt;Capital projects need legal tenure of the site. Our management committee
is OK, as we act as Custodian for the owning trust.&lt;/li&gt;
  &lt;li&gt;Do you need planning permission for your project?&lt;/li&gt;
  &lt;li&gt;See the presentation for a list of advisors/helpers. For me,
  &lt;a href=&quot;http://www.voluntarynorfolk.org.uk/&quot;&gt;Voluntary Norfolk&lt;/a&gt; and
  &lt;a href=&quot;http://www.voluntarynorfolk.org.uk/&quot;&gt;Norfolk RCC&lt;/a&gt; look useful for helping
  to find grants.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.bitc.org.uk/east_of_england/programmes/prohelp/norfolk_prohelp.html&quot;&gt;Norfolk Pro Help&lt;/a&gt; is an organisation that provides professional help,
from laywers, architects etc.&lt;/li&gt;
  &lt;li&gt;local government sources of funding:
&lt;a href=&quot;http://www.norfolk.gov.uk/&quot;&gt;County Council&lt;/a&gt;,
&lt;a href=&quot;http://www.south-norfolk.gov.uk/&quot;&gt;South Norfolk Council&lt;/a&gt;,
&lt;a href=&quot;http://wymondhamtc.norfolkparishes.gov.uk/&quot;&gt;Wymondham Town Council&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.grantnet.com/&quot;&gt;GRANTnet&lt;/a&gt;. I signed up for that a while back
but haven’t used it yet.&lt;/li&gt;
  &lt;li&gt;Meryl gets daily notification on funding opportunities with occasionally
short deadlines. Email her specifics of your project to be notified of
possible matches, and get a project plan prepared so you can execute an
application quickly.&lt;/li&gt;
  &lt;li&gt;From the “Making It Happen” slide: people from the left (funders)
want to see things from the column on the right (volunteers etc).&lt;/li&gt;
  &lt;li&gt;Some companies are happy to donate materials, e.g. B&amp;amp;Q
(See &lt;a href=&quot;http://www.diy.com/diy/jsp/corporate/content/environment_ethics/ethics/community/index.jsp&quot;&gt;B&amp;amp;Q Community&lt;/a&gt;)
often for specific types of project (e.g. pond materials)&lt;/li&gt;
  &lt;li&gt;Some villages have village charities. The Parish Clerk (in my case
&lt;a href=&quot;http://wymondhamtc.norfolkparishes.gov.uk/contact-us-town-map-bus-r/&quot;&gt;Town Clerk&lt;/a&gt;)
would know.&lt;/li&gt;
  &lt;li&gt;loans: often local people/organisations are prepared to extend loans.
Availability is typically word of mouth, but again the Parish Clerk
would know.&lt;/li&gt;
  &lt;li&gt;reporting (during and post project) is often important,
and in some cases so onerous you may regret ever doing the project.&lt;/li&gt;
  &lt;li&gt;Some public companies have schemes for matched fundraising, or 
volunteer teams (something mentioned in committee by Tracey; was it Aviva?).&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.entrust.org.uk/home/lcf&quot;&gt;LCF&lt;/a&gt; companies in the area:
&lt;a href=&quot;http://www.wren.org.uk/&quot;&gt;WREN&lt;/a&gt;
&lt;a href=&quot;http://www.veoliatrust.org/&quot;&gt;Veolia&lt;/a&gt;
&lt;a href=&quot;http://www.biffaward.org/&quot;&gt;BIFFA&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;check out the &lt;a href=&quot;http://www.biglotteryfund.org.uk/&quot;&gt;Big Lottery Fund&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;South Norfolk Council 
&lt;a href=&quot;http://www.south-norfolk.gov.uk/democracy/2981.asp&quot;&gt;Neighbourhood Fund&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Before doing Lottery applications, get adivce (e.g. from Meryl)&lt;/li&gt;
  &lt;li&gt;From our region 29% of applications (not sure to who) were succesful.
I guess that means I shouldn’t feel bad about an unsuccesful application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I asked a few questions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For emergency short-term funding (like our heating), there isn’t anything
available.&lt;/li&gt;
  &lt;li&gt;I asked about the typical “have you applied elsewhere” question in 
applications. Funders quite like to see different applications for
different projects under some umbrella initiative, but they don’t
like you hedging your bets by applying to different source for the
same project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;energy-efficiency-for-domestic-properties&quot;&gt;Energy Efficiency for Domestic properties&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://cejugbo.blogspot.com/&quot;&gt;Christopher Ejugbo&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/#!/cejugbo&quot;&gt;@cejugbo&lt;/a&gt;)
from the &lt;a href=&quot;http://www.energysavingtrust.org.uk/&quot;&gt;Energy Saving Trust&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Topics included energy saving and renewable energies.  There are still
cavity and loft insulation grants for the over-70s and people on
income support. There is increasing interest, and shortening payback
times, in domestic Photo Voltaic, especially since the &lt;a href=&quot;http://www.energysavingtrust.org.uk/Generate-your-own-energy/Sell-your-own-energy/Feed-in-Tariff-scheme&quot;&gt;Feed-in Tariff
scheme&lt;/a&gt;
became available earlier this year.&lt;/p&gt;

&lt;p&gt;He mentioned free solar schemes where a company
essentially leases your roof, installs panels, gives you free
electricity, and then make money on selling the excess to the grid.
As I write these notes, the TV shows an ad for 
&lt;a href=&quot;http://www.homesun.com/&quot;&gt;HomeSun&lt;/a&gt;
which sounds like the scheme he referred to.&lt;/p&gt;

&lt;p&gt;There was an audience question about an estimated figure of 10% energy
use of standby mode devices.  It may be fashionable to rag against
unsubstantiated statistics, but for the purpose of this presentation I
didn’t feel it really mattered much. Still, I had a quick look on my
iPhone (thanks ubiqutous wireless)
at &lt;a href=&quot;http://www.withouthotair.com/&quot;&gt;David MacKay’s Sustainable Energy book online&lt;/a&gt; and found the
&lt;a href=&quot;http://www.inference.phy.cam.ac.uk/withouthotair/c22/page_155.shtml&quot;&gt;Chapter on energy Efficiency&lt;/a&gt;
where he quotes a 8% figure from the
&lt;a href=&quot;http://www.iea.org/&quot;&gt;International Energy Agency&lt;/a&gt;
&lt;a href=&quot;http://www.iea.org/textbase/nppdf/free/2000/blipinthenight01.pdf&quot;&gt;2001 study&lt;/a&gt;,
see annex A2.2; they are estimates, and there’s quite a spread between countries.
But I guess that’s where that figure comes from, and I would imagine the
subsequent standby regulations for manufacturers have improved things.&lt;/p&gt;

&lt;p&gt;David also nicely illustrates a personal case study where he
was able to make significant savings in his own house after switching
off “vampires”. See also the &lt;a href=&quot;http://www.inference.phy.cam.ac.uk/withouthotair/c11/page_68.shtml&quot;&gt;chapter on Gadgets&lt;/a&gt;. But do balance all this with
&lt;a href=&quot;http://www.inference.phy.cam.ac.uk/withouthotair/c19/page_114.shtml&quot;&gt;chapter Every BIG helps&lt;/a&gt;. Anyways, I digress; back to the presentation.&lt;/p&gt;

&lt;p&gt;There was a question about Air Source Heat Pump efficiency in practice.
Christopher referred to the
&lt;a href=&quot;http://www.energysavingtrust.org.uk/Generate-your-own-energy/Heat-pump-field-trial&quot;&gt;Heat pump field trial&lt;/a&gt; report and its conclusions.
As a heat pump owner myself, I looked over the recommendations and
re-appraised our installation:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the new part of our building is well insulated&lt;/li&gt;
  &lt;li&gt;we have it mainly for underfloor heating&lt;/li&gt;
  &lt;li&gt;we have occupation during the day&lt;/li&gt;
  &lt;li&gt;we have solar collector assist&lt;/li&gt;
  &lt;li&gt;we’re not served by the gas network&lt;/li&gt;
  &lt;li&gt;we were replacing and end-of-life boiler that relied on oil deliveries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;so in our case it made a lot of sense.
Of course the system is as yet untested in winter,
so we’ll see.&lt;/p&gt;

&lt;h2 id=&quot;waste-management&quot;&gt;Waste Management&lt;/h2&gt;
&lt;p&gt;This session was split in parts: an introduction by 
Alexandra Bone (&lt;a href=&quot;http://twitter.com/#!/alexandraboneuk&quot;&gt;@alexandraboneuk)&lt;/a&gt;
Senior Environment Officer of the South Norfolk Council,
a case study of the
&lt;a href=&quot;http://www.denton-norfolk.co.uk/information/waste-recycling.php&quot;&gt;Denton Community Composting&lt;/a&gt; scheme by organiser Liz Cargil,
and a presentation on recycling strategy
from Gill Flanagan from the Norfolk County Council.
Followed by general questions to Alex and Gill about mainly rubbish bin
collection.&lt;/p&gt;

&lt;p&gt;I found the Community Composting Scheme intriguing.
Denton has 150 households, 61 take part, scheme has run for 7 years now.
Waste is collected weekly in bags.
A volunteer working party processes the material one afternoon a week.
Waste is collected already separated (grass, weeds, other).
Rough bits are shredded.
The reception bins reduce to half size in a week,
are forked over into other bins and left a year.
The resulting compost is sold at 50p/bag, back to the local community only.
Some gardeners buy up to 20 bags in one go.
Income from bags is about £140/year,
additional income comes from the council’s recycling credits.
Total proceeds are ~£800.
Tricky aspects:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;access/location is important&lt;/li&gt;
  &lt;li&gt;green garden waste only; no kitchen/food waste&lt;/li&gt;
  &lt;li&gt;paperwork/licenses because they collect, and more because they process&lt;/li&gt;
  &lt;li&gt;seasons depend on weather&lt;/li&gt;
  &lt;li&gt;weather conditions require extra mangement (e.g. add water in dry periods)&lt;/li&gt;
  &lt;li&gt;attracting volunteers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It sounds like a successfull and well-run scheme; but also sounds like a 
lot of work.&lt;/p&gt;

&lt;p&gt;Gill Flanagan explained the
&lt;a href=&quot;http://www.norfolk.gov.uk/Environment/Waste_and_recycling/Recycling/Recycling_credits/index.htm&quot;&gt;NCC recycling credits scheme&lt;/a&gt;.  It is built on
the idea of disposal avoidance – disposing costs the council money
(£72/tonne), so if you reduce waste you save money, and get to share
in the saving. Materials collected are paper, glass, cans/metals,
textiles.  Collection/processing is often arranged through third party
recycler services. Furniture is re-used where possible, like through the
Salvation Army Furniture Workshop
(see also &lt;a href=&quot;http://www.frn.org.uk/&quot;&gt;Furniture Re-Use Network&lt;/a&gt;.
The recycling credits scheme deals with 350 organisations,
6300(?) tonnes, and £239.000 credits. More on
&lt;a href=&quot;http://www.norfolk.gov.uk/recycling&quot;&gt;the website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The recycling credits are an important part of the income for my 
organisation, so I asked if any changes in level were foreseen.
Nothing is known at this point, but given that this is a cost saving
scheme, it is perhaps less likely to be affected by budget cuts.&lt;/p&gt;

&lt;h2 id=&quot;keynote&quot;&gt;Keynote&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.uea.ac.uk/env/cserge/people/tim_o'riordan.htm&quot;&gt;Prof. Tim O’Riordan&lt;/a&gt;
Emeritus Professor of Environmental Sciences at the University of East Anglia.&lt;/p&gt;

&lt;p&gt;This was a talk without slides, and my note-taking was lacking here so
I can’t do the talk full justice, but here is a flavour. Please let me
know if you have corrections.&lt;/p&gt;

&lt;p&gt;Tim started off sharing his astonishment how the environmental agenda
has been pretty much disappeared from the news and public conscious,
because of the banking crises and fears over austerity, even though
climate change is a problem of much more major impact than short-term
economic bips. The focus now seems to be mainly on the short term, and
getting back to the (unsustainable) way things were, rather than on
looming crises, future generations, and humanity’s survival.&lt;/p&gt;

&lt;p&gt;He pleaded for action at a local level, by normal people, pushing
society at large and politicians in particular from the bottom up.&lt;/p&gt;

&lt;p&gt;He proposed a South Norfolk Low Carbon Fighting Fund to part-fund
local initiatives, but keep it outide of councils so the fund can be
ring-fenced from budget pressures. The fund could be generated from
among other things £1 on parking. I found that amusing, given the
enourmeous controversy over council pay car parks in rural market
towns like Wymondham and Attleborough in the last few years. Many
people in the rural community can only access services in those towns
by car, and there are concerns for local shops if access is
impeded, with customers chosing out-of-town supermarkets with free
parking instead. This is an ongoing battle, and extra fees would be deeply
unpopular and politically difficult.&lt;/p&gt;

&lt;p&gt;Another suggestion was a Norfolk Citizenship Initiative, aimed at
young people, to allow them to contribute to the community at a decent
wage. The idea would be to “make better people”. This sounds
intriguing.&lt;/p&gt;

&lt;p&gt;There was a mention of people in the community getting together
to take advantage of ASDA bulk buying, but I know no more about that.&lt;/p&gt;

&lt;p&gt;There was a mention about Parish Car Club schemes, and tax reduction 
for car-less households.&lt;/p&gt;

&lt;p&gt;Procurement policies should include supplier requirements with regards
to sustainable practises and possible revenue.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Town_and_Country_Planning_Act_1990#Section_106&quot;&gt;Section
106&lt;/a&gt; could be another avenue for sustainable practises.
This prompted one builder in the audience to complain that there is already
so much in regulation and requirements that it just becomes way too expensive
to actually build a house.&lt;/p&gt;

&lt;p&gt;The Carbon Reduction Commitment was mentioned, a scheme that requires CO2
reduction in e.g. schools.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.reephamchallenge.org/&quot;&gt;Reepham Low Carbon Communities
Challenge&lt;/a&gt; looks like an impressive
initiative, with projects right accross the community.
By the way: unusual visual navigation on the front page – interesting idea,
but I think it actually interferes.&lt;/p&gt;

&lt;p&gt;Prof. O’Riordan is publishing a new paper is forthcoming in the next
couple of months; hopefully that will talk about his ideas in more
detail.&lt;/p&gt;

&lt;h2 id=&quot;other&quot;&gt;Other&lt;/h2&gt;

&lt;p&gt;Helene “Master Composter” Rinaldo gave me some leaflets and advice
about composting (I want to put my excess building pallets to good use) and
wormeries.&lt;/p&gt;

&lt;p&gt;Jo Maddock from &lt;a href=&quot;http://www.voluntarynorfolk.org.uk/&quot;&gt;Voluntary
Norfolk&lt;/a&gt; gave me some advice on
grants (specifically &lt;a href=&quot;http://www.awardsforall.org.uk/&quot;&gt;Awards for All&lt;/a&gt;
and &lt;a href=&quot;http://www.norfolkfoundation.com/&quot;&gt;Norfolk Community Foundation&lt;/a&gt; who do
&lt;a href=&quot;http://www.norfolkfoundation.com/grassroots-grants-fund.htm&quot;&gt;Grassroots&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;A lady from the &lt;a href=&quot;http://www.norfolkwildlifetrust.org.uk/&quot;&gt;Norfolk Wildlife
Trust&lt;/a&gt; identified &lt;a href=&quot;http://www.flickr.com/photos/makuk66/5043212497/in/photostream/&quot;&gt;my
salamander&lt;/a&gt;
as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Smooth_Newt&quot;&gt;Smooth Newt&lt;/a&gt; (to be
confirmed).&lt;/p&gt;

&lt;p&gt;Briefly met a fellow Dutchman: Erik Buitenhuis from
&lt;a href=&quot;http://transitionnorwichnews.blogspot.com/&quot;&gt;Transition Norwich&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Discussed some local issues with
Cllr Joe Mooney (Wymondham Town Council)
and Cllr Robert Savage (Norfolk County Council).&lt;/p&gt;

&lt;p&gt;Met John Penell from Bunwell Parish Council.&lt;/p&gt;

&lt;p&gt;Met 
&lt;a href=&quot;http://www.heaser.com/&quot;&gt;John Heaser&lt;/a&gt;
from &lt;a href=&quot;http://www.norfolk-freegle.org.uk/&quot;&gt;Norfolk Freegle&lt;/a&gt;.
&lt;a href=&quot;http://www.iLoveFreegle.org/&quot;&gt;Freegle&lt;/a&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Freegle&quot;&gt;split&lt;/a&gt; from FreeCycle
in recent years.
John is looking for funding to develop the website,
using Microsoft technologies.&lt;/p&gt;

&lt;p&gt;Had an interesting chat with a lady from the stand about emergency
preparedness, business continuity, and community emergency plans.
In particular I think the idea of local door-knocking in remote
areas during severe weather conditions is an interesting idea,
and may be something I’ll look at implementing around my home.
The other thing of note is that “your local scout hall” is sometimes
identified as a temporary community shelter during emergencies,
which is not really something we’ve thought about at all.
See &lt;a href=&quot;http://www.norfolkprepared.gov.uk/&quot;&gt;Norfolk Prepared&lt;/a&gt;,
&lt;a href=&quot;http://www.normit.org/&quot;&gt;NORMIT&lt;/a&gt;
and the &lt;a href=&quot;http://www.south-norfolk.gov.uk/environment/739.asp&quot;&gt;SNC Environmental Emergencies&lt;/a&gt;
page.&lt;/p&gt;

&lt;h2 id=&quot;feedback&quot;&gt;Feedback&lt;/h2&gt;
&lt;p&gt;I think it was an interesting and useful event.&lt;/p&gt;

&lt;p&gt;Location, facilities and staffing was great, and well organised.
There was a good turnout, although I think it remains hard to get
through to the right people who can take initiatives on a local level.&lt;/p&gt;

&lt;p&gt;Suggestions: It was a little unclear that the workshops were repeated
in three slots, and you didn’t know in which order you were planned in
until the day.&lt;/p&gt;

&lt;p&gt;I’d like presentations posted online before the event, to make it
easer to refer back during the workshop, and make it easier to write
up after.&lt;/p&gt;

&lt;p&gt;A twitter hashtag would be good too; but I expect I’m the only one
there who would care.&lt;/p&gt;

&lt;p&gt;Would I come again? Quite possibly, if there wasn’t too much repetition.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/09/29/tweepy</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/09/29/tweepy.html"/>
    <title>Tweepy</title>
    <updated>2010-09-29T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Twitter API for Python:
&lt;a href=&quot;http://github.com/joshthecoder/tweepy&quot;&gt;tweepy&lt;/a&gt;
(&lt;a href=&quot;http://joshthecoder.github.com/tweepy/docs/index.html&quot;&gt;docs&lt;/a&gt;)
supports OAuth.&lt;/p&gt;

&lt;p&gt;I used it for a little command-line twitter client app; worked well.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/09/29/run7k</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/09/29/run7k.html"/>
    <title>7.5km</title>
    <updated>2010-09-29T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Ran a new route:&lt;/p&gt;

&lt;div class=&quot;photo_frame_center&quot;&gt;
&lt;a href=&quot;http://runkeeper.com/user/makuk66/activity/17570644&quot;&gt;&lt;img src=&quot;/img/blog/route-7k.png&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/09/29/cgn5</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/09/29/cgn5.html"/>
    <title>Cambridge Geek Night</title>
    <updated>2010-09-29T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;Visited &lt;a href=&quot;http://cambridgegeeknights.wordpress.com/&quot;&gt;Cambridge Geek Night&lt;/a&gt;
&lt;a href=&quot;http://cambridgegeeknights.wordpress.com/2010/09/22/cgn-5/&quot;&gt;5&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/#search?q=%23cgn5&quot;&gt;#cgn5&lt;/a&gt;)
at The Cambridge Union.
See also on &lt;a href=&quot;http://lanyrd.com/2010/cambridge-geek-nights-5/&quot;&gt;Lanyard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Topics included open data, scaling services, and startups.&lt;/p&gt;

&lt;p&gt;The talks:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.objectgroup.org/&quot;&gt;Lisa Evans&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/objectgroup&quot;&gt;@objectgroup&lt;/a&gt;) from the &lt;a href=&quot;http://www.okfn.org&quot;&gt;Open
Knowledge Foundation&lt;/a&gt; talked about open
government data for &lt;a href=&quot;http://www.wheredoesmymoneygo.org/&quot;&gt;Where Does My Money
Go?&lt;/a&gt;. Nice visualisation of
aggregate and granular data, and war stories of obtaining data from
government and dealing with data compatibility issues.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.yes-no-cancel.co.uk/&quot;&gt;Martin Kleppman&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/martinkl&quot;&gt;@martinkl&lt;/a&gt;) from
&lt;a href=&quot;http://rapportive.com/&quot;&gt;Rapportive&lt;/a&gt;. Rapportive is a value-add for
Gmail, otaining info related to items in your inbox by aggregating
external data from social networks etc. It is implemented as a
plugin which inserts a JavaScript tag, which then loads the
JS logic from Rapportive, which then does the fetching and
DOM manipulation. Rapportive uses Nginx, Ruby, RabbitMQ, Redis, S3,
github, heroku. They will be looking at Hadoop, Solr, Memcached.
They outsource some tech expertise. And they’re moving to San Fransisco.
I asked a question about risks of reliance on gmail’s page structure and 
whether bizdev contract were in place with Google. They address this by
lots of checks so they can partially degrade the functionality,
and aggressive monitoring. So far there have not been any changes that
affected them. The business model is freemium, with premium chargeable
features in the pipeline, though one has to wonder if a Google buyout
is the real target. I’ve heard their UI replaces the ads inside
Gmail; wonder if Google will take action against that.
Popular quote from the talk was “Scaling calcifies: don’t do it too early”
referring to the problem getting locked into a specific scaling
technology too early.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.red-gate.com/&quot;&gt;RedGate&lt;/a&gt; sponsored the bar.
Their intent was to do some hiring, so they spent some time explaining
why their company has a great culture and would be fun to work for.
They handed out some swag, including copies of
&lt;a href=&quot;http://www.red-gate.com/careers/book_of_red_gate.htm&quot;&gt;The Book of Red Gate 2010&lt;/a&gt;
which I liked quite a bit, to my surprise. I couldn’t resist doing
the Clive Code Challenge, where I didn’t do too badly.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Someone mentioned a Clojure Cambridge User Group meeting 
Tuesday 5th October 7pm in The Punter. I’d be interested in the scaling
aspects, but I may just not be Lisp enough.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.ideaspace.cam.ac.uk/&quot;&gt;IdeaSpace&lt;/a&gt; (&lt;a href=&quot;http://twitter.com/#!/ideaspace&quot;&gt;@ideaspace&lt;/a&gt;) is a co-working space and networking community
at West Cambridge Research &amp;amp; Development Park (not far from the
MSRC office). £50/month membership. Friday afternoon they have a 
&lt;a href=&quot;http://www.ideaspace.cam.ac.uk/updates-events/2010/9/camjelly-coworking-event-followed-drinks-friday-30/&quot;&gt;CamJelly&lt;/a&gt;, a public/social/meet thing.
Should check it out if I find myself in the area.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.mixcloud.com/mat/&quot;&gt;Mat Clayton&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/MatClayton&quot;&gt;@MatClayton&lt;/a&gt;)
from &lt;a href=&quot;http://www.mixcloud.com/&quot;&gt;MixCloud&lt;/a&gt; gave a talk about scaling an
audio service: users upload/download DJ-style mixes.
Fascinating and entertaining.
Their main problem was not the scaling user data/access but
problems with bandwidth costs, which at times threatened the company’s
survival. They started off on EC2, moved content
service to 100tb.com, then downgraded bitrates (from sometimes insanely
high), and are now on OVH because they’re cheap. Migrating massive
amounts of data between providiers alone is a challenge.
Various issues around music licensing were discussed. For UK purposes
they’re a radio station, and have appropriate PRS for Music licenses
with track reporting.
Mat works out of Cambridge, near the redgate folks, the rest of the
company is in London. They managed without VC funding –
impressive.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.brunton-spall.co.uk/&quot;&gt;Michael Brunton-Spall&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/#!/bruntonspall&quot;&gt;@bruntonspall&lt;/a&gt;)
who works at The Guardian plugged
&lt;a href=&quot;http://www.scalecamp.org.uk/&quot;&gt;UK Scale Camp&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Met various new people:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Organizer &lt;a href=&quot;http://www.joanslow.com/&quot;&gt;Jo Anslow&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/#!/joanslow&quot;&gt;@joanslow&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.ytko.com/about-ytko/ytko-senior-team/jonathan-whiteland/&quot;&gt;Jonathan Whiteland&lt;/a&gt; from &lt;a href=&quot;http://www.ytko.com/&quot;&gt;YTKO&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://tola.me.uk/&quot;&gt;Ben “tola” Francis&lt;/a&gt; 
&lt;a href=&quot;http://twitter.com/#!/bfrancis&quot;&gt;@bfrancis&lt;/a&gt;
from
&lt;a href=&quot;http://www.rabbitsoft.com/&quot;&gt;rabbitsoft&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://homepage.ntlworld.com/adelie/stephen/&quot;&gt;Stephen Turner&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/#!/sret&quot;&gt;@sret&lt;/a&gt;)
from &lt;a href=&quot;http://www.cytrix.com/&quot;&gt;Cytrix&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Python lover
&lt;a href=&quot;http://www.brunton-spall.co.uk/&quot;&gt;Michael Brunton-Spall&lt;/a&gt; 
(&lt;a href=&quot;http://twitter.com/#!/bruntonspall&quot;&gt;@bruntonspall&lt;/a&gt;)
from &lt;a href=&quot;http://www.guardian.co.uk/profile/michaelbruntonspall&quot;&gt;The Guardian&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Xapian developer Richard Boulton &lt;a href=&quot;http://twitter.com/rboulton&quot;&gt;@rboulton&lt;/a&gt; from
&lt;a href=&quot;http://cnav.co.uk/&quot;&gt;Celestial Navigation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://friendfeed.com/oleg&quot;&gt;Oleg Podsechin&lt;/a&gt;
(&lt;a href=&quot;http://twitter.com/olegpodsechin&quot;&gt;@olegpodsechin&lt;/a&gt;)
from &lt;a href=&quot;http://www.thepocketagency.com/&quot;&gt;The Pocket Agency&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Meta comments: 
Some parallels with the
&lt;a href=&quot;http://www.ukuug.org/events/opentech2010/&quot;&gt;OpenTech 2010&lt;/a&gt;
conference a couple of weeks earlier:
&lt;a href=&quot;http://lanyrd.com/&quot;&gt;Lanyard&lt;/a&gt; is popular,
people ID themselves with their twitter username these days,
and live event twittering via hashtags is common and useful.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/06/17/lighting</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/06/17/lighting.html"/>
    <title>Lighting</title>
    <updated>2010-06-17T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;We’ve been spending quite a bit of time worrying about lighting for
the building alterations we’re doing. It used to be simple, back in
the seventies in the UK: if you wanted light you typically a 100W
incandescent bulb with a Bayonet mount twist/lock fitting, and you
were done. These days (2010) there’s a bewildering array of lighting
technologies, lamp caps, and light colours available, and building
regulations and environmental concerns to go with them. Here I’ll jot
notes about my understanding of these issues and the coices we made.&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;We’re extending a kitchen, enlarging a living/sitting room, adding a
bedroom/bathroom/hallway, reworking a pantry, re-roofing a lean-to
sideshed and adding a back hall. This affects the rear half of the
house, the front rooms and facade remain as-is. New rooms, or rooms
that change use, are subject to different building regulation 
requirements than existing ones.&lt;/p&gt;

&lt;p&gt;The kitchen had 2 recessed PAR38 fittings (initially with incadescent
bulbs, later with CFL), 3 recessed R80 fittings with incandescent,
and 2 triple GU10 Halogen spots. 
The living room had 2 fittings with 6 G9 Halogen capsules.
The bathroom had 7 recessed GU10 Halogen fittings.&lt;/p&gt;

&lt;p&gt;Energy efficiency has been an important aspect of this building work:
We have heavily invested in insulation (6 inch Celotex) and heating
(Air source Heatpump and underfloor heating). Similarly we want to
consider energy use of the lighting.&lt;/p&gt;

&lt;h2 id=&quot;lessons-in-lighting-terminology&quot;&gt;Lessons in lighting terminology&lt;/h2&gt;

&lt;h3 id=&quot;lighting-technology&quot;&gt;Lighting Technology&lt;/h3&gt;

&lt;p&gt;For indoor lighting technology the main choices are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Incandescent_light_bulb&quot;&gt;Incandescent lamps&lt;/a&gt;.
Warm yellowish, flicker-free, instant-on light.
They are not very energy efficient, typically using 100W.
The bulb is round, fairly large, but not too long.
Fittings are typically Bayonet (BC), or screw (ES).
These are being &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-out_of_incandescent_light_bulbs&quot;&gt;“phased out”&lt;/a&gt;
/&lt;a href=&quot;http://www.lightbulbs-direct.com/article/the-light-bulb-ban/&quot;&gt;banned&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Halogen_lamp&quot;&gt;Halogen Lamp&lt;/a&gt;. 
Bright yellowish light, flicker-free, instant-on light.
Bulbs are small G4/G9 capsules, and GU10/MR16 multi-facetted reflectors.
They get very hot, and don’t seem to last long.
Typical 30-50W. These were marketed as “greener” initially, because 50W &amp;lt; 100W,
but they’re not very efficient.
We have quite a few of these:
GU10 spots, 12v MR16s in recessed fittings in the bathroom, and G9 capsules
in decorative lighting fixtures in the living room.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Compact_fluorescent_lamp&quot;&gt;Compact Fluorescent&lt;/a&gt;.
The long fluorescent tubes typically used in commercial or institutional buildings
used to flicker and produces a cold white light. These days Fluorescent lamps are controlled by
high-frequency electronic ballasts, which reduces the flickering, and they are available
in compact sizes, called CFL. The first generation
of CFL’s were painfully slow to warm up and reach full brightness, but the technology has
improved. And crucially, they are now available in all sorts of bulb shapes and sizes, various lighting 
colours, and various fittings. CFLs less energy, typically between 9-18W.
Lifetime up to 20.000 hours. We were using a few of these, mainly in corridors and utility rooms.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/LED_lamp&quot;&gt;LED Lamps&lt;/a&gt;.
The old and small &lt;a href=&quot;http://en.wikipedia.org/wiki/Led&quot;&gt;LED&lt;/a&gt;’s produced insufficient light
for general lighting, but the new high-power LED lamps produce a lot of light, and are
the most energy efficient yet, between 1-3W. The LED lamp light used to be very cold and bright
but these days warmer colours are available. They have also have a long life (50.000 hours)&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;lamp-fittings--caps--bases--socket&quot;&gt;Lamp Fittings / Caps / Bases / Socket&lt;/h3&gt;

&lt;p&gt;See &lt;a href=&quot;http://www.mygreenlighting.co.uk/info/lamp_caps.html&quot;&gt;My Green
Lighting&lt;/a&gt;’s
overview of the most common types, or 
&lt;a href=&quot;http://www.lightbulbs-direct.com/article/fittings-caps-and-bases/&quot;&gt;Lightbulbs Direct’s Fittings overview&lt;/a&gt;
for more.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.donsbulbs.com/&quot;&gt;Dons Bulbs&lt;/a&gt; is also a good resource,
see for example the &lt;a href=&quot;http://www.donsbulbs.com/bulbs/g632/b2/g24q1.gif&quot;&gt;G24d/G24q&lt;/a&gt; datasheet.&lt;/p&gt;

&lt;h3 id=&quot;light-colour&quot;&gt;Light Colour&lt;/h3&gt;

&lt;p&gt;The colour of light is called the Colour Temperature.
See &lt;a href=&quot;http://www.lightbulbs-direct.com/article/colour-temperature/&quot;&gt;Lightbulbs Direct’s Colour Temperature overview&lt;/a&gt;
or
&lt;a href=&quot;http://www.saving-light-bulbs.co.uk/index.php?main_page=page_2&quot;&gt;Saving-light-bulbs&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;luminous-efficacy&quot;&gt;Luminous Efficacy&lt;/h3&gt;

&lt;p&gt;Light output is measured in lumens, and light power use is measured Watts.
The &lt;a href=&quot;http://en.wikipedia.org/wiki/Luminous_efficacy&quot;&gt;Luminous Efficacy&lt;/a&gt; is
lumens-per-Watt, the higher the better.&lt;/p&gt;

&lt;h3 id=&quot;building-regulations&quot;&gt;Building Regulations&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Note: This is my personal interpretation – if you want guaranteed advice consult a paid professional.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the UK, domestic lighting falls under
&lt;a href=&quot;http://www.planningportal.gov.uk/england/professionals/buildingregs/technicalguidance/bcconsfppartl/&quot;&gt;Part L&lt;/a&gt; Building Regulations, in particular 
&lt;a href=&quot;http://www.planningportal.gov.uk/england/professionals/buildingregs/technicalguidance/bcconsfppartl/bcconsfppartlappdoc/bcconsfppartl1aappdoc&quot;&gt;L1A New Dwellings&lt;/a&gt;
and
&lt;a href=&quot;http://www.planningportal.gov.uk/england/professionals/buildingregs/technicalguidance/bcconsfppartl/bcconsfppartlappdoc/bcconsfppartl1bappdoc&quot;&gt;L1B Exiting Dwellings&lt;/a&gt;.
The specifications can be downloaded freely.
The 2006 Edition is current, with a 2010 Edition being valid from 1 Oct 2010.&lt;/p&gt;

&lt;p&gt;Given that our building project involves an existing dwelling, I
believe Part L1A applies, even for the new extensions.&lt;/p&gt;

&lt;p&gt;In L1A (2006), section 43-47 deal with lighting. It demands that
“reaseonable provision should be made for … efficient electric
lighting”. It specifically talks about achieving 40 lumens/watt, and
1/4 light fittings needing to be energy efficient.  Infamously, it
says “A way of showing compliance” would be to have fittings that can
only take energy efficient lamps. This has lead to development of new
fittings, with some building inspectors insisting they get
installed. This has turned out to be counter-productive: there is so
little choice in lumaires and lamps for those restrictive fittings,
that people rip them out as the building inspector’s back is
turned. Furthermore, these days there are so many energy efficient
lamps available for existing fittings, that there is no need special
fittings. But I digress.&lt;/p&gt;

&lt;p&gt;In the 2010 Ed, Part L1A refers to the &lt;a href=&quot;http://live.planningportal.gov.uk/uploads/br/domestic_building_compliance_guide_2010.pdf&quot;&gt;Domestic Building Compliance
Guide
2010&lt;/a&gt;
where it says in Section 12, Page 123, Table 40, that the new values
are 45 lumen/watt and 3/4 light fittings. And interestingly, standard
fittings are now OK, as long as they are supplied with low energy
lamps. Also, light fittings &amp;lt;5W are excluded from the count,
presumably targetting floor level lighting systems and kitchen under-unit
lighting, and to prevent people adding LED light fittings to
articilally increase the overal count. But, this appears to have an
unfortunate consequence: if you’re considering say 20x 3W high output
LED Lamps are your main lighting, then you get no credit for that.
The workaround would probably be to choose a fitting that would take
CFLs, and later switch out the CFLs for the LEDs.&lt;/p&gt;

&lt;p&gt;It also refers to the &lt;a href=&quot;http://www.energysavingtrust.org.uk/&quot;&gt;Energy Savings Trust&lt;/a&gt;,
who have some
&lt;a href=&quot;http://www.energysavingtrust.org.uk/Home-improvements-and-products/Lighting&quot;&gt;generic lighting info&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;led-lamp-experiments&quot;&gt;LED Lamp Experiments&lt;/h2&gt;
&lt;p&gt;&lt;img height=&quot;200&quot; class=&quot;rightimg&quot; src=&quot;/img/blog/9w-mr16-warm-white.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Back in 2008 I read about the new &lt;a href=&quot;http://www.cree.com/&quot;&gt;Cree&lt;/a&gt; LED Lamp on &lt;a href=&quot;http://www.reuk.co.uk/Cree-LED-Spotlights.htm&quot;&gt;RE
UK&lt;/a&gt; and in June 2009 I bought some
from &lt;a href=&quot;http://www.ledlights4you.co.uk/&quot;&gt;ledlights4you&lt;/a&gt; (was
solarwindpowercentre.co.uk, part of
&lt;a href=&quot;http://www.coemiwindturbines.co.uk/index&quot;&gt;Coemi&lt;/a&gt;): 12V, MR16 fittings,
&lt;a href=&quot;http://www.ledlights4you.co.uk/mr16-super-bright-leds/2-1w-mr16-warm-white.html&quot;&gt;1W&lt;/a&gt; (£12),
&lt;a href=&quot;http://www.ledlights4you.co.uk/mr16-super-bright-leds/17-3w-mr16-warm-white.html&quot;&gt;3W&lt;/a&gt; (£17),
and &lt;a href=&quot;http://www.ledlights4you.co.uk/mr16-super-bright-leds/27-9w-mr16-warm-white.html&quot;&gt;9W&lt;/a&gt; (£32),
in warm white and cool white, with a 180W power supply (~£40) to drive them.
My conclusion was:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the 9W produce about as much light as you’d want out of an MR16 size fitting.&lt;/li&gt;
  &lt;li&gt;The smaller wattage lamps may have uses for task lighting.&lt;/li&gt;
  &lt;li&gt;the warm white in a pleasant colour.&lt;/li&gt;
  &lt;li&gt;there doesn’t seem to be a light of light spill, it is very directional,
making it not a great choice for general lighting in a large kitchen,
unless you use lots of them, which then defeats the energy saving purpose.&lt;/li&gt;
  &lt;li&gt;the “three dots” look is a bit strange. My wife disliked that quite a bit.&lt;/li&gt;
  &lt;li&gt;they’re expensive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now in June 2009 we experimented with CFLs. There seem to be a lot
more types on the market than a few years ago, and more light fittings
that support them.&lt;/p&gt;

&lt;h2 id=&quot;kitchen-spots&quot;&gt;Kitchen Spots&lt;/h2&gt;

&lt;p&gt;We started with some spots, for the new extension, where a sloping
roof makes recessed lights less appealing.&lt;/p&gt;

&lt;p&gt;We went to the &lt;a href=&quot;http://www.norwichlightingcentre.co.uk/&quot;&gt;Norwich Lighting
Centre&lt;/a&gt; (website is
content-free), and found a single and double spot we liked: the WOFI
PAZ SC SPOT SINGLE S/W 496301640000 (stock code LE199) and WOFI PAZ SC
SPORT TWIN BAR 7963.0264.0000 (sock code LE200) in Matt Nickel with Alabaster glass.&lt;/p&gt;

&lt;p&gt;These lights are also available online at &lt;a href=&quot;http://www.keslighting.co.uk/&quot;&gt;KES&lt;/a&gt; (&lt;a href=&quot;http://www.keslighting.co.uk/browse/kitchen-lighting/surface-mounted-spotlights/action-paz-energy-saving-nickel-matt-spotlight-496301640000&quot;&gt;single&lt;/a&gt;,
&lt;a href=&quot;http://www.keslighting.co.uk/browse/spotlights/surface-mounted/action-paz-energy-saving-nickel-matt-spotlight-796302640000&quot;&gt;double&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/Action_Paz_Energ_4b69585622602.jpg&quot; width=&quot;200&quot; /&gt;
&lt;img src=&quot;/img/blog/Action_Paz_Energ_4b68531285548_200x200.jpg&quot; width=&quot;200&quot; /&gt;
&lt;img src=&quot;/img/blog//minispiral.jpg&quot; height=&quot;200&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The supplied box suggested it was made by ACTION, or perhaps that’s
the range and it is made by &lt;a href=&quot;http://www.wofi.de/&quot;&gt;WOFI&lt;/a&gt; (warning:
horrible web site with unsollicited audio, and all content hidden in
PDFs and online flash viewers).&lt;/p&gt;

&lt;p&gt;They take 8W mini spiral CFLs with a SES fitting and were supplied
with IMEX 8W/E14 2700K 240V 350 lumen, 8000 hours, which produce
a warm bright light and start fast.&lt;/p&gt;

&lt;p&gt;We’re delighted with both.&lt;/p&gt;

&lt;h2 id=&quot;kitchen-recessed&quot;&gt;Kitchen Recessed&lt;/h2&gt;

&lt;p&gt;Next we had to tackle the recessed lights in the low, beamed ceiling.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;rightimg&quot; width=&quot;150&quot; src=&quot;/img/blog/Shine-gu10-03.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First we evaluated GU10 CFLs (&lt;a href=&quot;http://www.kosnic.eu/kosnic/chanpin/read.asp?chanpinbigclassid=20&amp;amp;chanpinsmallclassid=35&amp;amp;chanpinid=234&quot;&gt;Kosnic
11W&lt;/a&gt;,
warm white).  That started
orange, and took about a minute to come to brightness; not what you
want in a kitchen.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;rightimg&quot; width=&quot;150&quot; src=&quot;/img/blog/JC5081WH.jpg&quot; /&gt;
Next, we found a nice recessed light fitting from 
&lt;a href=&quot;http://www.jcc-lighting.co.uk/&quot;&gt;JCC Lighting&lt;/a&gt;, the JC5081
&lt;a href=&quot;http://www.jcc-lighting.co.uk/products/interior/downlights/compact%2bfluorescent%2bdownlights%2b%2528cfl%2529/coral/jc5081&quot;&gt;Coral Matrix&lt;/a&gt;.
Typical recessed lights of this type are 20-24cm, which would be a problem
with the beams on our ceiling, but this one was small, at 123mm, and shallow.
The construction of the fitting is well done, and the finish is nice.
The ballast is in a separate metal box, which looks messy, but makes fitting quite flexible.
The bulb, listed as “included” on the box, was actually not included.
And we discovered that it uses a very unusal bulb type:
the very short Matrix PL-T2, which appears to be only manufactured by
&lt;a href=&quot;http://www.megaman.cc/&quot;&gt;MEGAMAN&lt;/a&gt; as the T3G24Q218,
which is only available in limited colours, and appears hard to obtain.
All in all not appealing.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;rightimg&quot; src=&quot;/img/blog/atomwhite210x163.gif&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then we tried the &lt;a href=&quot;http://www.asdlighting.com/office-and-commercial/atom/atom-lamp.html&quot;&gt;ASD Lighting Mini Atom
AT1/FSW113E&lt;/a&gt;.
This is a commercial-style recessed fitting with integrated ballast,
at about half the cost of the Coral Matrix.  At 146mm it’s a little
bigger than the Coral Matrix, but still much smaller than the normal
20cm+, and it’s just about 12cm deep.  It comes with a white and
brushed chrome bezel. Construction feels a little plasticky, but the ballast
is internal and it comes pre-wired, so it’s a neat package to install.
It takes a 13W TCT 4pin bulb in its GX24q-1 fitting, and comes supplied with a cool white bulb.
We bought them from
&lt;a href=&quot;http://www.tlc-direct.co.uk/&quot;&gt;TLC Direct&lt;/a&gt;
(order code &lt;a href=&quot;http://www.tlc-direct.co.uk/Products/GLAT113E.html&quot;&gt;GLAT113E&lt;/a&gt;)
who were very helpful and delivered next day.  We’ve been very pleased with
this fitting, and installed it in the kitchen, the pantry, and the back hall.&lt;/p&gt;

&lt;p&gt;We also got 2 with emergency pack from 
&lt;a href=&quot;http://www.buy-electrical.co.uk/contents/en-uk/d198_Recessed_Energy_Saving_Lighting.html&quot;&gt;Tradesman Electrical Distributors&lt;/a&gt;. No stock, special order item with a 10 day lead time.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;rightimg&quot; src=&quot;/img/blog/72077-86RSProduct.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To match in with the spot lights, we will replace the supplied bulbs
with warm white ones: General Electric Biax Long Last T/E 13w GX24q-1 4-Pin Colour: 82 - 13PLT8274PIN -
F13TBX/827/A/4P - DTE132 - 900lumen, 20000h, 2700K from &lt;a href=&quot;http://www.lampco.co.uk/&quot;&gt;The Lamp
Company&lt;/a&gt;, stock code
&lt;a href=&quot;http://www.lampco.co.uk/results.asp?search=PLT134P-82&quot;&gt;PLT134P-82&lt;/a&gt;.
The 830 color version (3000K) also matches well.&lt;/p&gt;

&lt;h2 id=&quot;living-room&quot;&gt;Living Room&lt;/h2&gt;

&lt;p&gt;In the living room, we have re-used the existing decorative G9 halogen
fixture on the ceiling.  In addition, we have added alternative
lighting that will probably mean the ceiling lights will be little
used.&lt;/p&gt;

&lt;p&gt;We added torch-shaped alabaster glass wall lights, from the Norwich
Lighting Centre, GLOBO TORCH WALL UP-LT SW SC 44100-1, order code
WB532.  Made by &lt;a href=&quot;http://www.globo-lighting.com/&quot;&gt;Globo-Lighting&lt;/a&gt;
(another content-free website).  It came with a 40W halogen in a E14
fitting.  We replaced with a CFL (LiLUCO 08979 E14 / 9W / 3.000K.),
which takes a little while to reach full brightness, which is OK in a
living room. This model is a little wider and shorter than the mini
spirals we use in the kitchen, to stop them protruding above the
glass. These lights can be individually turned on/off.&lt;/p&gt;

&lt;p&gt;We added some (separately switched) spotlights (the same type as in
the kitchen), and one halogen picture light, which unfortunately will
only take a 40W halogen.&lt;/p&gt;

&lt;p&gt;With the wall and spot lights on, that adds up to (5&lt;em&gt;9) + (4&lt;/em&gt;9) + 40 =
121W, compared to 2&lt;em&gt;(6&lt;/em&gt;40)=480W before. Let’s hope that the practice
works out like that.&lt;/p&gt;

&lt;h2 id=&quot;bedroom&quot;&gt;Bedroom&lt;/h2&gt;

&lt;p&gt;Paulman Colmar 150
4x35W, 12V Halogen, 150 VA transfo
971.82
 http://www.paulmann.com
UK reseller http://www.lightsourceeurope.com/
colmar
01905 24152
jessica jones lighting&lt;/p&gt;

&lt;p&gt;5x20   colmar 105   £145
4x35   colmar 145   £145
10m run
—&lt;/p&gt;

&lt;p&gt;105 5x20 would have been ok&lt;/p&gt;

&lt;h2 id=&quot;upstairs-hall&quot;&gt;Upstairs Hall&lt;/h2&gt;

&lt;p&gt;http://www.screwfix.com/app/sfd/cat/products.jsp?id=95841&amp;amp;ts=48396
Recessed Maintained Emergency Bulkhead 8W&lt;/p&gt;

&lt;p&gt;2xEnergy Saving Small flush fitting finished in nickel matt with opal glass diffuser
http://www.thelightingsuperstore.co.uk/product.asp?productid=39168
wofi 9311.02.64.0340
suzuka
2xe14/11w&lt;/p&gt;

&lt;h2 id=&quot;bathroom&quot;&gt;Bathroom&lt;/h2&gt;

&lt;p&gt;thelightingsuperstore
http://www.thelightingsuperstore.co.uk/product.asp?productid=30536
Product Code = TP2114 LISBON BATHROOM SPOTLIGHT
Description = IP44 Rated low energy modern style bathroom spotlight with 4 adjustable spots, finished in chrome with a frosted and clear glass shades.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/04/21/funny-sites</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/04/21/funny-sites.html"/>
    <title>Funny Sites</title>
    <updated>2010-04-21T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;These are funny &lt;em&gt;and&lt;/em&gt; useful. Well, ish.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://lmgtfy.com/&quot;&gt;LMGTFY&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.moanmyip.com/&quot;&gt;Moan my IP&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dopeoplesuck.com/&quot;&gt;Do people suck&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/04/17/first-upstream-github-merge</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/04/17/first-upstream-github-merge.html"/>
    <title>First upstream GitHub merge</title>
    <updated>2010-04-17T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;I’ve used &lt;a href=&quot;http://mercurial.selenic.com/&quot;&gt;Mercurial&lt;/a&gt; more than
&lt;a href=&quot;http://git-scm.com/&quot;&gt;Git&lt;/a&gt;, but &lt;a href=&quot;http://www.github.com/&quot;&gt;GitHub&lt;/a&gt; looks
so nice and polished that I wanted to see it in action.&lt;/p&gt;

&lt;p&gt;So by way of experiment I forked
&lt;a href=&quot;http://github.com/stevedekorte/io&quot;&gt;Io&lt;/a&gt;, and fixed up some
documentation typos. Today these were merged back:
&lt;a href=&quot;http://github.com/stevedekorte/io/commit/1882b78999bc544d17973526f28e3656a7227fcb&quot;&gt;1882b78&lt;/a&gt;.
How exciting. I love the network graph:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/github-io-network-graph.png&quot; width=&quot;605&quot; height=&quot;319&quot; /&gt;&lt;/p&gt;

&lt;p&gt;which is &lt;a href=&quot;http://github.com/blog/39-say-hello-to-the-network-graph-visualizer&quot;&gt;explained here&lt;/a&gt;
and is &lt;a href=&quot;http://github.com/blog/621-bye-bye-flash-network-graph-is-now-canvas&quot;&gt;html5 canvas goodness&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Later I was able to push a
&lt;a href=&quot;http://github.com/makuk66/io/commit/0faf1794e3ebd247c26838868cb4aca85c96fd42&quot;&gt;fix&lt;/a&gt;
to a &lt;a href=&quot;http://tech.groups.yahoo.com/group/iolanguage/message/12223&quot;&gt;mailing list
issue&lt;/a&gt;,
providing a convenient diff.&lt;/p&gt;

&lt;p&gt;Likes so far: Ah, the freedom of DVCS and open source: not having to
ask permission to fork. Checkin early, checkin often. Cloning trees
locally. The three-way “pull upstream, push origin” model. Pretty diff
viewer built-in. And Github does make it easy.&lt;/p&gt;

&lt;p&gt;Dislikes: Git’s complexity will take some getting used to.  The GitHub
Issues lists look a little too simple; I wonder if it is sufficient in
practice.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://www.greenhills.co.uk/2010/04/16/vim-cursor-on-last-line</id>
    <link type="text/html" rel="alternate" href="http://www.greenhills.co.uk/2010/04/16/vim-cursor-on-last-line.html"/>
    <title>vim cursor on last line</title>
    <updated>2010-04-16T00:00:00+00:00</updated>
    <author>
      <name>Martijn Koster</name>
      <uri>http://www.greenhills.co.uk/</uri>
    </author>
    <content type="html">&lt;p&gt;This is useful:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;vim + filename
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;makes vim start with the cursor on the last line.
Ideal for a blog posting script…&lt;/p&gt;
</content>
  </entry>
  
 
</feed>
