【问题标题】:Why isn't my luminus app working on Heroku?为什么我的 luminus 应用不能在 Heroku 上运行?
【发布时间】:2021-11-18 13:29:15
【问题描述】:

我是一个完整的初学者并关注这本书:https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/

我按照书中和这里关于部署到 Heroku 的说明进行操作:https://luminusweb.com/docs/deployment.html#heroku_deployment,但我遇到了一些问题。

这是我的问题和我已采取的步骤。我在这里使用来自留言簿控制器的源代码并对其进行修改,只是试图让应用程序在 Heroku 中运行(即能够创建帐户、登录并发布消息)。这是我的仓库:https://github.com/johnbradens/guestbook-heroku

这是我的步骤:

git init
git add .
git commit -m "initial commit"
I added a bin/build file and ran chmod u+x bin/build (based on instructions from https://folcon.github.io/post/2020-04-12-Fulcro-on-Heroku/, because it was saying that react wasn't installed)
I added heroku buildpacks nodejs & clojure (otherwise it said it couldn't read the npm from bin/build)
heroku addons:create heroku-postgresql
git push heroku main

这是我在查看 Heroku 应用程序时看到的:

Error 1 Error 2

当我运行heroku run lein run migrate 时出现以下错误:

Syntax error compiling at (/tmp/form-init6415984187052473661.clj:1:73).
could not find a non empty configuration file to load. looked in the classpath (as a "resource") and on a file system via "conf" system property

我尝试编辑env/prod/resources/config.edn,但我不确定如何处理它。我尝试了很多东西,但都没有奏效。

这是我尝试更改 env/prod/resources/config.edn 文件的示例。上面的链接之一说只有{:prod true},所以这就是我现在所拥有的,但我也尝试过:

{:prod true
 :port (System/getenv "PORT")
 :database-url (System/getenv "JDBC_DATABASE_URL")
 }

编辑:感谢 clojure 松弛,我发现我的 env 文件夹被忽略,并创建了一个 prod-config.edn 文件,我在该文件中有上述文本。我尝试再次推送到 Heroku,但仍然收到与 Web 应用程序上的图像相同的错误,当我运行 heroku run lein run migrate 时仍然收到相同的错误消息,即找不到配置文件。

我该怎么办?

【问题讨论】:

    标签: postgresql heroku clojure luminus


    【解决方案1】:

    好的,这就是最终修复它的原因。我在这篇 github 帖子中找到了这个:https://github.com/luminus-framework/luminus/issues/231

    好像

    heroku run lein run migrate
    

    从文档中看是行不通的。

    可以通过运行生成的 jar 文件来完成迁移:

    heroku run java -cp target/uberjar/<app name>.jar clojure.main -m guestbook.core migrate
    

    把这个留在这里,以防其他人有同样的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-26
      • 2013-08-08
      • 2012-05-18
      • 2021-09-12
      • 2018-07-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多