Skip to content

Play! in the Cloud

by on February 13, 2012

You’ve been waiting for it…

And now, it’s here!

We have great news for you: Jelastic now supports Play framework! Thanks to all of our active users, this great feature is now available in Jelastic PaaS. Play! is one of the most popular frameworks out there. It is written in Java and helps developer build Web application more easily with Java and Scala.

So let’s get to it. Let’s deploy your Play! application to Jelastic right now!

1. Create the environment

1. Go to jelastic.com and sign up if you haven’t done so yet, 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. In the Environment Topology window,  pick your application server (for example, Tomcat 6) and the database you want to use (for example MySQL). Then type your environment name, for example, playframework.

It will take just a minute for your environment to be created.

2. Configure database

1. Click the Open in browser button for MySQL.

2. When you created your environment, Jelastic sent you an email with credentials to the database. Create a user account and the database using these credentials.

Don’t forget to upload MySQL connector to the lib folder and restart Tomcat!


3. Create an application

1. Go to the playframework.org and download the latest Play! framework  version.

2. Unzip the package you have just downloaded.

3. Run Play framework using command line (C:\play on Windows,~/play on Linux):

…\play-1.2.4>play

4. Install Jelastic’s module on Play:

…\play-1.2.4>play install jelastic

5. Once the module is successfully installed create a new application with Jelastic support:

…\play-1.2.4>play new jelasticapp – -with=jelastic

6. Once your application is created change the application.conf file of your project (play-1.2.4\jelasticapp\config). Uncomment the part of file which includes Jelastic Account configuration and change all the required strings to the following:

jelastic.api.login=yourmail@domain.com
jelastic.api.password=yourpassword
jelastic.api.context=ROOT
jelastic.api.environment=playframework
jelastic.api.apihoster=api.jelastic.com

7.  In this file, uncomment  full JDBC configuration and  change the database URL, driver, user and password according to your database:

db.url=jdbc:mysql://mysql-playframework.jelastic.com/jelasticapp
db.driver=com.mysql.jdbc.Driver
db.user=jelasticapp
db.pass=jelasticapp

8. Increase db.pool.timeout to 10000 ms in connections pool configuration of application.conf file:

db.pool.timeout=10000

9. Create your application as you usually do.

10. Deploy your application to Jelastic cloud:

…\play-1.2.4>play jelastic:deploy jelasticapp
That’s all you have to do. Just a few simple steps. Your app is now ready to be opened in a new browser window.
Cheers!

From → Announcements, HowTo

18 Comments
  1. After I type cmd to deploy :

    File Uploading : [100%]
    File Uploading : OK
    Registration project processing… : OK
    Deploy processing… : not authenticated (access denied to app [xxxxx] with session [yyyy])

    How to fix it ?

    • Ok, I can solve by myself. It cause of wrong config jelastic.api.apihoster. In your example, it’s Europe hoster but I’m use US Hoster.

      But I found new problem which I can connect to the database.

      @69chf878g
      Can’t start in PROD mode with errors

      Database error
      A database error occured : Cannot connected to the database, An attempt by a client to checkout a Connection has timed out.

      play.exceptions.DatabaseException: Cannot connected to the database, An attempt by a client to checkout a Connection has timed out.
      at play.db.DBPlugin.onApplicationStart(DBPlugin.java:142)
      at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:480)
      at play.Play.start(Play.java:515)
      at play.Play.init(Play.java:300)

      • Increase your db.pool.timeout to 15000ms in application.conf file, the default value is too small – only 1000ms.

      • Actually it’ll be enough 8000-10000 ms, I had said you to increase timeout to 15000 to do a generous margin.

    • Hello!
      Please, check your config files.

      • Okay, db.pool.timeout=15000 is works !

        Why you setting it too long because by default it just 1000 ?

        Thanks,

  2. Geert permalink

    Hi,

    Nice work!

    One question though, will Jelastic support the Netty server (default play) in the future instead of the war packaging?

    Kind regards,

    Geert

    P.S. There is a small bug in the code above: “–with=jelastic” should be “–with=jelastic”.

  3. Is there a way to update existing Play application for Jelastic? Could you provide a guide for it?

  4. What should the jelastic.api.apihoster be for the US then?

  5. jayeatworld permalink

    Cool! Now what about Play Framework v2.0?

    • Hi!

      We plan to add this feature a little later. We already have this proposed in our voting list http://jelastic.com/?features . Please find that existing feature suggestion and vote for it. The more votes a faeture gets – the higher priority it gets in the roadmap.

Trackbacks & Pingbacks

  1. Newsletter – February 22, 2012 « Jelastic — Rock-Solid Java in the Cloud, Java Server Hosting, Java Cloud Computing
  2. Deploying Existing Play! Applications to Jelastic « Jelastic — Rock-Solid Java in the Cloud, Java Server Hosting, Java Cloud Computing
  3. Bleibt auf dem Laufenden mit Jelastic

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 95 other followers