May 31, 2018

Building a Server

There are a whole load of moving parts in the system I want to build. For the most part, I know what they need to do at a high level, but there’s still a load of exploratory code I’m going to need to write to understand the nitty gritty. In this post I’ll sketch out the various parts of the system, and start to break it down so that I can usefully spike each area before tying everything together. Read more

May 5, 2018

Towards a Better NBD Server

Towards a Better NBD Server I’ve had an idea floating around in the back of my mind since working on flexnbd that there ought to be a better way to do block storage. This is, admittedly, a fairly niche interest. FlexNBD is an NBD server which allows you to live-migrate the storage to a new instance on a different machine. In a VM hosting environment, this is extremely handy: if you know your storage back-end is flakey, you can evacuate before you actually lose any data. Read more

February 20, 2015

You've Got to Trust Your Vm Host

Or: Why Disc Encryption Won’t Save You There’s a persistent meme floating around that full-disc encryption of your VM’s discs will save you if some three-letter agency comes knocking on the door of your VM host and demands your data. This is futile. Let me explain why. Your Host Has Your Keys Let me make this as clear as I possibly can: when your VM is running, after you have unlocked the disc encryption, the only key I need to decrypt your encrypted partition is present in the RAM of your guest. Read more

August 26, 2013

How I Ruby, Part 2a: Deployment (Ruby)

In this post I’m going to show you how use ruby-install to build a Debian package of MRI itself, and put together a trivial apt repository so you can serve it on your local network. Why do this? First, you aren’t dependent on ftp.ruby-lang.org being available when you want to deploy. Second, that you don’t waste time during your deployment rebuilding a ruby binary. I’ve seen builds of ruby 2. Read more

August 19, 2013

Bootable, mountable VM images

The Problem There’s a classic pain point that anyone building disc images for virtual machines comes across. It’s easy to make a filesystem image in a file, and you can work with it easily by mounting it as a loopback filesystem. But to get KVM to boot it you’ve got to copy the kernel and initrd out, because GRUB can’t make a filesystem image bootable. If you want a totally self-contained bootable image, you’ve got to mess with kpartx and losetup to make a disc image that includes partition information, just to keep the bootloader happy, and working with that is a pain because it doesn’t loopback mount. Read more

August 18, 2013

in-chroot script

This is one of those “use it so much I forget it’s there” scripts. I do a fair amount of system image and package building work. Both of these inevitably involve using chroot, and I can never remember the precise combination of remounts and copies you have to do to make the chroot work “properly”. Here’s the script I wrote to take care of it for me. It will sudo at the right points, and simply execs its arguments in the chroot (defaulting to /bin/bash if you don’t pass it anything). Read more

August 13, 2013

How I Ruby, Part 1: Development

In this article I’ll describe the toolset I use to do ruby development. It’s not complicated. It is pleasingly robust. I’ve hacked together a couple of simple tools to make it easier. I do all my development (in fact, all my everything) on Debian stable (currently Wheezy), but everything here should apply equally to Ubuntu and, with a following wind, OS X. ruby-install I install rubies with ruby-install from here. Read more

April 29, 2012

A Go-lang Lisp

Back in 2010, Nurullah Akkaya published his implementation of John McCarthy’s “Micro-manual for Lisp” paper. I thought it might be interesting to port this implementation into Go as a learning exercise. This is my first non-hello-world Go program, so inevitably there’ll be a fair bit of non-idiomatic code here. Bear with me; I’ll update it at some point in the future when I’ve got more Go under my belt. Read more

January 8, 2012

Rescuing Exception

Over the past few months, I’ve been thinking about when it might be correct to say rescue Exception instead of rescue StandardError, or a more specific exception class. This line of thought was first triggered by a particularly hairy debug session which was made extremely difficult because, unbeknownst to me, some library code did a rescue Exception at the top-level of a Thread, where I was expecting Thread.abort_on_exception to explicitly break and tell me what was happening. Read more

December 10, 2011

Neat Emacs Trick #1

Avdi Grimm has a post on using a shortcut ec script for emacsclient here. I used something like that for a few months, but got quickly frustrated with one peculiar quirk of my development setup. I do the vast majority of my development in ruby, in a terminal window, and almost all of it is TDD using minitest/unit. Now, when I get a test failure, it looks something like this: Read more