The Shining Path of Least Resistance


Author Archive

Building Chef on the BeagleBone Black

Posted by mattray on October 20, 2016

chef-logoI wanted to get Chef running on my BeagleBone Black running Debian, using the full-stack Omnibus builder they use for their packages. While ARM is not a supported platform, the open source community had already done a lot of work getting it ready. The first step was to get the build toolchain in place, so I followed the instructions from I had to make 1 small fix (already merged), but here’s how I got omnibus-toolchain installed:

sudo apt-get install autoconf binutils-doc bison build-essential flex gettext ncurses-dev libssl-dev libreadline-dev zlib1g-dev git libffi6 libffi-dev ruby ruby-dev
sudo gem install bundler
git clone
cd omnibus-toolchain
sudo bundle install --without development
sudo bundle exec omnibus build omnibus-toolchain
sudo FORCE_UNSAFE_CONFIGURE=1 bundle exec omnibus build omnibus-toolchain

Note the FORCE_UNSAFE_CONFIGURE=1, there was a bug in gtar that I didn’t debug.

Luckily Carl Perry already had an ARMHF Chef 12.8.1 build available for bootstrapping.

After installing the package locallly

dpkg -i /tmp/chef_12.8.1%2B20160319051316-1_armhf.deb

I did a chef-client run remotely

$ knife bootstrap -x debian --sudo -N beaglebone
Creating new client for beaglebone
Creating new node for beaglebone
Connecting to -----> Existing Chef installation detected Starting the first Chef Client run... Starting Chef Client, version 12.8.1 resolving cookbooks for run list: [] Synchronizing Cookbooks: Installing Cookbook Gems: Compiling Cookbooks... [2016-10-13T07:53:21+11:00] WARN: Node beaglebone has an empty run list. Converging 0 resources Running handlers: Running handlers complete Chef Client finished, 0/0 resources updated in 14 seconds

The next step was to get the omnibus cookbook in place to use my machine as a builder. After sorting through the dependencies and getting it uploaded, I had to make 1 small change to disable grabbing the omnibus-toolchain because I had already built it locally. Once that was in place, it was a matter of sudoing to the omnibus user, downloading the Chef source and running

cd chef/omnibus
bundle install --without development
bundle exec omnibus build chef -l debug

And approximately 3 hours later I had a new chef_12.15.27+20161013214455-1_armhf.deb which worked great once installed.

root@beaglebone:/home/omnibus/chef-12.15.27/omnibus/pkg# dpkg -i chef_12.15.27+20161013214455-1_armhf.deb
Selecting previously unselected package chef.
(Reading database ... 82288 files and directories currently installed.)
Preparing to unpack chef_12.15.27+20161013214455-1_armhf.deb ...
Unpacking chef (12.15.27+20161013214455-1) ...
Setting up chef (12.15.27+20161013214455-1) ...
Thank you for installing Chef!

I’ll continue to refine the build process and follow along with new releases of Chef. Now I can move on to the next more important piece, which is actually using the box. Feel free to download it: chef_12.15.27+20161013214455-1_armhf.deb

Posted in chef, linux | Tagged: , , , | Leave a Comment »

Installing Debian 8.6 on a BeagleBone Black

Posted by mattray on October 14, 2016

1996-01I’ve finally had practical reason to get the BeagleBone Black out of the drawer and start using it as an home server (more later). It’s a nice, quiet little machine with 512 megs of RAM and a 1ghz ARM CPU. I followed the instructions from to connect to it via the serial port over USB, which allowed me to connect to the web server on the included OS. Turns out I didn’t really need to do this, all I needed to do was flash my microSD card and install Debian on it.

For more in-depth Linux notes, I referred to

I downloaded the latest Debian stable “Jessie” build for ARMHF from here. That image turned out to be a bit bloated with X and desktop tools, so I switched to the “IOT” image. I flashed the image onto a 32 gig microSD card with Etcher for OSX, which was quite painless.

Debian on the BeagleBone Black

Next I popped the microSD card into the BeagleBone and rebooted into Debian. I was able to connect to the serial console over USB with instructions from here. For my instance, the command was

screen /dev/tty.usbmodem1413

