Heroku Tutorial

How to publish a play app to heroku

Recently a friend needed to publish a play app to heroku and for some reason, the heroku hello world would work, but not their specific play project. The secret? The Heroku documentation is not updated for the latest version of play. So here is how you can get started!

1) Create a new project

activator new

2) Select minimal play (option 6) and give it a name

hello-world-heroku

3) Change into the directory and initial empty git repo

cd !$
git init

4) Set up a play secret (this is required for Play 2.5 apps running in production mode)

activator playGenerateSecret

Make sure to take note of the secret it spews out.

5) Edit your application.conf to use this new property via an environment variable

play.crypto.secret = ${APPLICATION_SECRET}

6) Set up heroku

heroku create
heroku config:add APPLICATION_SECRET='YOUR_SECRET_FROM_STEP_4'
git add .
git commit -m "initial commit"
git push heroku master

7) View your newly deployed app out on heroku by typing

heroku open

For Apps already under git version control

1) Set up a play secret (this is required for Play 2.5 apps running in production mode)

activator playGenerateSecret

Make sure to take note of the secret it spews out.

2) Edit your application.conf to use this new property via an environment variable

play.crypto.secret = ${APPLICATION_SECRET}

3) Setup Heroku

heroku create
heroku config:add APPLICATION_SECRET='YOUR_SECRET_FROM_STEP_4'

4) Setup Heroku git tracking

git remote -v
heroku git:remote -a NAME_FROM_HEROKU
git push heroku master