This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-04
Channels
- # announcements (4)
- # aws (3)
- # babashka (58)
- # beginners (59)
- # biff (6)
- # cider (3)
- # clj-kondo (48)
- # clj-on-windows (1)
- # cljdoc (1)
- # clojure (136)
- # clojure-europe (19)
- # clojure-gamedev (7)
- # clojure-germany (2)
- # clojure-nl (7)
- # clojure-norway (1)
- # clojure-portugal (1)
- # clojure-uk (4)
- # clojurescript (41)
- # community-development (2)
- # core-async (5)
- # cursive (10)
- # data-oriented-programming (1)
- # data-science (1)
- # datahike (5)
- # datomic (60)
- # docker (2)
- # emacs (13)
- # figwheel-main (19)
- # fulcro (12)
- # graalvm (9)
- # holy-lambda (41)
- # honeysql (14)
- # introduce-yourself (3)
- # jobs (4)
- # lsp (11)
- # nrepl (1)
- # off-topic (9)
- # other-languages (2)
- # pathom (22)
- # portal (5)
- # re-frame (17)
- # remote-jobs (4)
- # reveal (14)
- # shadow-cljs (1)
- # tools-build (7)
- # tools-deps (47)
- # xtdb (8)
- # yada (2)
Any advice for using bb tasks to run my backend server? I saw this old https://clojurians.slack.com/archives/CLX41ASCS/p1618303880104300 and wonder if anything has changed since then. I have a task that launches my server now. I'd like to run it in the background, have the ability to monitor and kill it, and send the logs to some text files.
Can you give more context about what is currently missing in bb? I don't understand the question
Sure. It's probably not something missing from bb but just a gap in my understanding.
• I can launch the background process using process
. What is the best way to kill it at that point? Find the PID and kill
it as usual, or is there a more idiomatic approach?
• Is there something in the API that I should use to redirect stdout/stderr to files, or is it just including the usual Nevermind, this looks like something I'd do with &> foo.log
as part of the process
command?process
's :out :append, :out-file ..., :err-file ...
.
@UPWHQK562 you can kill a process by calling destroy
on it
But it's a server process that should remain up indefinitely. So once I start it with bb server:run
, I'm no longer controlling it with Clojure, right?
Okay @borkdude, I think my questions might just be too general. I'll keep experimenting with it. Thanks for your time.
Hi there, I am trying neil
for the first time and did this:
clojure -Ttools install io.github.babashka/neil '{:git/tag "v0.0.28"}' :as neil
And then
clojure -Ttools list
TOOL LIB TYPE VERSION
neil io.github.babashka/neil :git v0.0.28
tools io.github.clojure/tools.tools :git v0.2.0
but this does not work
clojure -Tneil dep search "babashka.nrepl"
Function not found: babashka.neil.api/dep
Am I missing something?@richiardiandrea If you are using babashka, then I recommend installing the bb script rather than using it as a clj tool
@borkdude yeah we can't do that at the moment - not every dev machine has got babashka
(it's not a "required" dev tool)
Hey @richiardiandrea
I deprecated the tools usage now. Just use the -m
main entrypoint. It doesn't make sense to me to maintain two different entrypoints.
So going forward, I recommend using this:
https://github.com/babashka/neil#clojure
And there will never be any incompatibilities
Ok sounds good, unfortunately this means for us no babashska for now but I totally understand
@richiardiandrea I don't understand your reasoning
Oh wait, sorry yeah I just realized there is no dependency on the babashka
cli
is there?
no, but even if there was, why would that be a reason for not using babashka? like: we would use babashka, but now we're not. eh, why? :)
you can use neil from bb and clojure, but the command line interface is the same, that was the point I was trying to make
Oh I see what you are saying. Basically in our case we are not "using it" officially yet for scripts but I am trying to push for it.
Neil was an attempt to automate a couple of tasks but because not every dev machine has got bb
we wanted to use the Clojure CLI
I hope this makes sense even if it doesn't too much to me lol 😄
yes, tl;dr, you can use the clojure CLI, you don't need the bb binary to run neil :)
just read the link I sent and it should explain itself, feel free to bother me if it doesn't
yep I just did and I will try it out
ok sounds good
That's this namespace: https://github.com/babashka/neil/blob/main/src/babashka/neil/api.clj
So, we've added a generic :pre-start-fn
to babashka process, which thus also works in shell
:
{:tasks {:init (defn print-command [{:keys [cmd]}]
(apply println cmd))
hi (shell {:pre-start-fn print-command} "echo hi")}}
$ bb hi
echo hi
hi
Should we do anything else to make printing the command in shell
"easier" or is this sufficient?Sorry to post a chunk of code but we might use :pre-start-fn
sometimes instead of relying on this big global thing here that does that:
Haha you caught me! Exactly, this would be sufficient for our current use, for sure!! 🎉
The best thing is the bb.edn
addition is really all I had to do! There's probably more changes to make down the road (towards what it would look like if we'd started with babashka), but it's very cool that a big wad of JVM Clojure is (often) that easy to babashka-fy!
does the image includes babashka, or babashka is just being used to build the image?
still thinking about whether / how to do an official babashka image, and if one is even needed when the excellent babashka/babashka
images already exist
I'm thinking it could be useful to have it right away on the image, but not sure since babashka updates so often, and is also so easy to install
yeah, and it's also often all you need (i.e. you don't need any of the other clojure stuff; jvm, jre, lein, clojure cli, boot, etc.). and currently the official clojure images are all kind of based on the notion that you need some of those things. 🙂 but I'm happy to rethink it if it makes sense at some point.
there's also clojuredart that might need an official image at some point, so there's potentially a bigger rethink coming anyway...
I could imagine perhaps we start by including bb in our latest
image, b/c that's already kind of the kitchen sink, every-battery-is-included image
:thinking_face:
@borkdude what do you think? do you see a role for an official clojure babashka image? or would that feel needlessly duplicative?
yeah, I don't either haha
me neither, but a light opinion that would be nice to have it there already 🫠
@U066U8JQJ as in, already installed in all of the official images (or some logical subset of them)?
then I dunno, haha
fair enough. I get it, I want babashka in all the places too 😆. but some users of the official images want them as tiny as possible. so we have to strike a balance.
and of course you only hear from the folks that want to add things until you add them... and then you hear from those other folks. a lot. 😅
in this consideration, how big is babashka? its big enough for people to note/care about?
for me: no. it's easily worth it. for those who will complain at me: yes, everything they don't use is too big haha
another possibility I would entertain is (in part because the babashka/babashka
image is so minimal; no java, no clojure cli, etc.) to release variants of the tools-deps images that also add babashka. for those who want both sets of tools / runtime environments. for e.g. those who use bb as dev tooling ala make.