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

Resizing an LVM swap partition

I tested this on a lightly loaded Ubuntu 8.04 server.

free
swapoff /dev/vg01/lv_swap
lvextend -L+500M /dev/vg01/lv_swap
grep swap /etc/fstab # find the UUID for the existing swap space
# remake the larger swap using the same UUID as before
mkswap -U fc7f369e-c655-4a35-a227-a7c725a2b9bc  /dev/vg01/lv_swap
swapon /dev/vg01/lv_swap
free

linux-iscsi with NetApp

SLES includes an iSCSI initiator, linux-iscsi.  The initiator is configured using a daemon that is managed just like any other service, with a script in /etc/init.d/ and configuration files in /etc. After installing linux-iscsi using YaST I edited /etc/iscsi.conf to set the DiscoveryAddress and ran ‘/etc/init.d/iscsi start’ to start the service (‘chkconfig iscsi on’ ensures it is restarted after a reboot also). Logging onto my NetApp filer I could see the SLES initiator also logged in (‘igroup show’), and was able to create and map a LUN to the host. Back on the host ‘iscsi-ls’ yielded nothing useful, so I downloaded and installed the linux host utilities from NetApp’s support site.  ‘sanlun show all’ now shows the lun-pathname and local SCSI devicename (eg. /dev/sdx) to which it is mapped. Oracle’s Orion benchmark  indicates a random I/O throughput dramatically better for the iSCSI LUN compared to using a VMware virtual disk.

Installing Oracle XE on Ubuntu

Oracle XE is available for 32-bit architecture (i386) Linux only, although it may be possible to force installation on a 64-bit host. It will run in 512KB RAM but requires a 1GB swap space. Add:

deb http://oss.oracle.com/debian unstable main non-free

to /etc/apt/sources.list and then as root:

wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add - apt-get update apt-get install oracle-xe

‘libaio’ and ‘bc’ are in the repository, so dependencies will pull them in if the user doesn’t have them.

Subversion on Ubuntu – Multiple Repositories

Eighteen months have passed since I setup Subversion on Ubuntu and I’ve found multiple repositories are valuable for providing finer grained access control and easier storage management. Here is a revised incantation:

su -
adduser --system --home /srv/svnrepos --gecos "System account to run svnserve" svn
apt-get install subversion xinetd
cat >> /etc/xinetd.d/svn << "EOF"
service svn
{
        port                    = 3690
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = svn
        server                  = /usr/bin/svnserve
        server_args             = -i -r /srv/svnrepos
}
EOF
/etc/init.d/xinetd restart

# for each repository, eg. myrepo1
$repo=myrepo1
svnadmin create /srv/svnrepos/$repo
chown -R svn:nogroup /srv/svnrepos

# uncomment line to use default password file
vi ~svn/$repo/conf/svnserve.conf

cat >> ~svn/$repo/conf/passwd << "EOF"
[users]
fred = *****
...

Portable PuTTY

Not unusually I work on both Windows and Linux systems, using SQL Server on Windows and Oracle on SuSE. I use Windows as the primary operating system on my workstation because I have greater confidence it will have driver support for devices like built in broadband wireless. Nonetheless I need to SSH regularly into Linux boxes to do administration and script development so I use Xming and Portable PuTTY.

Configuration options are stored in ‘session files’ located in in %appdata%Portable PuTTYsessions.  They contain name value pairs like the following:

FontHeight8 
FontLucida%20Console
…
TermHeight43
TermWidth120
WinTitlemyhost.mydomain.com%20-%20PuTTY

The session files may be edited directly, and this appears the only way to update the UserName setting for an SSH autologin, but this approach is unsupported and a corrupted session file is ignored without warning.

To create a shortcut that loads a PuTTY session set the start location to “%appdata%Portable PuTTYsessions” and append a -load parameter to the target invocation.

Cygwin

Like many enterprise developers I use both Windows and Linux. Sometimes I really want to be able to use POSIX text processing tools on Windows, for example when troubleshooting pipe delimted data files used in batch system interfaces. I often have to research issues with pipe delimited transaction logs, and awk can be used to filter out the records of interest, eg.

awk -F| '($3==276||$3==259) && $5=="Payment " { OFS="|"; print $0 }' < transaction_log

Using a command line text tool like this can be much more efficient than importing text files into Excel for filtering. Other text tools I use heavily include find, grep, sed, tr and wc.

POSIX tools for Windows include SUA (aka. Interix, aka. SFU)  and MKS toolkit but I prefer Cygwin or Cygwin/X

Under Cygwin I used to use rxvt, but now I’ve switched to mintty which is similar to PuTTY. X can be started from a mintty session as follows:

xwin -multiwindow -clipboard

Installing Subversion on Ubuntu

There are many ways to do it, but this incantation worked for me on an Ubuntu host. This is an ‘entry level’ setup with one repository and simple authentication. Read the Subversion book and Ubuntu documentation to understand.

su -
apt-get install subversion
adduser --system --home /srv/svn --gecos "System account to run svnserve" svn
svnadmin create /srv/svn
chown -R svn:nogroup /srv/svn

apt-get install xinetd
cat >> /etc/xinetd.d/svn << "EOF"
service svn
{
        port                    = 3690
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = svn
        server                  = /usr/bin/svnserve
        server_args             = -i -r /srv/svn
}
EOF
/etc/init.d/xinetd restart

# uncomment line to use default password file (~svn/conf/passwd)
vi ~svn/conf/svnserve.conf

cat >> ~svn/conf/passwd << "EOF"
[users]
fred = *****
...
EOF
chmod 600 ~svn/conf/passwd

Posts navigation

1 2