I changed the debian user password away from the default and plugged in a network cable.
Once it was on the network I could SSH to it, I probably didn’t need to use the serial console at all if I’d just looked for the IP address off the router.

I copied over my SSH key so I wouldn’t need to use my password when logging in.

scp ~/.ssh/ debian@

Next I did an apt-get update; apt-get upgrade to get the latest bits and then shut it down.

I plugged directly into the router and powered via the USB port, since it’s meant to be an externally-accessible bastion box.

Final touches

I also needed to make sure we used the whole microSD, so I followed these instructions:

cd /opt/scripts/tools/
git pull
sudo ./
sudo reboot

I checked the list of timezones and set mine to Sydney.

timedatectl list-timezones
sudo timedatectl set-timezone Australia/Sydney

and finally

apt-get install emacs-nox

Now it was ready to use.

Posted in geekery, linux, Uncategorized | Tagged: , | 1 Comment »

Automatic Wi-Fi Switching Based on Running Applications in OSX

Posted by mattray on August 11, 2015

I’ve been a longterm user and big fan of the program ControlPlane, which uses information from the environment around you (attached devices, location, networks, etc.) to change configurations in response. In my own usage, I change Time Machine backup drives based on which networks I’m on and use it to automatically start a handful of applications when I get to work (Emacs, Slack, etc.).


At my current office I have a pretty poor Internet setup because we’re subleasing and don’t have a permanent connection. I’m using a Clear Wireless modem that gets about 10/1Mb/s down/up which is usually fine except for the fact that I’m now sharing the bandwidth with coworkers and Sprint is actively taking down the WIMAX network as they phase out this service. Luckily one of my coworkers has a MIFI puck that does a speedy 20/4Mb/s, but it’s not an unlimited data plan like the Clear modem.

The Problem

I do a lot of video conferencing and our current tool of choice is Zoom. Compared to the other tools we’ve used over the years, it’s really great but with the strain on our network I’ve been having a lot of pauses and stutters on the slower network.

The Solution

Unfortunately there’s not a built-in “Wi-Fi Network” option in ControlPlane, only Network Locations. Network Locations under the Network preference pane don’t allow you to have a single Wi-Fi network choice, so I looked elsewhere. It turns out you can change networks from the CLI, the actual command you use (originally found here) is:

networksetup -setairportnetwork en0 WIFI_SSID_I_WANT_TO_JOIN WIFI_PASSWORD

With that bit of knowledge I created a pair of shell scripts to switch between the two Wi-Fi options.

  • In the ControlPlane Preferences I added a new “Zoom” choice under Contexts.
  • Next I added “Running Application” as an Evidence Source.
  • Next I started up Zoom and under Rules selected “Add ‘Running Application Rule'” and choose “ (us.zoom.xos)” with the Context of “Zoom”.
  • Finally under Actions I added a pair of ShellScripts to be executed immediately when entering the “Office” and “Zoom” contexts when triggered.

The Result
The Internet is still pretty poor in my office, but now when I start up Zoom there’s a brief hiccup as the Wi-Fi switches over to the faster wireless provider. When I shut down Zoom I automatically switch back to the slower, unlimited bandwidth Clear network. Hopefully we’ll be getting a new office soon with a dedicated Internet connection with a lot more bandwidth, but this is a decent work-around in the meantime.

Posted in Uncategorized | Leave a Comment »

ZoneMinder Chef Cookbook

Posted by mattray on February 20, 2014

D-Link 930L

D-Link 930L

A recent rash of burglaries in my neighborhood encouraged me to set up a security camera for my front door. I’d recently heard the FLOSS Weekly episode for ZoneMinder, so I figured I would check it out. The wiki listed the D-Link 930L as an working option, and it was about $40 on Amazon. It is wifi-connected and does 640×480 video, so it’s a pretty good basic solution. I plugged it in, set it up and everything “just worked”. Rather than subscribe to D-Link’s cloud service, I configured ZoneMinder to record video when motion was detected. The Android app actually lets me see the video live from anywhere and I’ve hooked it up to my Roku as well.

