在Heroku上部署Play 2.0应用程序

时间:2012-04-04 06:07:50

标签: heroku bind playframework-2.0

所以我对设置服务器有点新意。我整晚都在努力解决各种SQL问题。我认为我和成功运行的播放应用程序之间唯一的问题是:错误

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://us-cdbr-east.cleardb.com/heroku_cd914b667dae168
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]: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
... more errors

有没有人发现任何问题?我需要任何java选项参数吗?

我尝试在Procfile中指定用户端口,并收到不同的错误消息:

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://us-cdbr-east.cleardb.com/heroku_cd914b667dae168
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

我不知道发生了什么。如何更改此环境变量?这个heroku流程模型对我来说非常混乱。

1 个答案:

答案 0 :(得分:5)

我认为问题在于你不允许Heroku指定端口。谷歌搜索你的错误我发现:https://devcenter.heroku.com/articles/error-codes#r11__bad_bind

所以不要这样做:

  

web:target / start -Dhttp.port = 80

这样做

  

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

詹姆斯写了一篇关于部署here更高级Play 2.0应用程序的精彩文章。

相关问题