Play Framework 2.1.1部署问题

Mik*_*ins 6 java playframework-2.0 playframework-2.1 playframework-evolutions

所以,我正在尝试部署我非常简单的Play Framework 2.1.1应用程序,但每当我通过端口命令行传递标志并应用数据库演变时,它们都会被忽略.

例如:

sudo play start -Dhttp.port = 80 -DapplyEvolutions.default = true

使用此命令,服务器将无法启动.port和applyEvolutions = true标志都被完全忽略,它会抛出此错误:

[warn] play - 你的生产数据库[默认]需要进化![warn] play - 运行-DapplyEvolutions.default = true如果你想自动运行它们(小心)哎呀,无法启动服务器.@ 6elhl9mca:数据库'默认'需要进化!

我已经尝试了所有我能想到的无济于事的东西.在我的本地机器上使用Play Run工作正常,没有问题.服务器正在运行Ubuntu 12.04.所有正确的驱动程序和连接字符串都存在并经过测试,数据库正在运行,除了Play Framework之外,一切正常运行.

Jam*_*per 10

play "start -Dhttp.port=80 -DapplyEvolutions.default=true"
Run Code Online (Sandbox Code Playgroud)

要么

play dist
Run Code Online (Sandbox Code Playgroud)

然后,解压缩并运行生成的启动脚本,

./start -Dhttp.port=80 -DapplyEvolutions.default=true
Run Code Online (Sandbox Code Playgroud)

将工作.

  • 这很好,谢谢.我最大的问题是文档中的这种详细程度很少.谢谢你. (2认同)

Mik*_*ins 6

Ok, so I didn't really find a solution for this, but I found a workaround. This isn't anywhere in the Play Framework 2.x documentation (yet), so I figure I'll put it here in case someone else gets stuck:

Putting applyEvolutions.default=true into application.conf DOES work, and will make database evolutions apply automatically. The command line argument -DapplyEvolutions.default=true DOES NOT work and is ignored for reasons unknown.

Putting http.port=80 into application.conf DOES NOT work. The command line argument -Dhttp.port=80 also DOES NOT work for setting the port number to run on.

So, to set the port number use this command instead:

play "start 80" or play "run 80" (use double quotes exactly as shown).

For some reason when the port command is written exactly as above in double quotes, the port number to run on is set properly.

这在任何地方的框架文档中都找不到.我创建了另一个拉取请求来添加它,但我为此框架解决的最后一个问题(数据库加密)被拒绝为仅限于"有限的利基用例",因此文档更新被拒绝.反正我还是可以试试.

希望这有助于某人.