I published a Chef cookbook for installing and configuring ZoneMinder, following the configuration guide. The monitor configuration is stored in the database and I didn’t feel like spending the time to set that up, so the cookbook is pretty basic since additional configuration was done in the web UI. The code for the cookbook is at

Here are screenshots of the configuration screens:

Monitor: General Settings

Monitor: General Settings

Monitor: Source

Monitor: Source

ZoneMinder: Options

ZoneMinder: Options

Posted in chef, geekery, monitoring | Tagged: , , , | 3 Comments »

Treadmill Desk

Posted by mattray on January 30, 2014

Treadmill Desk
A little over a year ago I decided to build a treadmill desk based on the design at I’d been having back issues (since resolved surgically) and figured the additional exercise would be good for that and better health in general. I followed‘s setup almost verbatim, the same model of treadmill ($250 on Amazon) and silencing the alarm. The default setting of 1 mile per hour is perfect for a walking desk and the timer conveniently runs for 30 minutes. I already had the IKEA bookshelves and purchased the tabletop with legs for less than $50 total. I wall mounted my monitor and have another on my desk next to the treadmill desk. I switch video cables to my laptop and physically move my keyboard and trackball when I move between desks.

Walking on the treadmill while working is not as distracting as you might expect, I have enough focus for reading and responding to email, browsing the web or talking on the phone. I typically start my day with a half hour on the treadmill doing email and catching up on the latest news, occasionally I eat lunch while walking. If I’m on a conference or phone call the chances are very good I am on my treadmill. My decidedly low-tech approach to tracking time and distance are tick-marks on a post-it note (each half an hour at 1 mph). I typically average at least an hour a day, despite travel and a few weeks of recovery for back surgery I walked 199.5 miles in 2013.


The treadmill is quiet and the maintenance is simple. Luckily I have a private office with plenty of space, so I don’t annoy my coworkers except while video conferencing. If your working arrangement is amenable to it, I highly recommend a treadmill desk.

UPDATE: Only 85.5 miles in 2014, a bit more travel and feeling better lead to less mileage. Gonna shoot for more in 2015.

UPDATE 2: Only 44.5 miles in 2015, too much travel but still feeling good. 2016 probably will be about the same.

UPDATE 3: Only 26 miles in 2016, that’s because I packed up the treadmill and moved to Australia mid-year.

Posted in geekery, health | Tagged: , , | 3 Comments »

Labyrinthitis, or How I Completely Wasted the Last Week of my Life

Posted by mattray on July 25, 2013

Last week I had this misfortune of falling ill with Labyrinithitis, expressed as acute vertigo. If you’ve never had vertigo, consider yourself lucky. It’s the dizzy motion sickness you get after too much spinning around, or possibly if you’ve had too much to drink and you’re trying to fall asleep. You can’t stand still or walk straight and the room spins even as you lie perfectly still, for hours on end. In my case it lasted nearly 5 days. You can’t read, you can’t watch TV, you mostly lie perfectly still for hours on end because you can’t walk without falling over. I listened to podcasts and slept, it was painfully boring.

If you find yourself with vertigo for more than a day, get yourself to a doctor ASAP. I fell ill Sunday afternoon and didn’t go until Wednesday afternoon. I’m not exactly sure what triggered it, most likely a low grade sinus infection. A dose of steroids and antibiotics and by Friday I was slowly catching up on work. By Monday I had no lingering effects.

While it really, really sucked and was one of my least enjoyable weeks of my life, I have to thank my wife for taking care of me. The words of encouragement from friends and family really helped, thanks everyone.

Posted in health | Tagged: , | Leave a Comment »

Spiceweasel 2.0

Posted by mattray on January 14, 2013

One year after the release of Spiceweasel 1.0, Spiceweasel 2.0 is now available! For those of you unfamiliar with Spiceweasel, it is a command-line tool that helps manage loading Chef infrastructure from a manifest file. The JSON or YAML manifest is a simplified representation of the Chef repository contents that you may use to recreate and share how to build the application or infrastructure. This file is validated to ensure that all the components listed are present and the correct versions are available, and can (and should) be managed in version control with the rest of your repository.

There are minor updates to the manifest syntax in 2.0, with a focus on clarity. Spiceweasel has 3 major new features since the 1.0 release :

