Showing posts with label ruby on rails. Show all posts
Showing posts with label ruby on rails. Show all posts

Saturday, April 04, 2009

How-To: Debian (Lenny) + Enterprise Ruby + Passenger + Git

Editor's Note: I am continually amazed by and grateful for the thousands of internet denizens who write about their problems and the solutions they have found. This post is one feeble attempt at contributing to that collective knowledge; hopefully many more will follow.

I decided to rework my home page as a simple Rails application, mainly to take advantage of the way Rails handles views/templates. Is this overkill? Probably. Are there a ton of other tools I could have used? Definitely. It's a classic case of holding a hammer and taking a look around for nails. But I digress. I also decided to set up Enterprise Ruby/Rails, Passenger, and Git, all of which are totally overkill at the moment but will hopefully lay a groundwork for things to come. Again, I digress.

The first thing we'll need to do, assuming we're working with a fresh install of Debian (5.0 - Lenny), is install libraries for Ruby, Apache, and mySQL.

apt-get install build-essential apache2 ruby1.8 zlib1g-dev libssl-dev mysql-server mysql-common libmysqlclient15-dev libmysqlclient15off apache2-prefork-dev libreadline5-dev

(I have no idea what a couple of those items are: I was prompted to install them later on in the process, so if you install them up front it will go more smoothly)

Get the most recent version of Ruby Enterprise Edition.

For me it was:

wget http://rubyforge.org/frs/download.php/51100/ruby-enterprise-1.8.6-20090201.tar.gz

Note the Enterprise Ruby version in red, we'll need it later.

The Ruby Enterprise installer looks in /usr/bin/ruby for Ruby, which doesn't currently exist; link up your install in ruby1.8 by doing

ln -s /usr/bin/ruby1.8 /usr/bin/ruby

Now, using your own version of Enterprise Ruby from above in place of the ###...:

Unarchive:

tar xzvf ruby-enterprise-########.tar.gz

Run the installer:

./ruby-enterprise-########/installer

Follow the prompts. Should be self-explanatory.

Next, remove the old link to ruby1.8:

rm /usr/bin/ruby

and link up to the enterprise ruby goodness:

ln -s /opt/ruby-enterprise-1.8.6-########/bin/rake /usr/bin/rake
ln -s /opt/ruby-enterprise-1.8.6-########/bin/gem /usr/bin/gem
ln -s /opt/ruby-enterprise-1.8.6-########/bin/rails /usr/bin/rails
ln -s /opt/ruby-enterprise-1.8.6-########/bin/ruby /usr/bin/ruby

Now install Passenger:

/opt/ruby-enterprise-1.8.6-########/bin/passenger-install-apache2-module

As you may have noticed, the Enterprise Ruby install directs you to add some lines to Apache's config file. If you're using Apache2, open that up with

vi /etc/apache2/apache2.conf

and add the following, replacing the gem version in red (2.1.2 at this time) with your own gem version.

LoadModule passenger_module /opt/ruby-enterprise-1.8.6-########/lib/ruby/gems/1.8/gems/passenger-2.1.2/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.6-########/lib/ruby/gems/1.8/gems/passenger-2.1.2
PassengerRuby /opt/ruby-enterprise-1.8.6-########/bin/ruby

That's it for Enterprise Ruby and Passenger! Next up, Git:

aptitude install build-essential gettext zlib1g-dev

Get Git - right now it's:

wget http://kernel.org/pub/software/scm/git/git-1.6.2.1.tar.gz

Unarchive; configure; make; install!

tar xvzf git-1.6.2.1.tar.gz
cd git-1.6.2.1
./configure
make
make install

You'll likely want to set up Virtual Hosts on Apache as well; this gets a little bit specific for the purposes of this how-to so I'll leave it at RTFM :-)

Saturday, January 17, 2009

Update: RecycleBank

On the day of my last post, the Dow closed at 11,516.92. I apologize for the amount of time that has passed; for the amount of "wealth" that has thus vaporized, I can offer no similar sentiment.

But that's not the subject of this post. Much has happened since September 2, 2008, presidential elections and recessions aside. That's right - this post is one of "those" posts. A navel-gazer. More diary entry than anything else, these posts are all too commonly spotted in the wild, often as the solitary entry in a defunct LiveJournal.

In December, I left my job at the Big Consulting Firm where I had been working since graduating in 2007. Once I realized that I would not be happy on the typical career path up that ladder, it was a quick exit. I was able to find another opportunity very quickly, and started on January 5th as a "Developer-Analyst" with RecycleBank. RecycleBank works with cities and private haulers to raise the recycling rates in the households that they service, by recording individuals' recycling habits and awarding points based on those habits. The points can then be redeemed for gift cards and other incentives. I'm working on the team that writes the software to process the data we receive from the trucks and allow people to receive their rewards.

I was (and still am) extremely excited about this opportunity, first and foremost because the company is a startup. "Startup" is a bit of a loose term, and RecycleBank is by no means a small company that is just starting to try out its model - we're already in 15 states and serve over 200,000 households. However, RecycleBank still has what I would consider to be the distinguishing characteristics of a startup, or the ones that are meaningful to me. For one: rapid growth, with an eye on even more growth. For another: dynamic teams, high energy, and flexible work processes. In other words, the specifics of how the company is going to achieve its goals are still very much up in the air, but everyone is going like gangbusters to try out different ideas. It's the kind of environment that makes me excited to go to work, which is never a bad thing considering how many of your waking hours you spend there.

These are all aspects of the company that I *expected or *assumed prior to joining, based on my interviews, research, and just knowing that it was a startup. To date its all been true to form, and I'm very pleased about that.

The other major draw was the technology that RecycleBank is using to build its applications. It's been almost two years since I started working with Ruby on Rails, the framework that we're using for the bulk of our work. It's great to be in a position where we're using it for something a bit more "mainstream" or "enterprise" than many Rails projects out there. Rails is still the new kid on the block, with a lot to prove to those who don't think it will ever be a useful tool for "serious" business. Hopefully the work we're doing with it can eventually be evidence to the contrary.