A Heroku build pack for Clojure using tools.deps with some special tricks to speed up deployment without uberjars.
Why not uberjars?
- it's extra work and operational activities that need to be created, maintained and could go wrong
- after you get it working, are you 100% sure that the CLASSPATH with an uberjar is the same as it is without it?
- did you test against the uberjar or the unpacked code?
- we have a LISP, don't do this to yourself
- And no it doesn't need Docker
On that last point, the Heroku way is kind of like Docker: it builds your program and creates an image for deployment. This buildpack is a way to provide that image with all the needed Clojure tools. Now with some extra tricks cos we know Heroku and we know Clojure.
The tricks enable you to use the build phase to compile your ClojureScript and pull in all the dependencies for your server.
This means that you can use simple aliases in deps.edn
that match the way that you develop rather than outsouring the build to complicated external build processes. Assuming you can ignore that Heroku is a complicated external build process :)
Please read the standard Heroku docs for preparing apps.
Create a Procfile
in the root of your project to define which alias(es) will be used at startup
web: clojure -M:my-alias-list
You may specify one or more aliases to run during the compile
phase of the deployment using a config var
ℹ️ This is how you can compile your ClojureScript app and make sure its always fresh.
heroku config:set BUILD_ALIASES=":alias1:alias2"
You may specify one or more aliases to run during the compile
phase of the deployment using a config var
ℹ️ This is how you can ensure that your server dependencies are on your CLASSPATH and don't need to be downloaded again when you try to start the server.
One simple test that triggers the server dependency is all that is needed here. No biggieif you have more tests.
heroku config:set TEST_ALIASES=":alias1:alias2"
ℹ️ Main win: any artefacts built or dependencies downloaded during the compile
phase will be available at deployment.
Heroku uses JDK 8 by default.
Here is a link to the very specific the Heroku Java support doc for how this can be changed