Friday, November 21, 2008

JBoss Rails Plugin

Last night I jokingly posted on twitter that I'm a Rails Deployment Whore. It's more true than not, I love trying out new deployment solutions looking for the ultimate in scalability, flexibility and ease of deployment. Imagine my surprise when I found the new jboss-rails plugin from Bob McWhirter at OddThesis.org.

History
Back in early 2007 I posted (on this blog even) that I was betting my career on JRuby/JBoss. It turned out OK in the end, but the middle was pretty ugly. A combination of immaturity in JRuby, GoldSpike, our deployment process, and a short development schedule meant that we moved back to plain-old-ruby before we could really prove my JBoss/JRuby theory. Fast forward a few months, Ruby is working fine for WellCare, and Passenger comes out. I loved the concept of Passenger, and WellCare is now happily running Passenger on all of their production sites. In the middle, we used Mongrels behind HAProxy, which is a pretty good solution when you have some processes that may take longer than others. I've since moved on from WellCare, and at my new company we use JRuby on Glassfish exclusively for all of our Rails deployments.

JBoss on Rails
I'm going to write up starting from a fresh Rails 2.1 project, so you can see everything required to deploy. It's really not that much.

Step 1: Download and unzip JBoss AS 5

Step 2: Set the $JBOSS_HOME environment variable to the location of your unzipped JBoss Folder
I downloaded to /Users/briank/Downloads/jboss-5.0.0.CR2 so at the top of my .bash_profile file I added this:
export JBOSS_HOME=/Users/briank/Downloads/jboss-5.0.0.CR2

Step 3: Remove the default 'ROOT' context that's installed in JBoss.
We'll remove the default context so that we can deploy to the / context instead of on a subdirectory.
rm -rf /Users/briank/Downloads/jboss-5.0.0.CR2/server/all/deploy/ROOT.war

Step 4: Install the jboss-rails deployer
The jboss-rails deployer does JBoss magic and virtually links the deployment directory to your actual deployment location. I keep my Rails apps in ~/NetBeansProjects, so even though the JBoss installation is elsewhere, it will serve the app out of my NetBeansProject/ directory. This is pretty powerful as we'll see later!
Download the rails deployer here

Unzip it:
unzip jboss-rails-deployer-1.0.0-beta-1.zip

Install it:
cd jboss-rails-deployer-1.0.0-beta-1
cp -R jboss-rails.deployer $JBOSS_HOME/server/all/deployers/

Step 5: Install the jboss-rails plugin
./script/plugin install git://github.com/bobmcwhirter/jboss-rails-plugin.git

Step 6: Create your database - I'll use mysql for this example
mysqladmin -u root -p create jbosstest_development

Step 7: Change all references in the plugin folders for the server type.
Several of the rake tasks and other code assumes that you deploy to $JBOSS_HOME/server/all, while others assume $JBOSS_HOME/server/default. Above in step 4, we put our deployer in $JBOSS_HOME/server/all so that's what we're going to use. Search through all the code in the plugin and its rake tasks and make sure they all use /server/all.

Step 8: Install the JDBC gems and adapters for your db installation
rake jboss:rails:jdbc:install

Step 9: Deploy your application to JBoss
rake jboss:rails:deploy

Step 10: Start JBoss
rake jboss:as:run

Conclusion
I didn't cover any of the advanced features of the plugin or of the concepts behind the jboss-rails integration that Bob's done. One of the most exciting to me is the scheduler process that makes a nice mini-cron out of a directory in your Rails app. I'm all for getting rid of CRON and encapsulating that processing code in my Rails app. The other extremely cool bit of this plugin is the support for Capistrano deployments. Because the integration with JBoss is a virtual symlink to your Rails deployment folder, Bob's included a cap recipe that operates exactly as you'd expect one to. One of the problems with the previous WAR style deployments in my mind has always been the inability to easily move forward and backwards. With JBoss-Rails you get the best of all worlds. I'm really impressed with Bob's work so far and with the attention and commitment that JBoss is bring to Rails deployment.

Thursday, November 20, 2008

DTI Data is an awesome disk drive recovery company

I had reason recently to attempt recovery of data on two hard drives that had been reformatted. Often in the disk drive world, reformatting isn't really erasing the data, and knowing that I was hopeful that we could recover the data that existed before the reformat.

First I sent the drives off to a company that advertised heavily on the web using drive recovery type keywords. I got a call the next day. The guy said he could "repair" the drives for $5000, then recover the data. He said some cylinders were broken and the read heads on one of the drives were bad. I knew this not to be true, so I told him to ship us back the drives. He immediately reversed course and told me that he could recover the data much cheaper, I could just name my price! Fool me once, shame on you... So when we got the drives back I was eager to get them recovered by professionals. Enter DTI Data a very reputable drive recovery company here in the Tampa area.

