Why isn't my luminus app working on Heroku?

135 Views Asked by At

I'm a complete beginner and following this book: https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/

I followed the instructions about deploying to Heroku from the book and from here: https://luminusweb.com/docs/deployment.html#heroku_deployment but I'm having some issues.

Here is my problem and the steps I've taken. I'm using the source code from guestbook-controllers here and modifying it, just trying to get the app working in Heroku (ie able to make an account, log in and post a message). Here is my repo: https://github.com/johnbradens/guestbook-heroku

Here are my steps:

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

This is what I see when I look at the Heroku app:

Error 1 Error 2

When I run heroku run lein run migrate I get the following error:

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

I tried editing the env/prod/resources/config.edn but I'm not sure what to do with it. I tried a lot of things and none of them worked.

Here's an example of something I tried, in changing the env/prod/resources/config.edn file. One of the links above says to just have {:prod true} so that's what I have right now, but I also tried:

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

EDIT: I found out thanks to the clojure slack that my env folder is being ignored, and to create a prod-config.edn file where I have the above text in that file. I tried pushing to Heroku again and I still get the same errors as in the images on the web app, and I still get the same error message when I run heroku run lein run migrate that the config file is not being found.

What should I do?

1

There are 1 best solutions below

0
JohnBradens On

Ok everyone this is what finally fixed it. I found this in this github post: https://github.com/luminus-framework/luminus/issues/231

it seems that

heroku run lein run migrate

from the documentation is not going to work.

Migration could be done running the generated jar file:

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

Leaving this here in case anyone else has the same issue.