Tuesday, September 17, 2013

Play2 @Heroku

Play2 @Heroku 

It's professional to keep your app running smoothly 

We all want to share some high time after being so many times left alone and down with self deployed brittle single server solutions. No matter if it was ok for customers to have unreliable and unscalable solution, it didn't ever felt good to me.

Play2 is excellent fit for shared computing resources as it's 100% asynchronous and stateless. Heroku is just one platform for your Play2 app, but as it's simple to use and has native support I recommend you to take a look.


Howto


Herokus Play2 support works seamlessly if your application is at root of your repository. To ensure this you may need move it there. More of it later.


Ingredients


  • Play2
  • Git
  • Heroku Toolbelt
You propably have Play2 and Git installed, so just go here to get Toolbelt https://toolbelt.heroku.com/


Baking


Go to your github account or create one

Create github repository 
  • heroku-play2
  • PlayFramework as gitignore
Clone repository to local disk 
Go to local repository
  • cd heroku-play2
Create new app
  • play new heroku-play2
    • accept name of app (enter)
    • Create a simple Java application (2)

Gotzha

  • Move newly created app to from ./heroku-play2 to .

Modify your app (optional)
  • go to /heroku-play2/app/views
  • edit index.scala.html
Login to your Heroku account
  • Heroku login
    • If you don't have heroku account now is time to create it
    • otherwise give your credentials
Deploy your app to Heroku
  • git push heroku master
Open your app from heroku
  • heroku open


Further steps


If you have ever deployed traditional however simple app to any java container, or to any shared deployment environment, you probably felt difference.

Sure: there's more to come, as you have development environments, QA, and need to continuously deliver to production, but you are not alone here either.

If you want to see where you might end up with real world complexity, read https://devcenter.heroku.com/articles/multiple-environments

No comments: