Heroku app failing with code 255

2019-04-10 20:03发布

Newbie to Heroku here.

I've gone through the motions described here:

http://www.playframework.org/documentation/2.0.2/ScalaTodoList

And I've managed to set up a simple Play app on Heroku. Next up, I've tried uploading my main application which I've been developing on my own station, by going through the same steps as earlier. Uploading and compilation worked, however the app keeps crashing with code 255. Here is are the logs:

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

I have no idea where to start investigating here. The main app is quite large, has some extra dependencies and uses a database. Any help is appreciated.

EDIT1: Ok, so I've deleted RUNNING_PID from my git repository (deleting it from heroku doesn't really work: https://devcenter.heroku.com/articles/ssh-access). I also updated my procfile to:

web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.h2.Driver

I am now getting the following errors:

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: Ok, I've figured out how to fix the problem with the evolutions. Simply add applyEvolutions.default=true to application.conf and the evolutions will be applied automatically. You have to be careful with this as it can destroy your data if you have destructors set up in your evolutions.

1条回答
趁早两清
2楼-- · 2019-04-10 20:41

As Alper rightly suggested, try adding -Dplay.evolutions.db.default.autoApplyDowns=true to your Procfile.

It fixed it for me.

查看更多
登录 后发表回答