Spiceweasel now has the ability to directly execute the knife commands, creating (or deleting or rebuilding) the infrastructure described in the manifest when you use the -e/--execute flag.

Rather than write your manifest from scratch, Spiceweasel may generate the knife commands or manifests for you. Running spiceweasel --extractlocal generates the knife commands required to upload all the existing cookbooks, roles, environments and data bags found in your Chef repository with validation. spiceweasel --extractjson or spiceweasel --extractyaml will generate the JSON or YAML manifest for your Chef repository, which may be captured and then tracked in version control.

Clusters are not a type supported by Chef, this is a logical construct added by Spiceweasel to enable managing sets of infrastructure together. The clusters section is a special case of nodes, where each member of the named cluster in the manifest will be tagged to ensure that the entire cluster may be created in sync (refresh and delete coming soon). The node syntax is the same as that under nodes, the only addition is the cluster name.

- mycloud:
  - openstack 1:
      run_list: role[db]
      options: -S mray -i ~/.ssh/local.pem -Ia0b27dd9-e008-4a13-8cda-a2c74a28b7b1 -f 3
  - openstack 2:
      run_list: role[web] recipe[mysql::client]
      options: -S mray -i ~/.ssh/local.pem -Ia0b27dd9-e008-4a13-8cda-a2c74a28b7b1 -f 2
- amazon:
  - ec2 1:
      run_list: role[db]
      options: -S mray -i ~/.ssh/mray.pem -x ubuntu -I ami-8af0f326 -f m1.medium
  - ec2 2:
      run_list: role[web] recipe[mysql::client]
      options: -S mray -i ~/.ssh/mray.pem -x ubuntu -I ami-7000f019 -f m1.small

This would generate the following knife commands:
knife openstack server create -S mray -i ~/.ssh/local.pem -Ia0b27dd9-e008-4a13-8cda-a2c74a28b7b1 -f 3 -j '{"tags":["mycloud+roledb"]}' -r 'role[db]'
knife openstack server create -S mray -i ~/.ssh/local.pem -Ia0b27dd9-e008-4a13-8cda-a2c74a28b7b1 -f 2 -j '{"tags":["mycloud+rolewebrecipemysqlclient"]}' -r 'role[web],recipe[mysql::client]'
knife openstack server create -S mray -i ~/.ssh/local.pem -Ia0b27dd9-e008-4a13-8cda-a2c74a28b7b1 -f 2 -j '{"tags":["mycloud+rolewebrecipemysqlclient"]}' -r 'role[web],recipe[mysql::client]'
knife ec2 server create -S mray -i ~/.ssh/mray.pem -x ubuntu -I ami-8af0f326 -f m1.medium -j '{"tags":["amazon+roledb"]}' -r 'role[db]'
knife ec2 server create -S mray -i ~/.ssh/mray.pem -x ubuntu -I ami-7000f019 -f m1.small -j '{"tags":["amazon+rolewebrecipemysqlclient"]}' -r 'role[web],recipe[mysql::client]'
knife ec2 server create -S mray -i ~/.ssh/mray.pem -x ubuntu -I ami-7000f019 -f m1.small -j '{"tags":["amazon+rolewebrecipemysqlclient"]}' -r 'role[web],recipe[mysql::client]'

What’s important to note here is the use of tags to identify them, we’ll be coming back to this in future releases.

As always the code is available at with a detailed changelog. The code has been heavily refactored into discrete libraries and the next few releases should add additional cluster features and integration with Berkshelf and Librarian.

Feature suggestions and patches are always welcome, thanks for using Spiceweasel!

Posted in chef, opschef, spiceweasel | Tagged: , , , | 6 Comments »

Chef for OpenStack Status 11/2

Posted by mattray on November 2, 2012

