Capistrano worked, have to make development match

Continuing to learn Capistrano, I have to make my development environment match.

My dev environment is Ubuntu 10.0.4 and a number of Gems are more recent versions than those on Site5, I have to get my dev environment to match the now, working production site better so that deployments with Capistrano can really be just a push of a button. Comparing the Gemfile on the host and my local one showed that I use mysql2 on host and sqlite3 on dev. The first thing to do is to get mysql2 onto my dev machine.

In my dev Gemfile I remove sqlite3 and add mysql2.

source ‘http://rubygems.org’

gem ‘rails’, ‘3.0.9’
gem ‘mysql2’, ‘~>0.2.7’
gem ‘rake’, ‘0.8.7’

Executing ‘bundle install’ brings me this:


Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using bundler (1.0.15)
Installing mysql2 (0.2.13) with native extensions/usr/local/lib/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/usr/bin/ruby1.8 extconf.rb
checking for rb_thread_blocking_region()… no
checking for mysql_query() in -lmysqlclient… no

The bold bits show the bundler error attempting to install mysql2 and all the error information that comes after it is a bit of a canard. The problem is that a few libraries are missing. Execute this sudo will supply those libraries:

sudo apt-get install libmysql-ruby libmysqlclient-dev

This should succeed and when it does reissue the ‘bundle install’. This time is should work.

The next problem is ‘rake’, is you issue rake by itself you get:

$ rake
rake aborted!
You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

(See full trace by running task with –trace)

The problem is that the active rake is 0.9.2 but the one I want to run is 0.8.7. Stay tuned.


Leave a Reply

Your email address will not be published. Required fields are marked *