Fork me on GitHub
#babashka
<
2022-04-18
>
nivekuil08:04:37

any chance we could get socat in the babashka docker image?

lispyclouds08:04:54

How do you plan to use it?

lispyclouds08:04:49

In a lot of cases whenever I've felt the need for socat, i got around it by adding a bb script to do stuff on the socket 😄

nivekuil08:04:31

i'm writing a really cool thing, part of whose draw is that I can drop babashka scripts in to do various tasks, service discovery, metrics proxy etc. This one is a hybrid zincati-consul bridge that is a fleetlock server and also bridges the unix socket metrics to http-kit

nivekuil08:04:06

so, I just need to read the socket. (shell/sh "socat" "-" "UNIX-CONNECT:/run/zincati/public/metrics.promsock")

lispyclouds08:04:00

would reading the socket with babashka curl suffice? we ship curl in the image

lispyclouds08:04:51

something like https://github.com/babashka/babashka.curl#unix-sockets and streaming the output might work?

nivekuil08:04:57

I know you can make an http request to a unix socket with curl, dunno about anything lower level than that though

nivekuil08:04:20

right, that example is making an http request. zincati has no http server

lispyclouds08:04:59

yeah its just a scheme that curl needs, inst really important

lispyclouds08:04:09

its essentially talking to the socket

nivekuil08:04:18

well, it's talking to it over http

nivekuil08:04:32

I don't think curl can just do bidirectional byte streams like socat

nivekuil08:04:25

maybe I can just slurp it actually

lispyclouds08:04:17

yeah if it being an in/outputsream suffices would be great

lispyclouds08:04:55

also if we update to graalvm 17 we could enable the unix socket support java.net.Socket in bb. cc @U04V15CAJ

nivekuil08:04:01

yeah I think I need some kind of socket API. socat would be nice though, it's a pretty common tool.. same with netcat

lispyclouds08:04:01

for now having your own derived image should work i guess? we can have a think about this one til then.

1
nivekuil11:04:27

yup, just made a derived image for this. https://github.com/nivekuil/zincati-consul

nivekuil11:04:32

sure beats 2000 lines of go!

Nundrum21:04:30

Is there some special trick to make bb work with vim-fireplace? I had followed the setup here: https://github.com/rwstauner/jirazzz/blob/main/bb.edn It seems I can connect. But I can't evaluate anything.

lispyclouds06:04:42

are you seeing some errors? in :messages ?

Nundrum12:04:15

Yeah. It's just this:

Vim(return):E716: Key not present in Dictionary: "response, 'value', [])"

lispyclouds12:04:03

Not sure, maybe fireplace expects something more out of the nREPL impl we have, could try in #vim? I dont use fireplace but a quick look online seems to not give promising experience with fireplace and bb nREPL

Nundrum13:04:06

I tried #vim already. It's the same nrepl that's in cider, right? Which works fine. I guess I need to open a bug report.

lispyclouds13:04:36

did we try fireplace before @U04V15CAJ, i vaguely remember some conversation long time ago and having issues?

borkdude13:04:09

I think so, else it wasn't added to the book as known working things :)

borkdude13:04:18

but I could remove it ;)

borkdude13:04:30

sorry, I don't know how to work with vim so I can't try it out myself

lispyclouds13:04:05

yeah me too for fireplace, not sure how its implemented

borkdude13:04:35

Maybe best ask in #vim

lispyclouds13:04:34

> It's the same nrepl that's in cider, right? Which works fine is this true for the bb nREPL?

lispyclouds13:04:14

or does cider add in some middleware too?

borkdude13:04:15

I don't understand the question

borkdude13:04:58

yes, bb nrepl works fine in CIDER, Calva, ...

lispyclouds13:04:36

yeah thats why im thinking its something fireplace specific, @U02UHTG2YH5 could you open up an issue in the fireplace repo too?

Nundrum13:04:16

Yeah, it sounds like that is the right place. I'll do that today.