Getting back into the swing of semi-regular updates. Last week was the Chef Developer Summit, lots of great conversations and quite a few people interested in OpenStack. This week was catching up mostly, trying to clean up a few Essex leftovers before moving to Folsom.

  • I bumped to Essex versions to 2012.1.0 to sync to the OpenStack versioning per feedback at the OpenStack Summit. I tagged everything for Essex and merged to master.
  • Added an ‘lxc’ role to enable using LXC. Just an attribute and it just worked, so awesome.
  • Added placeholder cookbooks for quantum, cinder and ceilometer. These have the suffix “-cookbook” in my GitHub, there was some discussion about wanting to rename the cookbook repos for the other 5 projects, anyone feel strongly?
  • Updated all the Community cookbook dependencies and retested (apt, erlang, database, ntp, apache2, database, mysql, rabbitmq, openssh)
  • Released a new version of pxe_dust which enforces assigning the PXE-booted NIC as eth0.
  • Trying to coordinate Chef support for the bare-metal provisioning tool Razor, ping me if you’re interested.
  • Canceled the NYC Chef for OpenStack Hack Day and NYC Chef Meetup.
  • Preparing for the Opscode/DreamHost webinar “Automating OpenStack and Ceph at DreamHost with Private Chef“.

Next week I’ll be in Chicago presenting at the CME Group Technology Conference, ping me if you’re in Chicago and want to catch up. My OpenStack goals are to merge in the outstanding pull requests and resync with the latest Folsom work from rcbops, hopefully merging in some more branches.

Posted in chef, community, openstack, opschef | Tagged: , , | Leave a Comment »

Gettings Started with the Chef for OpenStack docs

Posted by mattray on October 23, 2012

I have primarily been focused on documentation lately and the is the repository. Since there is so much interaction between the various components, prerequisites and cookbooks, I felt a unified document format would best serve our needs. The various markdown readmes and documentation is slowly migrating to this single repository so it can be kept updated in a single location and link to the various components.

The docs are in Restructured Text and use Sphinx, which is compatible with the source docs. The license matches the OpenStack documentation’s Apache V2 and Creative Commons Attribution ShareAlike 3.0 License. Opscode has standardized on this format for our own documentation and in the near future it will be merged upstream with official Opscode documentation.

The evolving document is currently broken into these 6 components:
* Architecture – overview of the architecture for Chef for OpenStack.
* Prerequisites – the hardware, network and operating system requirements.
* Installation – how to install Chef for Openstack.
* Example Deployment – example configuration of a small test lab.
* Knife-OpenStack – using the OpenStack plugin for Knife for provisioning and managing instances.
* Additional Resources – additional useful information and links related to Chef for OpenStack.

The docs are just getting started, lots of placeholders but I’m active writing. Please feel free to send corrections and additional details to help fill things out. There will be a permanent URL for the docs online soon, here is a temporary link:

Posted in chef, community, openstack, opschef | Tagged: , , , | Leave a Comment »

Chef for OpenStack Status 10/22

Posted by mattray on October 23, 2012

I’ve decided to start cross-posting my status emails for the Chef for OpenStack project to help spread the word. The Chef for OpenStack mailing list is here, please join:

I apologize for the lack of updates, but I come bearing lots of news. For a quick summary of the state of Chef for OpenStack, check out this deck from my presentation at the OpenStack Summit:

Speaking of the OpenStack Summit, it was quite productive despite not getting to attend enough sessions due to meetings and booth duty. Monday there was a session on “Upstreaming Chef Cookbooks”, which was essentially a meetup of folks working on Chef for OpenStack. We compared notes and there is quite a lot of work being done in the various branches maintained outside the Opscode one, I’m looking forward to merging as much of the work as possible. Tuesday I gave my general Chef for OpenStack presentation linked above and we had a “DevOps Panel” later that day where there was an engaging discussion on the various issues facing deployers of OpenStack. I’ll link up videos as they become available.

Some short-term takeaways from the Summit where that there is a tremendous amount of development effort I was unaware of and the pace is about to pick up substantially. DreamHost and AT&T have a number of patches to be merged and work has already started on Folsom by several folks. The general consensus was to move the focus to Folsom now that it’s out, the cookbooks have been tagged and the repos have all been merged back to master. The ‘essex’ branches are working and have been pushed to the Community site for direct download and are still available of course if you want to continue development.

There were so many great discussions and ideas shared, I’m really looking forward to the work ahead. I’ll try to post more frequently, so the level of engagement will continue to get better.

Posted in chef, community, openstack, opschef, opscode | Tagged: , , | Leave a Comment »