Deploying Existing Play! Applications to Jelastic

By | March 13, 2012

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:

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

You can respond to Leo on his blog, or in the comments below.

Subscribe to get the latest updates