Barefoot Development

Ruby, mongrel_cluster, ferret and Linux PATHs

I have less hair. There's no two ways about it. In a fit of self-pity this weekend, I considered getting some of that great spray paint to solve the issue, but instead, I've decided to swear off various un*x distributions. Can't we all just get along? I digress.

While preparing a recent Rails application for production, I came across some odd issues with various ruby-powered applications and gems. I struggled to understand why these apps failed to launch on startup, but would work without a hitch when run "by hand" at the command prompt. After tearing through boot logs, application logs and a good portion of my hair, I finally figured it out: it's a PATH issue. On each of the boxes in question (a few Fedora Core and two RHE4 machines), ruby was installed in /usr/local/bin, and that, my friends, is not in the default PATH for root. So, I thought, "Easy fix. Simply add /usr/local/bin to the PATH in a system wide script like /etc/profile." Alas, t'was not to be. These newer incarnations of RedHat linux have the added security of SELinux, which, among many positive things, sets and unsets root's PATH multiple times during the boot sequence. In the end, we had to add /usr/local/bin directly within each component's startup script. The Rails (and gems) components we are using are mongrel, mongrel_cluster, and ferret (using the DRb server). For those keeping score at home, that's a 9.7 on the new technology in production (NTIP) scale. So you can keep your hair in tact, here are the startup scripts we're using.

Mongrel cluster:

#!/bin/bash
#
# Copyright (c) 2006 Bradley Taylor, bradley@railsmachine.com
#
# mongrel_cluster Startup script for Mongrel clusters.
#
# chkconfig: - 85 15
# description: mongrel_cluster manages multiple Mongrel processes for use \
# behind a load balancer.
#

CONF_DIR=/etc/mongrel_cluster
RETVAL=0
PATH=/usr/local/bin:$PATH

# Gracefully exit if the controller is missing.
which mongrel_cluster_ctl >/dev/null || exit 0

# Go no further if config directory is missing.
[ -d "$CONF_DIR" ] || exit 0

case "$1" in
start)
mongrel_cluster_ctl start -c $CONF_DIR
RETVAL=$?
;;
stop)
mongrel_cluster_ctl stop -c $CONF_DIR
RETVAL=$?
;;
restart)
mongrel_cluster_ctl restart -c $CONF_DIR
RETVAL=$?
;;
*)
echo "Usage: mongrel_cluster {start|stop|restart}"
exit 1
;;
esac


Ferret DRb server:
#!/bin/bash
#
# This script starts and stops the ferret DRb server
# chkconfig: 2345 89 36
# description: Ferret search engine for ruby apps.
#
# Sean Brown, Partner at Barefoot, Inc.
#
# save the current directory
CURDIR=`pwd`
PATH=/usr/local/bin:$PATH

RORPATH="/path/to/ror_root"

case "$1" in
start)
cd $RORPATH
echo "Starting ferret DRb server."
FERRET_USE_LOCAL_INDEX=1 \
script/runner -e production \
vendor/plugins/acts_as_ferret/script/ferret_start
;;
stop)
cd $RORPATH
echo "Stopping ferret DRb server."
FERRET_USE_LOCAL_INDEX=1 \
script/runner -e production \
vendor/plugins/acts_as_ferret/script/ferret_stop
;;
*)
echo $"Usage: $0 {start, stop}"
exit 1
;;
esac

Labels: , , , ,

We're hiring a UI Developer (XHTML/CSS)

We have just posted a position on 37Signals job board for an experience UI Developer.

--
Barefoot has an immediate opening for an experienced User Interface developer. Strong skills in XHMTL and CSS is a must. Significant experience in Javascript is a big plus. To be considered as a candidate, please submit at least 5 URLs for which you were either the only UI developer or at least the principal developer. No phone calls please.
--

So, all you CSS wizards, this is your dream job. Cool agency. Hip modern design. And you get to bring it to life. Not to mention the development staff is cool too (I'm a little biased). If you understand server-side programming, that is a bonus. If you know some Flash/Actionscript that is a big bonus as well. The big chunk is XHTML/CSS. We're talking about browser compatibility, W3C standards, etc... We want to implement standards and if you know them and know how to code them, then we want you. We work with some amazing clients, including Miller Brewing Company, KnowledgeWorks Foundation, and many many other large and small companies. This is a cool position.

Send your resume to recruiting@thinkbarefoot.com


Michael Krisher, Senior Developer, Barefoot

Labels: , ,