Grails on Jelastic

By | January 24, 2012
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

As Jelastic continues to grow, we want to continue to share with you new features, how to’s and updates. Today, we want to show you how Grails works within Jelastic. Grails is an innovative, high-productivity framework that follows the principle of “Convention over Configuration,” making it quite popular. It provides a stand-alone development environment while maintaining a simplicity that allows the developer to focus on what really matters: creating high quality, easy to use applications that users love. Grails supplements Java application development quite easily because it is built on Spring and based on Groovy.

So, how do you get all the benefits of using Grails and the Cloud? Easy. Use Jelastic!

1. Create the Application

  1. Go to grails.org and download the lastest version of Grails.
  2. grails tutorial
    grails hosting
  3. Unzip the package you have just downloaded.
  4. Add the environment variables (this step is optional):
    • GRAILS_HOME (…grails-1.3.7) specifys to the path where you extracted the archive;
    • PATH (…grails-1.3.7bin) contains the path to the bin directory.
  5. Create your app using the command line.
  6. With environment variables (C:grails on Windows,~/grails on Linux):
    …grails-1.3.7 grails create-app {app_name}

    Without environment variables:
    grails-1.3.7bingrails create-app {app_name}
    NOTE: application will be created in directory C:grails-1.3.7bin{app_name}
  7. Create .war archive with just one command:
  8. With environment variables (C:grails on Windows,~/grails on Linux):

    …grails-1.3.7{app_name} grails war {app_name}.war

    Without environment variables (C:grails on Windows,~/grails on Linux):
    …grails-1.3.7bin{app_name}
    …grails-1.3.7bingrails war {app_name}.war
    WAR archive will be saved at C:grails-1.3.7bin{app_name}

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. Ask Jelastic to create a new environment.
  3. grails cloud hosting

  4. In the Environment topology dialog pick your application server (e.g. Tomcat 6) and type your environment name, for example, Grails, then click on Create button.
  5. grails hostIt will take just a minute for your environment to be created.
    host grails

3. Upload the Java Package

  1. Upload your WAR file to the Deployment manager.
  2. grails hosting in the cloud

  3. Once the package uploaded to Jelastic, deploy it to your environment.

install grails

That’s it. Launch your application and enjoy!

host cloud grails

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Subscribe to get the latest updates

  • approve that it is very easy to deploy grails war to jelastic. Did it for our direct-feedback.com. Thank you for the service!

  • I second this article. It is just too easy deploying trails apps to jelastic. One tip to remember is to enable external configuration in config.groovy to allow you easily change configuration and such without re-uploading the war file! Time saver!

    • Thanks for your suggestion! You can add it to our voting list http://jelastic.com/?features

    • David

      Thanks for the tip Manners O! Where in the jelastic env can you store that external config? Among the tomcat conf?

      • Hi, David!
        You can store such files in a home directory.

  • Great article, great platform am loving it

  • external configs helps a lot !

  • Pingback: » Blog Archive()

  • Pingback: An Army of Solipsists » Blog Archive » This Week in Grails (2012-04)()

  • my application is failing to show anything am using grails 2.0 and l followed the details in this tutorial

    • Hi! We have to know the name of your environment to help you.

    • We are trying to fix this problem now. Sorry for the delay!

    • Can you send us your database connection string?

      • grails {
        mongo {
        host = “localhost”
        port = 27107
        username = “youshout”
        password = “youshout”
        databaseName = “youshout-db”
        }
        }

    • You should change: host=”mongodb-{your app name}.jelastic.servint.net” if you use Servint
      or host=”mongodb-{your app name}.jelastic.com” if you use HE

  • I am currently hosting 2 grails applications on Jelastic and aside from occasional stability hiccups, it is turning out to be quite a good platform.
    If you redeploy your application often like I do, you may want to copy the grails libs to your Jelastic environment to avoid transferring >40MB.
    The easy way is to build you app (grails war) and copy all of the libs you find in ${war.file}/WEB-INF/lib to ${tomcat}/lib on Jelastic. (Please implement the feature to be able to upload a zip and upzip it on Jelastic; it took me ages to copy the 77 libraries due to transfer errors and such; I already voted for the feature).
    Then when you build your app, simply run
    grails prod war –nojars
    And you’ll save yourself heaps of time and bandwidth.

    • there are 2 hyphens in nojars, as in:
      grails prod war –nojars

    • Hello, Marcin!
      Thanks for your feedback and suggestion! We appreciate you using Jelastic!

  • Hello Marina,
    I’m having some problems deploying the most basic grails 2.0 application (the one explain in this post). I’m getting the following error: page temporarily unavailable.
    Can you hep me? My environment is http://rchavarria-jelastic-test.jelastic.com
    Thanks in advance.

    • Hello!
      Increase your limit, please: one cloudlet is not enough for your application. And redeploy your app one more time. It’ll help.

  • Alan Thompson

    Hey – Thanks for a great bootstrap article. I tried to upload a Grails war file, but was missing the “ROOT” part I needed. Thank you for the example.

    Would it be a good idea to put “ROOT” or other defaults in the drop down menu when deploying a war file to a running environment? Right now the verbage: “Select one of the existing contexts or type new” does is a bit vague! I thought I needed to type “new” in the box! Perhaps a bit more specific instructions there would help Jelastic newbies (like me!) to avoid dumb mistakes.

    Thanks for such a great service,
    Alan Thompson