BoxGrinder Chef

BoxGrinder is a JBoss Community project to build appliances based on Fedora, Red Hat and/or CentOS. It appears to build on an earlier project called ThinCrust.  It takes a simple BoxGrinder appliance configuration (‘.appl’) file and uses it to generate a Red Hat kickstart file, which it then uses to build a KVM VM. Additional plugins can then convert the VM to other formats like Amazon EC2 AMI.  BoxGrinder itself is supported on Fedora only, though it can create CentOS 5 appliances.  As of writing a critical bug stops BoxGrinder from building CentOS 6.x images.

The best way to build appliances for Amazon EC2 is to use the provided BoxGrinder meta-appliance AMI to create an EC2 instance:  BoxGrinder meta works best with at least 2G RAM to build i386 appliances.

I created a basic appliance with the Chef client preinstalled by using an appliance definition file as follows:

name: CentOS-chef
summary: "CentOS RBEL Chef"
version: 1
release: 1
hardware:
  partitions:
    "/":
      size: 4
os:
  name: centos
  version: 5
packages:
  - ruby-devel
  - rubygem-chef
repos:
  - name: "rbel5"
    baseurl: "http://rbel.frameos.org/stable/el5/#BASE_ARCH#/"
    ephemeral: true
  - name: "epel"
    baseurl: "http://download.fedoraproject.org/pub/epel/#OS_VERSION#/#BASE_ARCH#/"

Having gems pre-converted to RPMs is better than trying to use gem install during build post-processing.

Configuring the EC2 plugin is done in ~/.boxgrinder/config after which the appliance can be built with

export LIBGUESTFS_MEMSIZE=2048
boxgrinder-build CentOS-chef.appl -p ec2 -d ebs -b --debug

2 thoughts on “BoxGrinder Chef

  1. Reply
    Marek Goldmann - October 20, 2011

    Thanks for this writeup!

    We tested the libguestfs memory settings both on bare metal and AMIs and the outcome was very surprising. Increasing the size of memory for libguestfs on bare metal reduced the build time – that’s true, but on EC2 the build took more time! We decided to set default to the minimum (300MB) because this allows us to run BG also on t1.micro instances. Of course sometimes more ram is required if you do some heavy post processing.

  2. Reply

    […] Managing complex infrastructure is increasingly being automated using tools like Puppet and Chef.  However, one of the limitations of Chef is that it does not install and configure the OS: for Fedora, RHEL or CentOS I have discovered and started using BoxGrinder. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top