Fork me on GitHub
#heroku
<
2021-09-24
>
John Bradens19:09:49

I've been following the book Web Development with Clojure 3rd edition and trying to deploy the app to Heroku. I got the app to show up on Heroku, but I can't figure out how to make the database work. Meaning I just see "loading messages..." on the home page and cannot log in or anything. I added the postgres plug-in following the steps from the book. Any advice? What changes do I need to make to my config file? I am also trying to run `heroku run lein run migrate` but having issues. It says it can't find a non empty config file, but I do have a dev-config.edn, probably with outdated/incorrect info in it.

Ted Ciafardini20:09:50

It’s been a year….so you probably figured this out or gave up…..but for anyone else: run this from terminal: heroku run java -cp target/uberjar/you-project-name.jar clojure.main -m your-project-name.core migrate

Ted Ciafardini21:09:07

For the postgres connection question, you need to add the following to your config.edn file in the root dir:

{:prod true
 :port 5432 
 :database-url (System/getenv "DATABASE_URL")}
That will grab the database URL from in heroku, more info here: https://devcenter.heroku.com/articles/heroku-postgresql