OpenShift, BoxGrinder, SteamCannon and JBoss AS RPMs

Red Hat recently launched their new OpenShift PaaS service based on their acquisition last year of Makara.

Enterprise customers, however, still have more complex requirements, including hybrid in-house/hosted infrastructure, and integration with specialized hardware appliances.

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.

It appears that BoxGrinder was being nurtured by JBoss to complement their PaaS development prior to the Makara acquisition.  First BoxGrinder was used last year by a JBoss project called CirrAS that created JBoss AS 6 cluster appliances, and then that appears to have segued along with Cooling Tower into SteamCannon, a Ruby based JavaEE PaaS framework.  Publicly available artifacts from both these projects remain, but now we must wait for OpenShift to be open sourced.

A requirement of projects like CirrAS and SteamCannon has been writing specs to package JBoss into RPMs.  This was done previously by a JBoss employee contributing to the JPackage project but at last Red Hat is finally packaging JBoss AS 7 into Fedora.

Converting from MyISAM to InnoDB

To change the default table engine add the following to my.cnf:


To check the engines being used:


Each existing table has to be converted explicitly:

mysql -u ${user} -p -e "SHOW TABLES IN ${db};" \
| tail -n +2 | xargs -I '{}' echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
mysql -u ${user} -p -D ${db} < alter_table.sql

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
      size: 4
  name: centos
  version: 5
  - ruby-devel
  - rubygem-chef
  - name: "rbel5"
    baseurl: ""
    ephemeral: true
  - name: "epel"
    baseurl: ""

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

boxgrinder-build CentOS-chef.appl -p ec2 -d ebs -b --debug

Installing Ruby Enterprise Edition on RHEL

RHEL5 is packaged with ruby 1.8.5 which is now outdated. To replace it with REE:

rpm -e `rpm -qa|grep ruby` # remove outdated ruby packages
sudo yum install wget -y
sudo yum install gcc-c++ make patch zlib-devel -y
sudo yum install openssl-devel readline-devel -y
cd /tmp
tar xzvf ruby-enterprise-1.8.7-2011.03.tar.gz
sudo ./ruby-enterprise-1.8.7-2011.03/installer --dont-install-useful-gems --auto=/opt/ruby-enterprise
cat > /etc/profile.d/ <<EOF
if ! echo ${PATH} | /bin/grep -q /opt/ruby-enterprise/bin ; then

. /etc/profile.d/


I’ve finally bought myself a Buffalo wireless router with DD-WRT pre-installed. The hardware specs include a 680MHz Qualcomm Atheros CPU (using a MIPS32 core) and 128MB RAM. For connectivity the unit has dual band 2.4GHz/5GHz support and 5x1Gbps ports.  It also has a USB port for an external hard drive. Standard features include a Dnsmasq DHCP/DNS server and NTP.  DD-WRT uses an OpenWrt kernel based on Linux but adapted for a firmware environment.  Optware  installation for Atheros is described in a DD-WRT forum and the preferred package manager is Opkg.  Using the external USB port for storage is discussed in detail on the DD-WRT wiki.

Chef 0.10 on CentOS 5.x

My experience with Chef on CentOS 5 recently confirmed this is still a beta product. The bootstrap instructions are incomplete, leaving you hanging half-way down the page at "CentOS 5.x users will need to have version 4.2 or better of gcc in order for this to function. This may be a newer version of gcc than that which is installed via yum."  To finish the installation detour to this page that provides links to the FrameOS RBEL repository and installation instructions for the Chef server that worked for me. After completing the server install return to Bootstrap instructions and resume from ‘Verify All Components are Running’.

mysql gem installation on Windows x64

Having run into multiple issues setting up MySQL with Rails on Windows x64 my recommendations are:

  • Install the 32-bit version of MySQL, do not try to use the 64-bit version.
  • Install into a path with no spaces, do not accept a default like "C:\Program Files\MySQL\MySQL Server 5.5\"
  • Install the MySQL gem with an invocation similar to:
         gem install mysql -- --platform=ruby --with-mysql-dir="D:\Programs\MySQL\MySQL-Server-5.5" --with-libmysqllib="D:\Programs\MySQL\MySQL-Server-5.5\lib\"
  • Be sure to uninstall/reinstall whenever you install a new version of MySQL.
  • Make sure D:\Programs\MySQL\MySQL-Server-5.5\lib is included in your path, as well as D:\Programs\MySQL\MySQL-Server-5.5\bin. Make sure other copies of libmysql.dll are not being picked up from elsewhere on your path or your ruby installation directories.

Unfortunately with mysql-5.5.15-win32, mysql-2.8.1-x86-mingw32 and Windows 7 x64 even this was not enough: after experiencing a segmentation fault running rake db:create I gave up and downloaded the libMySql.ddl from InstantRails.

    One year with Rails

    One year since I picked up ‘Agile Web Development with Rails’ and coded my first Rails model/controller/view: seems so long ago now.

    Things I’ve mastered in the past year:

    • Test driven development using unit and functional tests.
    • Master-detail forms using Ajax to add and delete rows, fetching product details in JSON for codes entered into a line item.
    • Prototype and jQuery, including jQuery UI datepickers.
    • Loading and parsing XML data files using Nokogiri.
    • Building complex reports using nested views in PostgreSQL, maintained using rails_sql_views.
    • Creating formatted, multi-tab Excel spreadsheets using Spreadsheet gem.
    • Creating pixel-perfect PDF reports using JasperReports loaded using Java-Ruby bridge.
    • Hosting using Apache with Passenger, Mongrel, Thin and Unicorn.
    • Monitoring using ScoutApp.
    • Upgrading a production app from Rails 2.3.4 to Rails 3.0.9.
    • Switching from ERB to HAML.

    Using Apache with Mongrel or Thin and Rails 3

    When using mod_proxy to load balance between members of a mongrel or thin cluster it’s important not to pass requests through for static content.  A basic virtual site can be configured like this:

    <VirtualHost *:80>
        DocumentRoot /opt/myapp/public
        <Proxy balancer://thinservers>
        ProxyPreserveHost On
        ProxyPass /images !
        ProxyPass /stylesheets !
        ProxyPass /javascripts !
        ProxyPass / balancer://thinservers/
        ProxyPassReverse / balancer://thinservers/
        <Proxy *>
         Order deny,allow
         Allow from all
        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined

    Thin with Apache

    Having run into compatibility issues between Passenger and RJB and between Mongrel and Rails 2.3.8 I’ve been looking at Thin.

    Slicehost has a couple of good articles on setting up a Thin cluster with Apache on Ubuntu.

    In summary:

    gem install thin
    thin install
    /usr/sbin/update-rc.d -f thin defaults
    thin –h # help
    thin -C /etc/thin/${appenv}.yml -c ${apphome} -s 3 -e production config
    su – ${appenv}bat ; thin -C /etc/thin/${appenv}.yml start

    Posts navigation

    1 2 3 4 5 6 7 8 11 12 13
    Scroll to top