Getting Started with Play Framework on Heroku

UPDATE: This tutorial is for Play 1.x (an old version). Check out my Play 2 Tutorial if you want to get started with the latest stuff.

Last week Heroku announced that you can now run Java apps on Heroku. Today Heroku announced that you can also easily run Play Framework apps on Heroku! Here’s a quick guide to getting started with Play! on Heroku:

  1. Install the heroku command line client on Linux, Mac, or Windows.

  2. Install git and setup your SSH key

  3. Install Play! version 1.2.3

  4. Login to Heroku from the command line: bash heroku auth:login

  5. Create a new Play! app: bash play new play_hello_world cd play_hello_world

  6. Run the app locally to test it: bash play run --%production

  7. Create a git repo, add the files, and commit: bash git init git add app conf lib public test git commit -m init

  8. Create a new app on Heroku: bash heroku create -s cedar

  9. Push the app to Heroku: bash git push heroku master

  10. Open the app in your browser: bash heroku open

That’s it! If you want to learn more about Heroku, check out the Heroku for Java Workbook and the Heroku Dev Center. And if you are at Dreamforce 2011 then check out Felipe Oliveira’s session on “Introducing Play! Framework: Painless Java and Scala Web Applications” on Wednesday at 3:30pm.

Let me know what you think and if you have any questions.