Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 部署到heroku时失败_Scala_Heroku_Playframework - Fatal编程技术网

Scala 部署到heroku时失败

Scala 部署到heroku时失败,scala,heroku,playframework,Scala,Heroku,Playframework,我正在尝试将我的Play应用程序部署到Heroku 不幸的是,我遇到了这个问题: 2016-03-06T14:19:45.939373+00:00 heroku[web.1]: State changed from starting to crashed 2016-03-06T14:19:45.918504+00:00 heroku[web.1]: Process exited with status 255 2016-03-06T14:49:45.477844+00:00 heroku[web

我正在尝试将我的Play应用程序部署到Heroku

不幸的是,我遇到了这个问题:

2016-03-06T14:19:45.939373+00:00 heroku[web.1]: State changed from starting to crashed
2016-03-06T14:19:45.918504+00:00 heroku[web.1]: Process exited with status 255
2016-03-06T14:49:45.477844+00:00 heroku[web.1]: State changed from crashed to starting
2016-03-06T14:49:49.783812+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/todolistscala -Dhttp.port=12681`
2016-03-06T14:49:51.431641+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-03-06T14:49:51.599056+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-03-06T14:49:54.014919+00:00 app[web.1]: [[37minfo[0m] application - Creating Pool for datasource 'default'
2016-03-06T14:49:54.492047+00:00 app[web.1]: [[37minfo[0m] p.a.d.DefaultDBApi - Database [default] connected at jdbc:h2:mem:play
2016-03-06T14:49:57.727928+00:00 app[web.1]: [[33mwarn[0m] application - application.conf @ file:/app/target/universal/stage/conf/application.conf: 348: applyEvolutions.default is deprecated, use play.evolutions.db.default.autoApply instead
2016-03-06T14:49:58.246865+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.247105+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.258404+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.258431+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.258933+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.259062+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.293455+00:00 app[web.1]: [[37minfo[0m] application - ApplicationTimer demo: Starting application at 2016-03-06T14:49:58.259Z.
2016-03-06T14:49:58.294643+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.294826+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.297164+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.297222+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.297271+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - The application secret has not been set, and we are in prod mode. Your application is not secure.
2016-03-06T14:49:58.297976+00:00 app[web.1]: [[31merror[0m] p.a.l.c.CryptoConfigParser - To set the application secret, please read http://playframework.com/documentation/latest/ApplicationSecret
2016-03-06T14:49:58.303328+00:00 app[web.1]: Oops, cannot start the server.
2016-03-06T14:49:58.305408+00:00 app[web.1]: @6pba2k59a: Configuration error
2016-03-06T14:49:58.305742+00:00 app[web.1]:    at play.api.libs.crypto.CryptoConfigParser.get$lzycompute(Crypto.scala:498)
2016-03-06T14:49:58.305830+00:00 app[web.1]:    at play.api.libs.crypto.CryptoConfigParser.get(Crypto.scala:465)
2016-03-06T14:49:58.305890+00:00 app[web.1]:    at play.api.libs.crypto.CryptoConfigParser.get(Crypto.scala:463)
2016-03-06T14:49:58.305953+00:00 app[web.1]:    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
2016-03-06T14:49:58.306059+00:00 app[web.1]:    at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
由于存在涉及
应用程序机密的错误,因此我阅读了以下内容:。但是,我不明白如何将密钥发送到服务器环境而不在本地计算机上

但无论如何,我不确定没有
应用程序机密是问题的实际原因,因为服务器无法启动(我假设即使没有
应用程序机密
,服务器也可以启动)


失败的原因是什么?

您应该将应用程序机密设置为Heroku上的环境变量。这样,它将只对应用程序环境可用,并且在必要时无需重新部署即可轻松更改

您可以将标志添加到
程序文件中

web: target/universal/stage/bin/todolistscala \
-Dhttp.port=12681 \
-Dplay.crypto.secret=${APPLICATION_SECRET}
上面是为了更好的可视化,但是
Procfile
无法处理每个进程的多行。应该是这样的:

web: target/universal/stage/bin/todolistscala -Dhttp.port=12681 -Dplay.crypto.secret=${APPLICATION_SECRET}
然后设置环境变量
APPLICATION\u SECRET
。您可以通过Heroku web界面或使用Heroku工具带执行此操作:

heroku config:set APPLICATION_SECRET="thisisthesecretpleasechangeit" -a your-app-name

通常,所有重要凭据(数据库、缓存服务器、API密钥)都应以这种方式存储在应用程序环境中。

我创建了
Procfile
,设置了环境变量并提交了
Procfile
。但是,我推的时候还是会出现同样的错误。你是在使用Play2.5还是2.4?2.3或更早版本使用
application.secret
而不是
play.crypto.secret
。现在我想起来了,
Procfile
必须是一行,所以如果你复制/粘贴了我所拥有的内容,它将忽略其他行。是的,我正在使用Play
2.5.0
并将命令放在一行上,但仍然遇到相同的问题。也许可以尝试在
${APPLICATION\u SECRET}
周围加上引号?我使用的是命令行标志,因此我不知道它是如何工作的,除非拼写错误和缺少字符。您的
应用程序.conf
的内容是什么?