3

I have a template of a clojurescript application from https://github.com/Day8/re-frame-template. So I want to deploy that template without any modifications to Heroku. So I followed the instructions on the README lein clean lein cljsbuild once min. Then I follow the instructions on Heroku as well on deploying clojure on https://devcenter.heroku.com/categories/clojure-support

But when I check if the application runs all I get is an application error. So my questions are:

  1. How does one build and deploy a clojurescript app to heroku?
  2. What is the difference in deploying a clojurescript app vs a clojure app
  3. Do I need a clojure server in order to run clojurescript?
  4. How does one even run a standalone clojurescript app on the desktop?
  5. How is the generated app.js related to running a clojurescript app?

I have found it pretty easy to deploy and run a clojure app on Heroku as well as a standalone applicaton on my desktop, I was hoping the same would be true for clojurescript.

Edited: The error is here: https://floating-depths-33030.herokuapp.com/

5
  • Show that application error. Commented Jul 16, 2018 at 11:12
  • jkutner.github.io/2015/10/14/clojurescript-on-heroku.html Commented Jul 16, 2018 at 13:53
  • 1
    You'll need to serve it somehow - so for Heroku you'll have more luck if you use Luminus with re-frame. Commented Jul 16, 2018 at 14:45
  • It worked with luminus +re-frame Commented Jul 16, 2018 at 18:27
  • @KevinKamau if you expand that slightly and post it as an answer it will help people who land here later searching for how to run clojurescript on heroku Commented Jul 18, 2018 at 18:14

2 Answers 2

1

To clear the topic for future people finding heroku + clj/cljs, following is a list of working examples. The clojure support on heroku means you can have Clojure webapp deployed. But cljs (like re-frame) actually is pure javascript, have nothing to do with heroku clojure support.

https://github.com/kawasima/back-channeling

https://github.com/zerg000000/table-tmpl

Sign up to request clarification or add additional context in comments.

Comments

0

To deploy a re-frame application to Heroku one needs a clojure server, this is where ring comes in. In order to add ring one needs to add +handler while creating a new re-frame project as so:

lein new re-frame <project-name> +handler

This will create a project with a configuration that allows it to be deployable to Heroku.

Steps to deploy to Heroku:

  1. lein clean
  2. lein with-profile prod uberjar
  3. git init
  4. git add .
  5. git commit -m "first commit"
  6. git push heroku master
  7. heroku ps:scale web=1
  8. heroku open

This is application is now readily accessible.

1 Comment

Your answer has nothing to do with the original question, which was about ClojureScript application - not specific to re-frame or ring. Besides your answer can be confusing - as the question was about ClojureScript, Ring gives you Clojure web server. Web servers can be done in pure ClojureScript (JavaScript)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.