This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-07
Channels
- # announcements (7)
- # asami (3)
- # aws-lambda (2)
- # babashka (10)
- # beginners (30)
- # bristol-clojurians (3)
- # calva (13)
- # cider (26)
- # clj-kondo (6)
- # clojure (172)
- # clojure-europe (30)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-serbia (9)
- # clojure-uk (64)
- # clojurescript (76)
- # conjure (9)
- # cursive (46)
- # data-science (1)
- # datomic (6)
- # emacs (13)
- # etaoin (1)
- # fulcro (27)
- # girouette (4)
- # jobs (1)
- # joker (2)
- # lsp (7)
- # malli (19)
- # meander (47)
- # off-topic (123)
- # pathom (6)
- # reitit (3)
- # remote-jobs (7)
- # reveal (37)
- # ring-swagger (2)
- # shadow-cljs (60)
- # specter (5)
- # startup-in-a-month (3)
- # tools-deps (21)
- # vim (4)
Hi! Is there a known pattern in tools.deps for loading/running multiple processes in parallel, like CLJS-build, SASS build, reloadable CLJ-system?
Perhaps your looking for something like https://devcenter.heroku.com/articles/procfile?
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.
the Clojure CLI runs one program
if you want to run multiple things, then you need to make something that does that
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.
@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))
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.
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.
Welcome to the future @borkdude! 🙂