【问题标题】:Does Play Framework 2.3 work on Heroku?Play Framework 2.3 可以在 Heroku 上运行吗?
【发布时间】:2014-08-10 02:48:46
【问题描述】:

我尝试按照http://www.playframework.com/documentation/2.3.x/ProductionHeroku 中的说明将 Play Framework 2.3.0 应用部署到 Heroku。

我的简单应用程序在本地运行没有任何问题,并且推送/部署到 Heroku 没有显示任何错误迹象。

推送日志结束:

[…]
-----> Building runtime environment
-----> Discovering process types
       Procfile declares types -> (none)

done, 11.0MB
done, v4
       http://xxxxxxxxxxx.herokuapp.com/ deployed to Heroku

To git@heroku.com:xxxxxxxxxxx.git
   f1c57d6..6bb0df3  master -> master
updating local tracking ref 'refs/remotes/heroku/master'

当我打开网页时,我得到 Heroku 的“应用程序错误”页面(不是 Play 的错误页面)。

如果我运行heroku ps,则没有列出任何进程(什么都没有)。

这是我第一次部署 Heroku。由于从 2.3 起从 play 命令更改为 activator,我不知何故觉得 Heroku 不知道如何启动 Play 应用程序。

还有一件事:我注意到,在 Heroku Dashboard > App > Settings > Info 上显示“Framework: Node.js”,这有点奇怪,尽管我在项目中使用了 Bower。

有什么想法吗?非常感谢!

更新: 实际问题是 Heroku 认为我的应用程序是 Node.js 应用程序,只要我的存储库中有 package.json 文件,就不会编译任何内容。一旦我删除它并将所有依赖项(bower_components 目录)提交到存储库,一切都很好。我现在必须找到一种方法来运行 Bower 更新并在推送时编译 Play Framework...

【问题讨论】:

  • 你可以用heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-scala.git专门设置play framework build pack,然后你应该可以恢复你的package.json文件

标签: heroku playframework-2.3


【解决方案1】:

日志是否提供任何有用的信息?运行 heroku logs -t -a <app_name> 以在部署或启动应用程序时查看日志。您是否定义了 Procfile?

一些方便的文档链接:

【讨论】:

  • 似乎没有进程在运行。一切似乎都很好(“Slug compilation finished”等),但随后在日志中:2014-06-19T13:48:35.803786+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=.......
  • 该消息表明您根本没有 Procfile,可能是没有指定 web 的 Procfile,或者您根本没有启动 web dyno:$ heroku ps:scale web=1 -a <app_name>
  • 我一定错过了这一点,因为这在文档中的“连接到数据库”下有所描述。我现在创建了一个Procfile,其内容如下:web: target/universal/stage/bin/FILENAME -Dhttp.port=${PORT},但日志显示bash: target/universal/stage/bin/FILENAME: No such file or directory。当我在本地运行play clean stage 时,我得到一个target/universal/stage/bin/FILENAME,它的名称与我的Procfile 中的名称完全相同。当我登录 (heroku run bash) 时,我应该能够找到这个文件吗?因为根本没有target目录。
  • FILENAME 应该是你的 git repo 的文件夹名称,小写。我相信heroku run bash 使用一次性测功机(而不是您的网络测功机)。
【解决方案2】:

使用heroku-buildpack-multi

.buildpacks 文件的内容应如下所示:

https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-scala

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多