Fork me on GitHub
#luminus
<
2021-09-08
>
Chase18:09:04

I see that the luminus docs include instructions on how to deploy to Heroku. Do those instructions apply to the frontend as well? I want to create a full stack app with re-frame and shadow-cljs on the frontend. Do I follow the shadow-cljs instructions for building a release build as well as the clojure side instructions for Heroku and it'll all work? Since Heroku has a postgres setup and the instructions include directions for that, when building my Luminus template, can I just use the +postgres addon and it should work as detailed? So the full app creation would be lein new luminus my-app +reitit +re-frame +shadow-cljs +postgres . Any other advice I should know about deploying such an app?

Chase18:09:34

It was mentioned in the #clojure channel that including shadow-cljs and npm did not work with the heroku build packs so he had to create a Docker image and push that instead. But I don't think he was using luminus and I'm not sure if luminus is using those default build packs or has figured out their own approved approach to such things

javahippie18:09:25

Hi, again 😉 I did in fact use Luminus. After a little googling, it seems other people faced similar problems with shadow-cljs on Heroku Maybe this is also interesting to you: https://clojureverse.org/t/deploying-to-heroku-dependencies-of-npm-packages-not-getting-installed-when-deploying-app/4441

javahippie18:09:51

In this post, a custom build script is created for use on Heroku (although it’s fulcro): https://folcon.github.io/post/2020-04-12-Fulcro-on-Heroku/

Chase18:09:25

Ahh ok, I'll check these out. Thanks for following me in here. haha

Chase18:09:41

That first one used Docker too it seems . The second one might work but this is all looking a bit hairy for my current dev ops skills. But that's how we learn I guess. I'm jealous of like the Next.js folks just using Vercel and calling into something like Supabase for auth and db needs. Seems way easier (but is it simpler...)

javahippie19:09:22

Had some time on my hands and tried it. I created a new luminus app with your proposed command from above: lein new luminus my-app +reitit +re-frame +shadow-cljs +postgres and pushed it to Heroku

javahippie19:09:11

So for the default without doing anything it definitely fails

javahippie19:09:33

I then tried to add the npm buildpack and clojure buildpack together, but I get the same error:

Chase19:09:52

Hmm, ok. I'm over here still trying to get that template running with my postgres credentials. That's also kind of new to me. lol

Chase19:09:26

I feel like the process will be building out the frontend using the shadow-cljs instructions and then matching that with heroku's js instructions since then it will be js?

Chase19:09:33

Oh wait, that looks like what you are trying

javahippie19:09:44

There seems to be an issue in the template, when I lein uberjar a freshly created application locally on my machine, I get the same errors

Chase19:09:29

yeah same here.

javahippie19:09:33

The struct 1.4.0 version is quite old, so I guess there is a transient dependency which is a problem

Chase19:09:57

Yeah, I removed the whole cljc directory and it compiles fine

Chase19:09:18

I'm still having stupid postgres authentication errors over here though. In my limited experience I've found that whole thing brittle too but it seems to be well loved so that's definitely user error on my part

javahippie19:09:13

Want to share your (anonymized, obfuscated) DB config?

javahippie19:09:16

Got the compile error, though. The latest luminus-template includes funcool/cuerdas as a dependency. This is also a transient dependency of funcool/struct, and there is a conflict

Chase19:09:13

Ahh. For the DB stuff I'm getting a password authentication error so trying to work through that.

Chase19:09:58

I probably didn't set it up correctly. I've never actually used postgres before.

javahippie19:09:19

I usually run it locally on Docker so I don’t have to install it on the system directly…

Chase19:09:38

Yeah, the universe seems to be telling me to learn some Docker basics today

javahippie19:09:22

If it helps: docker run -p 5432:5432 --name db-name -e POSTGRES_PASSWORD=mypass -d postgres:12.2

Chase23:09:54

I got the db thing cleared up but haven't gotten it deployed successfully yet.

Chase23:09:20

The error I am getting:

Chase00:09:07

I took some of the instructions from that fulcro deployment guide and built a bin/build file with the following:

#!/usr/bin/env bash                                                                                                       
npm install                                                                                                               
npx shadow-cljs release app                                                                                               
lein uberjar  

👍 2
Chase00:09:36

Everything else seems to follow from the rest of the luminus and/or heroku clojure deployment docs