Tuesday, 3 January 2012

Tunnelling to CloudFoundry services with Ubuntu

Have been waiting for a way to access my mongodb instances on CloudFoundry without having to access it via code, so was pleased to see this blog post on CloudFoundry (http://blog.cloudfoundry.com/post/12928974099/now-you-can-tunnel-into-any-cloud-foundry-data-service)

However, after following the instructions I had a few issues getting it running on Ubuntu so here are some notes of what I did.

Trying to install the caldecott gem with
sudo gem install caldecott
I got the following error:
ERROR: Error installing caldecott:ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb...
makeg++ [...]make: g++: Command not found
I took a look and on my system I do have a copy of g++ (binary called g++-4.4) but wasn't aliased to g++. A quick google got me here http://stackoverflow.com/questions/4735303/failed-to-install-gem-install-eventmachine-i-need-starling-in-my-project-fo.

The issue was easily solved by running
sudo apt-get install build-essential
which configured all the relevant bits and pieces.

Then back to the install of caldecott itself which then failed again with a complaint that rack wasn't installed (dependency of sinatra) so a quick "sudo gem install rack" sorted that.

So once that was sorted it was time to try it... except it didn't work. Ran the following:
vmc tunnel [database name]
and got the following error back:
To use `vmc tunnel', you must first install Caldecott:
gem install caldecott
Note that you'll need a C compiler. If you're on OS X, Xcode
will provide one. If you're on Windows, try DevKit.
This manual step will be removed in the future.
Error: Caldecott is not installed.
Back to Google and found this question posted to the CloudFoundry newsgroup (http://support.cloudfoundry.com/entries/20693163-trouble-installing-caldecott) which suggested installing bundler with:
sudo gem install bundler
And finally it all works as advertised.

No comments: