Heroku 的新手在这里。
我已经完成了这里描述的动作:
http://www.playframework.org/documentation/2.0.2/ScalaTodoList
我已经设法在 Heroku 上设置了一个简单的 Play 应用程序。接下来,我尝试通过与之前相同的步骤上传我一直在自己的站点上开发的主应用程序。上传和编译工作正常,但应用程序不断崩溃,代码为 255。以下是日志:
2012-08-21T19:07:29+00:00 heroku[slugc]: Slug compilation started
2012-08-21T19:10:18+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_GOLD resource by heroku-postgresql@addons.heroku.com
2012-08-21T19:10:18+00:00 heroku[api]: Release v2 created by heroku-postgresql@addons.heroku.com
2012-08-21T19:10:18+00:00 heroku[api]: Add DATABASE_URL config by email@gmail.com
2012-08-21T19:10:18+00:00 heroku[api]: Release v3 created by email@gmail.com
2012-08-21T19:10:18+00:00 heroku[api]: Add SBT_OPTS, PATH, REPO, JAVA_OPTS config by b.panait@gmail.com
2012-08-21T19:10:18+00:00 heroku[api]: Release v4 created by email@gmail.com
2012-08-21T19:10:18+00:00 heroku[api]: Release v5 created by email@gmail.com
2012-08-21T19:10:18+00:00 heroku[api]: Deploy 40c5224 by email@gmail.com
2012-08-21T19:10:19+00:00 heroku[slugc]: Slug compilation finished
2012-08-21T19:10:25+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=28820 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-21T19:10:26+00:00 app[web.1]: This application is already running (Or delete the RUNNING_PID file).
2012-08-21T19:10:27+00:00 heroku[web.1]: Process exited with status 255
2012-08-21T19:10:27+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-21T19:10:27+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-21T19:10:30+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=21120 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-21T19:10:31+00:00 app[web.1]: This application is already running (Or delete the RUNNING_PID file).
2012-08-21T19:10:32+00:00 heroku[web.1]: Process exited with status 255
2012-08-21T19:10:32+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-21T19:32:43+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-21T19:32:47+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=35227 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-21T19:32:48+00:00 app[web.1]: This application is already running (Or delete the RUNNING_PID file).
2012-08-21T19:32:49+00:00 heroku[web.1]: Process exited with status 255
2012-08-21T19:32:49+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-21T19:33:09+00:00 heroku[web.1]: State changed from crashed to starting
2012-08-21T19:33:13+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=3275 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-21T19:33:14+00:00 app[web.1]: This application is already running (Or delete the RUNNING_PID file).
2012-08-21T19:33:15+00:00 heroku[web.1]: Process exited with status 255
2012-08-21T19:33:16+00:00 heroku[web.1]: State changed from starting to crashed
我不知道从哪里开始调查这里。主应用程序很大,有一些额外的依赖项并使用数据库。任何帮助表示赞赏。
EDIT1:好的,所以我已经从我的 git 存储库中删除了 RUNNING_PID (从 heroku 中删除它并没有真正起作用:https ://devcenter.heroku.com/articles/ssh-access )。我还将我的 procfile 更新为:
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.h2.Driver
我现在收到以下错误:
2012-08-21T20:24:45+00:00 heroku[slugc]: Slug compilation finished
2012-08-21T20:24:48+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=38558 -Xmx384m -Xss512k
-XX:+UseCompressedOops`
2012-08-21T20:24:51+00:00 app[web.1]: Play server process ID is 2
2012-08-21T20:24:57+00:00 app[web.1]: [←[37minfo←[0m] play - database [default] connected at jdbc:h2:mem:play
2012-08-21T20:24:58+00:00 app[web.1]: [←[33mwarn←[0m] play - Your production database [default] needs evolutions!
2012-08-21T20:24:58+00:00 app[web.1]:
2012-08-21T20:24:58+00:00 app[web.1]: # --- Rev:1,Ups - f9a96e0
...
Copy of the evolution file.
...
2012-08-21T20:24:58+00:00 app[web.1]:
2012-08-21T20:24:58+00:00 app[web.1]: [←[33mwarn←[0m] play - Run with -DapplyEvolutions.default=true if you want to run
them automatically (be careful)
2012-08-21T20:24:58+00:00 app[web.1]: Oops, cannot start the server.
2012-08-21T20:24:58+00:00 app[web.1]: PlayException: Database 'default' needs evolution! [An SQL script need to be run o
n your database.]
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.s
cala:422)
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.s
cala:410)
2012-08-21T20:24:58+00:00 app[web.1]: at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59
)
2012-08-21T20:24:58+00:00 app[web.1]: at scala.collection.immutable.List.foreach(List.scala:45)
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:410)
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
2012-08-21T20:24:58+00:00 app[web.1]: at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59
)
2012-08-21T20:24:58+00:00 app[web.1]: at scala.collection.immutable.List.foreach(List.scala:45)
2012-08-21T20:24:58+00:00 app[web.1]: at play.api.Play$.start(Play.scala:60)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.StaticApplication.<init>(ApplicationProvider.scala:51)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.server.NettyServer$.createServer(NettyServer.scala:132)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:153)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:152)
2012-08-21T20:24:58+00:00 app[web.1]: at scala.Option.map(Option.scala:133)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.server.NettyServer$.main(NettyServer.scala:152)
2012-08-21T20:24:58+00:00 app[web.1]: at play.core.server.NettyServer.main(NettyServer.scala)
2012-08-21T20:25:00+00:00 heroku[web.1]: Process exited with status 255
2012-08-21T20:25:00+00:00 heroku[web.1]: State changed from starting to crashed
EDIT2:好的,我已经想出了如何解决进化问题。只需将 applyEvolutions.default=true 添加到 application.conf 即可自动应用进化。你必须小心这一点,因为如果你在进化中设置了析构函数,它可能会破坏你的数据。