Heroku 上的 spray 应用程序:无法找到从 stage 命令创建的脚本

spray app on Heroku: not able to find script created from stage command

第一次在 spray/scala 尝试,我在 Heroku 上遇到部署错误

这是 sbt clean compile stage 运行 成功后本地目标目录的内容

Anadis-MacBook-Pro:mail-service anadi$ cd target/universal/stage/bin/
Anadis-MacBook-Pro:bin anadi$ ls -ltr
total 40
-rw-r--r--  1 anadi  staff   4877 Feb  3 19:10 mail-service.bat
-rwxr--r--  1 anadi  staff  10973 Feb  3 19:10 mail-service

& 我能够在本地

启动从 spray-github 克隆的喷雾应用程序
19:18:14 web.1  | started with pid 46761
19:18:20 web.1  | [INFO] [02/03/2015 19:18:20.367] [on-spray-can-akka.actor.default-dispatcher-4] [akka://on-spray-can/user/IO-HTTP/listener-0] Bound to localhost/127.0.0.1:8080

但在 Heroku 上失败

2015-02-03T13:46:07.695518+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/mail-service`
2015-02-03T13:46:09.308482+00:00 app[web.1]: bash: target/universal/stage/bin/mail-service: No such file or directory

更新

运行 heroic run bash @n1r3

建议
heroku run bash
Running `bash` attached to terminal... up, run.3163
~ $ pwd
/app
~ $ ls -ltr
total 32
-rw------- 1 u57873 57873   23 Feb  3 13:41 system.properties
drwx------ 4 u57873 57873 4096 Feb  3 13:41 src
-rw------- 1 u57873 57873  657 Feb  3 13:41 build.sbt
-rw------- 1 u57873 57873  317 Feb  3 13:41 UPDATING.md
-rw------- 1 u57873 57873 1581 Feb  3 13:41 README.markdown
-rw------- 1 u57873 57873   45 Feb  3 13:41 Procfile
drwx------ 4 u57873 57873 4096 Feb  3 13:42 project
drwx------ 4 u57873 57873 4096 Feb  3 13:45 target

~ $ ls -ltr target/universal/stage/     
total 8
drwx------ 2 u57873 57873 4096 Feb  3 13:44 lib
drwx------ 2 u57873 57873 4096 Feb  3 13:44 bin

~ $ ls -ltr target/universal/stage/bin/
total 20
-rw------- 1 u57873 57873  5020 Feb  3 13:44 scala_buildpack_build_dir.bat
-rwx------ 1 u57873 57873 10986 Feb  3 13:44 scala_buildpack_build_dir

因此脚本名为 scala_buildpack_build_dir,而 Heroku 期望脚本名为 mail_service。我在配置中遗漏了什么吗?

我认为你需要在 build.sbt 文件中设置 name=。

我也一直在努力使用 Heroku 中的新 Spray-can/spray/akka 应用程序,发现大部分文档都是一堆历史信息。

我现在已经成功部署了我的应用程序(终于!)。我正在使用:

  • sbt 0.13.6,
  • scala 2.10.4,
  • sbt-native-packager 1.0.0-M4
  • git1.9.5
  • Heroku 工具带 3.25.0
  • Java1.8

在你的 project/plugins.sbt 你想要:

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-M4")

在project/build.properties:

sbt.version=0.13.6

在你的根 build.sbt 你想要的,以及正常的东西:

name := "myserver" enablePlugins(JavaAppPackaging)

不要试图使用 enablePlugins(AkkaAppPackaging) - 它会生成一个非常不同的 shell 脚本,你会得到一个 'akka main class' not found 错误。

在根 Procfile 中:

web: target/universal/stage/bin/myserver

澄清一下,这个 Procfile 的意思是 "run the shell script target/universal/stage/bin/myserver to start my web server"。如果您在本地 运行 "sbt compile stage",您可以在本地查看脚本的副本。你也可以像上面那样使用 bash 来查看在 Heroku 服务器上生成的版本。

1.0 sbt 原生打包器似乎会自动找到您的 Web 服务器入口点并将其作为默认值放入 shell 文件中,因此您不需要将其添加到 Procfile 的末尾。也就是说,你不需要需要:

web: target/universal/stage/bin/myserver web.Main