Hi! Is there a known pattern in tools.deps for loading/running multiple processes in parallel, like CLJS-build, SASS build, reloadable CLJ-system?
the Clojure CLI runs one program
if you want to run multiple things, then you need to make something that does that
Perhaps your looking for something like https://devcenter.heroku.com/articles/procfile?
@ingesol We use this (bb) script at work for launching these three things at once:
#!/usr/bin/env bb
(ns dev)
(require '[babashka.process :refer [destroy-tree process]])
(def opts {:out :inherit
:err :inherit
:shutdown destroy-tree})
(defn cljs []
(process ["clojure" "-Sforce" "-M:frontend:cljs/dev"] opts))
(defn less []
(process ["clojure" "-Sforce" "-M:frontend:less/dev"] opts))
(def platform-alias
(case (System/getProperty "os.name")
"Linux"
"backend/linux"
"Windows"
"backend/windows"
"Mac OS X"
"backend/macosx"))
(defn clojure []
(process ["clojure" "-Sforce"
(str "-A:backend:backend/dev:" platform-alias)
"-X" "dre.standalone/start"]
(assoc opts :in :inherit)))
(cljs)
(less)
(-> @(clojure) :exit (System/exit))
Thanks! That is one option, yes. I was mostly wondering if this was a common problem with well known patterns for people who use tools.deps.
That is lovely, thanks
Right, that’s what I suspected. I also was hoping that the community had established some patterns for solving this kind of problems. My first idea was to just create a CLJ-script that I could invoke from the CLI, that would simply start those processes. @borkdude provided a bb-technique below, I suppose that is preferable to a JVM script as it leans on OS features for shutdown.
or at least it seems that the bb-script saves me from having to think about graceful shutdown.
does anyone have an example of using -J
to pass JVM options from the command line in conjunction with -M
? I can get it to work if I put :jvm-opts
into deps.edn
directly but I’d rather these be specified by people at the command line, and can’t figure out how to do that
you just -J-Dfoo=bar
on the command line
what did you try?
-J
must come before -M
(otherwise it will be treated as a command-line arg to what you are running).
aha, that was it, and I guess multiple options need -J
multiple times
tired putting everything into one quoted string and that wasn’t working
as the docs state 😆
anyways, thanks to both of you
Our projects at work are now fully deps.edn-ized, no more boot. Migration complete.
Welcome to the future @borkdude! 🙂
you work on top of all your opensource stuff!? I figured you'd be FT open source by now!!
if I got paid to do full time open source, I maybe would. but currently I get sponsored for about 1/5th - 1/4th of what I would need to make that jump. even then, I do like to be grounded in "reality" to get a feel for what the real problems are.