DTI Data spent a few days with the drives, and determined that they were actually zeroed out during the reformat. Somebody didn't want us to find the data that they erased. Oh well, no great loss. But the best part was their return fedex to me. It included both drives, nicely packaged, and our check back. They returned our money because they couldn't help. On one end of the spectrum, some jackass is trying to dupe us into paying $5000 for repairs our drives didn't need. On the other end of the spectrum is DTI Data, doing the right thing by their customers.

I've learned a valuable lesson in this. And next time I need drive recovery, I know exactly where to go. Kudos to DTI Data for running a business with integrity.

Monday, September 15, 2008

Rock and Roll Fantasy Camp - Vote early, vote often!

If you remember a few weeks back, my forever-sainted wife sent me to the Rock and Roll fantasy camp in Orlando. It was one of the best days of my life!!

Video is here.

Ignoring the fact that we sounded awful, I'd appreciate a vote for my band. You can vote once for each email address you have. And I know some of you are tipping the email address scales out there.

If you click on the Five Blokes and a Bird band, that's mine. Please take a minute to vote for my band, the winners will get to go to the Rock & Roll fantasy camp in London for a week in November and record in Abbey Road Studios. Again, it would be better if you didn't apply the "Does Brian's band actually deserve to go to London" filter before you make this vote.

Please pass along to anyone you can ask to vote as well. Don't be shy, wives, cousins, neighbors.... :) This could turn my "day of a lifetime" into a WEEK of a lifetime!

Remember, a programmer can't live on Ruby alone.

Tuesday, August 26, 2008

Installing Passenger on CentOS 5.2 x86_64

I am installing Passenger on CentOS 5.2 and ran into a tough spot where it wouldn't find Apache, even though I had apache installed through Yum. The answer was to install the x86_64 version of the apr-devel package, as yum's dependency checker only installed the 32 bit version. See http://bugs.centos.org/view.php?id=2934 for details on the bug.

yum install apr-devel

That did the trick!

Monday, August 18, 2008

Rock and Roll Fantasy Camp


If you don't care for non-technical posts, move on - this one is all Rock and Roll!

Some who know me will remember that I've been screwing around on the guitar since I was a kid. I never got "good", and I never really did anything with it. All of that changed on Friday when my wife sent me to Rock 'n Roll Fantasy Camp for a day.

Thursday night, when I got home from work she told me that she had already arranged with my office for me to have the day off. She said we were going to Orlando for some back-to-school shopping for the kids. It wasn't until bedtime that she told me the real story. She was dropping me off at 8AM, and I'd spend the rest of the day learning from the Masters of Rock from the past three decades. I'd end the day with a live show, opening for Extreme and King's X at the House of Blues in Orlando.

Obviously, my jaw hit the floor and I didn't sleep a wink. Friday morning finally came, and I actually sat down at breakfast next to Glen Hughes - Deep Purple basist. Glen coincidentally ended up being my band leader. So along with a few other regular joes, Glen turned us into the new band "Five Blokes and a Birdie". We practiced for about 8 hours, with a small break in the early afternoon for some classes from the other legends there. Winger, AC/DC, Slaughter, The Cars, Aerosmith, Deep Purple, Guns 'n Roses, the camp counselor list reads like a who's who in rock.

At roughly 7:30, we hit the stage at the House of Blues in Downtown Disney. We opened with Superstition (Stevie Wonder), and followed up with American Woman and You Really Got Me. Now clearly, we weren't very good after just a day's practice, so our counselors chose pretty basic 3 chord songs to help us look good.

I just can't emphasize how much fun the whole day was. I had the time of my life practicing with and learning from these patient rockers. And I thought I'd be nervous about playing the House of Blues, but the whole thing was a blur. I played pretty well, only had a few fat-fingered moments, and I didn't choke in front of the screaming throng of "fans", who at that early hour of the evening mostly family and friends of fellow campers. My wife stood right at the front barrier and took a hundred pictures with my iPhone.

My favorite picture is the one at the top of this article. I'm on the left, Glen Hughes (Deep Purple) is singing and playing bass, then on the right is Chris Slade(AC/DC). It's fun to be in good company.

I highly recommend the experience to any musicians, whether you're good, bad, or years out of practice like me. It was a day I'll never forget!

Thursday, July 10, 2008

iPhone Development

I won't violate any NDA's that I've signed with the mothership, but I am excited to announce that the iPhone app that I've submitted to the App Store has already been purchased a few times. Nothing like seeing your baby fly. Go, baby, go. More here shortly, when the NDA expires. I think that's tomorrow :)

Thursday, June 19, 2008

Passenger 2.0 RC2

I just upgraded ICanHazBinky from Phusion's Passenger (mod_rails) 1.05 to 2.0 RC1 yesterday, but somehow I missed the fact that they're already at RC2. I downloaded the new gem and installed it without problems on our SliceHost slice. Overall I'm very pleased with the speed of the new 2.0 code. It "feels" significantly faster than the 1.0 code. Does anybody have any empirical data to compare? I should have run some load testing before I upgraded, next time I won't forget.