Fork me on GitHub
#babashka-sci-dev
<
2021-10-22
>
Eugen16:10:23

thanks @borkdude. @rahul080327 - I was looking at https://github.com/lispyclouds/contajners and wondering what would take to make it work with babashka. It seems that JDK 16 added support for java unix sockets and JDK 11 added a new HTTP client. Using those instead of java libraries would make contajners easier to port to bababshka and probably easier to maintain (no dependencies)

Eugen16:10:43

what do you think about that ?

Eugen16:10:07

(I am looking at conajners because we use docker swarm at work and tooling sucks for swarm )

Eugen16:10:27

I made a stack templating system (a poor man's kubernetes helm implementation) and I use bb to render and manage deployments

Eugen16:10:19

my motivation is to be able to do more - maybe drop the native client requirement - for managing stuff like configs, secrets, etc

lispyclouds16:10:07

Hey @eugen.stan yeah this is something on my list too. JEP-380 adds the ability to talk to sockets, but i couldnt get the standard java 11 http client to accept a unix:// domain string or make it somehow implement some classes to be a transport layer. I could spend more time to figure it out but probably similar things to as in https://github.com/into-docker/unixsocket-http Alternatively I have been thinking of using babashka.curl as the transport and make the unixsocket-http and https://github.com/into-docker/pem-reader as optional deps and load either of them dynamically based on a flag during the client creation. If you ask me the latter could be an easier path that figuring out the java inheritance mess. we could have this as the first cut and then iterate over it? curl can handle both the requirements of unix sockets and pem files for mTLS

lispyclouds16:10:27

making contajners use babashka.curl should be relatively straightforward, changes mainly needed in impl.clj

lispyclouds16:10:53

the unixsocket-http lib that you see was also mostly pulled out of clj-docker-client, the predecessor of contajners

lispyclouds16:10:37

if i remember correctly, the biggest issue i faced was to get http going over unix sockets, raw traffic was possible but the java 11 client was a tough nut to crack, and docker needs to do http over unix

lispyclouds16:10:58

Of course, PRs welcome! Im quite short of time at the moment, but PRs will be swiftly dealt with! 😄

borkdude18:10:07

@eugen.stan I added an example with #nbb and dockerode (a library which seems kind of maintained) here: https://github.com/borkdude/nbb/blob/main/examples/dockerode/example.cljs Perhaps another idea.