Deploying Play 2.0 app on Heroku

Go To


So I am kind of new to setting up servers. And I have been struggling with various sql issues all night. I think the only thing that sits between me and a successfully running play app is this: error

Starting process with command `target/start -Dhttp.port=80 `
2012-04-04T05:58:52+00:00 app[web.1]: Play server process ID is 1
2012-04-04T05:58:53+00:00 app[web.1]: [info] play - database [default] connected at jdbc:mysql://
2012-04-04T05:58:56+00:00 app[web.1]: [info] play - Application started (Prod)
2012-04-04T05:58:56+00:00 app[web.1]: Oops, cannot start the server.
2012-04-04T05:58:56+00:00 app[web.1]: Failed to bind to: /
... more errors

Does anyone spot any problems? Do I need any java options arguments?

I tried specifying a user port in the Procfile, and got a different error message:

2012-04-04T07:01:36+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=2000`
2012-04-04T07:01:37+00:00 app[web.1]: Play server process ID is 1
2012-04-04T07:01:40+00:00 app[web.1]: [info] play - database [default] connected at jdbc:mysql://
2012-04-04T07:01:45+00:00 app[web.1]: [info] play - Application started (Prod)
2012-04-04T07:01:45+00:00 app[web.1]: [info] play - Listening for HTTP on port 2000...
2012-04-04T07:01:46+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 2000, should be 47248 (see environment variable PORT)
2012-04-04T07:01:46+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-04-04T07:01:47+00:00 heroku[web.1]: Process exited with status 137
2012-04-04T07:01:47+00:00 heroku[web.1]: State changed from starting to crashed

I have no idea what is happening. How do I change this environment variable? This heroku process model is very confusing to me.

2012-04-04 06:07
by wfbarksdale


I think the problem is that you're not allowing Heroku to specify the port. Googling your error I find:

So instead of doing this:

web: target/start -Dhttp.port=80

Do this

web: target/start -Dhttp.port=$PORT

James has a nice writeup on getting a more advanced Play 2.0 app deployed here.

2012-04-04 09:40
by Jon Mountjoy
THANK YOU!!!!!!!! - wfbarksdale 2012-04-04 15:49