I've been quite vocal in the local meetups (the local Linux User's Group and the local hackerspace) about how awesome FreeBSD is. A number of people have asked me to write a blog post about the setup of my development environment. I'm able to spin up new instances of FreeBSD in less than one second, based on ZFS and jails. Now that I have nightly builds of FreeBSD 11-CURRENT and my own pkgng repo, setting up new systems (or jails) is a breeze.

On my development server, I run 11-CURRENT with these packages. Installing with pkgng is extremely easy. Every night, I have a cron job that runs every night that updates the src tree, builds a new release, and generates updated packages. I don't install any of the updates. I do that upon manual inspection of what was updated, any failures, etc.

I use my jail administration project to manage my jails. With each of my jails, I emulate ZFS boot environments (BEs). Emulating BEs allows me to run updates in the jail with the ability to switch back to a previous BE if an update fails. I have a ZFS dataset that gets nullfs mounted in all of my jails so that I can share data between all of them (think of it like VMWare/VirtualBox shared folders). Each of my jails is configured with IPv6 so that I get a static IP, no matter what (I don't control the underlying network and each of the jail's network devices (epair devices) get assigned random MAC addresses, so DHCP always gives a new IPv4 address).

Since my system uses ipfw, I can also use dummynet in conjunction with my jails. Using dummynet allows me to emulate networks of varying speeds, packet loss, etc. I've been working a lot on Freshclam, the component of ClamAV that keeps ClamAV's databases up-to-date. In order to make sure that my changes work okay in various situations, I've used dummynet to test how Freshclam would react to networks with high latencies and high packet loss.

FreeBSD's rc system doesn't play well with vnet jails, so I created a simple Drush module and rc script that calls into Drush. Using my jail administration project, I've marked certain jails to automatically start up whenever my dev box boots up.

If I need a new jail, then I can either build a new one from scratch or I can clone an existing jail. Cloning an existing jail will also copy all the settings (but not copy certain settings like IP addresses, since having two jails with the same IP address just doesn't make sense). Performing a clone literally takes less than one second. I'd like to see Amazon's AWS/EC2 do that.

There's a lot to do to make my environment better. My Drupal module requires you to give passwordless sudo access to the www user for certain commands. Obviously, that's not ideal. As part of my VirtBSD project, I'm redesigning this portion to rely on a client/server paradigm. I'm also looking into integrating with Bhyve. I'm toying with the Go language and I'm nearly convinced that Go is what I'll be using to redesign my jail administration project.

 So, in short, using ZFS, vnet, jails, and my jail administration Drupal module makes for a very efficient development environment setup. There's more that I can do to make it more efficient. I'm excited to see what's around the corner.