Heroku (client) on JRuby - Part I.

Recently I heard the Heroku buzz from every direction. To put it simply Heroku is a fully (I mean completely fully) managed hosting for your Ruby application.

That means you can focus on your app development and forgot the pain of eg. the deployment or platform issues. Use Rails, Sinatra or any other (even your own) framework or just a collection of Ruby scripts that can be hooked up to the Rack interface.

Rack is a nice "gateway" that routes and manages the web requests to any Rack capable process; moreover you can add and adapt middleware libraries and tools to enable pre- or postprocessing through Rack. I won't say more on Heroku ('cos I'm green at Heroku as well) so I let you check the non-buzzy Docs page for more.

I'll say a few words on the Heroku client that manages eg. the app creation, authentication and deployment (via Git). In its present state you cannot use with JRuby. The client library needs other (relatively few) C extensioned gem that obviously won't work on JRuby even if you can access C stuff with FFI calls.

Among the Rubyists the OS X is far more popular than other platforms so you are in a bad situation if you wanna stick to a Windows box or - to gain the promised platform independence - the JRuby implementation. On OS X you have (almost) everything 'cos its Unix after all. The point is the library maintainers simply don't (or just rarely) take into account the different platforms. Even if there is an equally good implementation of their beloved gems like the sqlite3 library. I'm talking about the dependencies only. Developing a cross platform library is hard. To make alternatives available outside that specific gem is easier. Yes, we have JRuby extras (cool gems for replacing C-dependend gems).

So I decided to help a few maintainer to unbind their excellent gems from C extensions if possible. Fortunately most of these libraries can be found on GitHub, forking and sending pull requests is easy.

In Part II. I'll try to show a way to use the Heroku client gem in your JRuby development process.


szabi said...

Now I understand :)

Richard Conroy said...

I recently did some digging around with Heroku, and the issues with Windows and JRuby usage of the Heroku gem still persist.

A lot of it centers on the use of the json gem which has a lot of native extensions that haven't been updated.

Charles & Rebekah said...

Any chance you're going to get around to 'part 2' of this and show us how to use Heroku with JRuby?


c de b

Richard Conroy said...

The Heroku client gem has undergone a lot of development over the last few months. It's now perfectly usable on Windows, so the dependency on native gems has been resolved.

Calling jruby -S gem install heroku is successful on my machine. Haven't used Heroku from jruby in this way.