Develop grails applications collaboratively on the cloud with Nitrous.IO

Nitrous.IO is a cloud-based development environment.

With Nitrous, you are able to write and store your application development online and access it on the go at shared office machines, on your iPad or Chromebook.

Another cool feature is the ability to work on files together via collaborative mode with other developers. In this mode, any changes and selections you make in your IDE get sent to the other people working with you.

As of this writing, Nitrous does not have native support for Grails. But you are able to build and run grails applications given that it provides a full linux command line.

In this post, I will show you how to build and deploy a Grails application on Nitrous.

First, you need a Nitrous account. If you’re thinking about it, you can get one by clicking on my referral link – https://www.nitrous.io/join/wz33AXVGTKs

Create a new box

Once you have logged in, you will need to provision a new box. Click on Boxes on the menu area and select a new box.

Screen Shot 2013-07-03 at 13.39.05

After a few minutes, you should see a brand new box provisioned for you. You should see a screen with an empty workspace as such:

Screen Shot 2013-07-03 at 13.40.50

Notice the console at the bottom. Unlike Cloud9, this is a full linux console.

You can also ssh to the box using your favourite client.

Install Grails

The next step is to get Grails installed in your local box. You can do this by using the GVM tool.

Type the following into the console:

curl -s get.gvmtool.net | bash
 source "/home/action/.gvm/bin/gvm-init.sh"
 gvm install grails

This should download the latest version of Grails.

Creating your application

In the console, type

grails create-app mySampleApp

this should create a full Application you can edit and play with.

Editing your Application

You should be able to refresh your workspace and see your grails application laid out. To edit your application, just click on the file you are interested in.

Screen Shot 2013-07-03 at 13.46.42

I found that you can get pretty far by selecting the file type to be Java.

Running your Application

To run your application, simply type in your console

grails rA

Your grails application should run on port 8080. In the toolbar, you can click on Preview, which will lead you to an url like http://grailsbox-12954.euw1.actionbox.io:8080/ . You can either change your app context to / or add mySampleApp/ to your url ( http://grailsbox-12954.euw1.actionbox.io:8080/mySampleApp/ ) to see your running grails application.

The simplest way to do this is to pass in the right host and port number to your grails app:

grails -Dgrails.app.context='/' -Dgrails.server.port=8080 -Dgrails.server.host=0.0.0.0 run-app

Collaboration Mode

One of the best features of Nitrous is the ability to collaboratively work on the same file with another person. You can use the toolbar to invite other users in the system to join your project.

This feature is best explained here – http://help.nitrous.io/collab/.

Running Functional Tests

One thing to note is that you might want to use a remote testing tool like Sauce Labs to see the results of your functional tests ran in this cloud environment.

7 thoughts on “Develop grails applications collaboratively on the cloud with Nitrous.IO

  1. rob (@robpatrick)

    Thanks for the post, I was really excited by this idea so tried to give it a go. I followed the instructions, but every time I try and run the app I get this:

    action@grailsbox-13465:~/mysampleapp$ grails rA
    | Installed plugin database-migration-1.3.2…..
    Killed

    I can’t see anything in the logs. Have you seen this before?

    Thanks.

    Reply
    1. Tomas Lin Post author

      I logged into the box you shared and your settings seem to be the same and the one I have. I did see process killed with grails 2.3.0.M2 but attributed that to fork mode issues. There might be differences between environments, I am able to work perfectly fine in USA East. Have you tried terminating your current box and trying it in US East?

      Reply
      1. Tomas Lin Post author

        This is most definitively a memory issue. If I create a box with 600mbs of memory and run grails, it will get killed. But when I call export GRAILS_OPTS=”-XX:MaxPermSize=384m -Xmx384M -server” and then run the app via grails -Dserver.host=0.0.0.0 -Dapp.context=/ run-app, everything works fine.

  2. thiagoponte

    Many thanks! I managed to run Grails in my Nitrous IO box here.
    The console gave the following errors, but the application ran fine: pastebin.com/QxiVZU5w

    My box is a Ruby/Rails with 640MB RAM and 750MB HDD.
    I just entered: “grails rA” into console after manually creating a domain class and a controller with dynamic scaffolding.

    Reply
  3. Pingback: Install Grails | Nitrous.io

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s