Deploying Existing Play! Applications to Jelastic

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

Yesterday, we had a guest post from Mr. Sander de Vos from Belgium. Today we have another short article from Leo, over in the Philippines. This is a repost of the article that Leo wrote for his blog. You can read it here, on Dzone (go upvote it!) or on his blog.

If you have an existing Play! application and you want to put it on Jelastic, the easiest way is to use the Jelastic Plugin on Play!

The Requirement:
  • You need to have an existing Jelastic Environment. If you’re Play! application used a database, your environment must have database enabled and also configured, which means you have your database create with appropriate user assigned to it
  • Your application must use at least Play! version 1.2.x.

Steps:

  1. On your application.conf add this Jelastic configuration
jelastic.api.login=login@domain.com
jelastic.api.password=yourpassword
jelastic.api.context=defaultLocationOnEnvironment
jelastic.api.environment=environmentName
jelastic.api.apihoster=your_hoster’s_api (you can find it here)
Example:
jelastic.api.login=barramedalb@gmail.com
jalestic.api.password=6680539
jelastic.api.context=ROOT
jelastic.api.environment=aims-jam
jelastic.api.apihoster=app.jelastic.servint.net

Jelastic.api.login and password are your credentials to log onto the Jelastic App Controller. Jelastic.api.context specifies where the application will be deployed. In the example, ROOT means it is deployed and accessible by the domain name which is aims-jam.jelastic.servint.net. If I put an app on jelastic.api.context, my application will be deployed on app context and can be accessed on aims-jam.jelastic.servint.net/app. Jelastic.api.environment is the name of your environment defined on your apihoster.

At the moment, jelastic.api.apihoster you can get from this table.

  1. Configure your jdbc on application.conf.
db.url=jdbc:mysql://{db_type}-environmentName.your_hoster/dbName
db.driver=com.mysql.jdbc.Driver
db.user=dbUserName
db.pass=dbUserPassword
Example:
db.url=jdbc:mysql://mysql-aims-jam.jelastic.servint.net/aims-jam
db.driver=com.mysql.jdbc.Driver
db.user=getch123
db.pass=123456789

You can edit and define this within the Jelastic admin console.

  1. Increase your db.pool.timeout to 10000ms of application.conf

db.pool.timeout=10000

  1. Deploy your application to jelastic cloud by (must be on the application directory): play jelastic:deploy

This won’t take long, but it does depend on your internet connection speed. This will compile your application and create a war file and then will upload it to jelastic. If it is finish, you can now access your application. In my example, I can access my application on aims-jam.jelastic.servint.net.

It seems that the Jelastic plugin can only work the default environment specified on application.conf, so I created a new environment that I named localhost for my localhost testing environment.

If I am testing my application locally, I will execute: play run –%localhost

Hope this can help you. :)

Resources:

http://blog.jelastic.com/2012/02/13/play-in-the-cloud/

You can respond to Leo on his blog, or in the comments below.
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

6 Comments

  • [...] So, he wrote his short how-to for his own blog and then we picked it up. If you are interested in deploying an existing Play! app, then you should give his short how-to a look. You can find it here. [...]

  • Hi, first of all, jelastic is great and play too… and i like it very much.
    And i use this plugin to deploy play app to jelastic, and works great… but one question to jelastic people…

    Which diferent between simpre java web app (.war) and play app deploy to jelastic…

    I’m new on jelastic, and seem a great framework, but, one of the keys are “asyncronous” calls and his “server” netty… in jelastic only tomcat 7 (that support servlet 3 and asynchronous calls) but play finally don’t relay on servlet (it have a wrapper when build war but…)

    What about this?

    Thanks jelastic, great work (and play too).

  • If you read above article carefully, you will see that the answer to your question is actually in there:

    [...] This will compile your application and create a war file and then will upload it to jelastic. [...]

    As you can see, your Play! app is packaged as WAR file and deployed as such. As a result, you will lose all the “netty magic” that Play! standalone apps can provide.

  • I didn’t read this line, but i know… i deployed play app like war in jelastic.

    Maybe was a rhetoric question. The real question may be, when native support to play in jelastic?

    Thanks for answer.

    PD: I tried jrebel and is great ;)

  • sumeet says:

    Hi,

    While deploying my play to jelastic, i am getting following error.

    rappdatalocaltempmarket …
    ~ Creating zipped archive to c:usersuserappdatalocaltempmarket.war …
    May 23, 2012 12:42:43 AM play.Logger fatal
    SEVERE: Cannot read application.conf

    Can you suggest something….

    Thanks
    Sumeet

  • P.S. says:

    @sumeet: I’ve got the same error when deploying with “play jelastic:deploy [appname]“, but when I execute the deploy command (“play jelastic:deploy”) directly in the appfolder it work’s

Leave a Reply

Contact Jelastic for More Information CONTACT
%d bloggers like this: