JRuby and Jelastic : Sweetness

As you already know, Jelastic supports any JVM-based application, including Java 6, Java 7, Scala and Groovy. Jelastic also supports JRuby. In this tutorial we will show you how easy it is to run JRuby apps with Jelastic PaaS.

JRuby is a Java implementation of the Ruby programming language. It allows for the embedding of the interpreter into any Java application with full, two-way access between the Java and the Ruby code. So, if you are a Ruby developer and you would like to deploy your application to the cloud, Jelastic is the best way. It easy and fast.

To see how easy it is for yourself, just follow the next steps:

1. Create the Application

1. First of all you have to install JVM for your OS.

2. Navigate to jruby.org and download the latest JRuby release (Jelastic supports JVM-based languages). Don’t worry: it is Ruby for the JVM and and there won’t be any problems.

3. Extract the files from the zip package you have just downloaded.

4. Install Rails, an open-source web framework that lets you write “beautiful code by favoring convention over configuration.” It’s pretty easy, just type the following strings at command line:

c:cd jruby-1.6.5.1

c: jruby-1.6.5.1>cd bin

c: jruby-1.6.5.1 bin>gem install rails

Gem is the command-line interface for RubyGems, the standard Ruby package manager. Using RubyGems you can install Rails and its dependencies through the command line.

5. Install warbler. It is a gem, which allows to make jar and war files out of application.

c:jruby-1.6.5.1bin>gem install warbler

6. Create a new project in rails_projects, for example app:

c:rails_projects>rails new app

7. Create your .WAR file with just one command warble:

c: rails_projectsapp>warble

2. Create the Environment

1. Go to jelastic.com and sign up if you haven’t done so yet (you can do this on Servint or Host Europe servers) or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. Use Jelastic to create a new environment.

3. In the Environment topology window select your application server (e.g. Tomcat 6) and type your environment name, for example, RubyonRails, then click on Create button.

In a minute your environment with will be successfully created.

3. Upload the Java Package

1. Upload your WAR file to the Deployment manager.

2. Once the package is in Jelastic, deploy it to the environment you have just created.

Finally, you can open you app in a browser and enjoy!




6 Responses to “JRuby and Jelastic : Sweetness”

  1. hummerok

    WOW! Now with ruby!!!

    Reply
  2. Vamsi

    I am trying out…how to run rake commands ?

    Reply
  3. Links for January 12th through January 15th — Vinny Carpenter's blog

    [...] JRuby and Jelastic : Sweetness « Jelastic – In this tutorial we will show you how easy it is to run JRuby apps with Jelastic PaaS. [...]

    Reply
  4. Jelastic Newsletter – January 17, 2012 « Jelastic — Rock-Solid Java in the Cloud, Java Server Hosting, Java Cloud Computing

    [...] was one of our most read posts in the New Year.  Our how-to showed how effortless it is to deploy a Ruby application to the [...]

    Reply
  5. Jelastic Newsletter – February 1, 2012 « Jelastic — Rock-Solid Java in the Cloud, Java Server Hosting, Java Cloud Computing

    [...] to see how easy it really is to get JRuby applications up and running, you can check the how-to here.   – Java App Server Market Share   As Jelastic continues to grow (we now have over 7,500 [...]

    Reply

Leave a Reply