babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-05-03T07:56:08.373400Z

I've decided to just keep it the way it is. Although this is an oversight, people may already rely on it. If they want to make their code portable with JVM Clojure it's an easy fix.

Karol W贸jcik 2021-05-03T09:48:20.374500Z

Babashka is awesome!! Quick rationale why:

馃憦 3
borkdude 2021-05-03T10:38:37.376700Z

Hey, just launched this site: https://babashka.org/ Let me know what you think

1
鉂わ笍 9
2021-05-12T03:30:00.226300Z

brilliant, looks great

Karol W贸jcik 2021-05-03T10:39:38.376800Z

@borkdude Can I somehow analyze script and tell which dependencies should be added to the classpath?

Karol W贸jcik 2021-05-03T10:40:18.377100Z

Love the font!

Karol W贸jcik 2021-05-03T10:41:36.377400Z

Looks weird on phone though

Karol W贸jcik 2021-05-03T10:44:47.377800Z

Let me maybe explain it a little bit. I've got following babashka runtime layer. https://github.com/FieryCod/holy-lambda/tree/master/modules/holy-lambda-babashka-layer With build in classpath:

src:/opt/.m2/io/github/FieryCod/holy-lambda/0.1.45/holy-lambda-0.1.45.jar:/opt/.m2/io/github/FieryCod/holy-lambda-babashka-shim/0.1.38/holy-lambda-babashka-shim-0.1.38.jar:/opt/.m2/org/clojure/clojure/1.10.3/clojure-1.10.3.jar:/opt/.m2/com/amazonaws/aws-lambda-java-core/1.2.1/aws-lambda-java-core-1.2.1.jar:/opt/.m2/io/github/FieryCod/holy-lambda-default-retriever/0.0.5/holy-lambda-default-retriever-0.0.5.jar:/opt/.m2/metosin/jsonista/0.3.2/jsonista-0.3.2.jar:/opt/.m2/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar:/opt/.m2/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar:/opt/.m2/com/fasterxml/jackson/core/jackson-core/2.12.2/jackson-core-2.12.2.jar:/opt/.m2/com/fasterxml/jackson/core/jackson-databind/2.12.2/jackson-databind-2.12.2.jar:/opt/.m2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.2/jackson-datatype-jsr310-2.12.2.jar:/opt/.m2/com/fasterxml/jackson/core/jackson-annotations/2.12.2/jackson-annotations-2.12.2.jar
/var/task/src:/var/task/.m2:/var/task:/var/task/src/clj:/var/task/src/cljc:src/cljc:src/clj:/var/task/resources
It works well with default dependencies, but when the user includes any other dependencies then classpath does not cover it.

borkdude 2021-05-03T10:47:06.378Z

@karol.wojcik Can you try again on the phone? I think I messed something up

Karol W贸jcik 2021-05-03T10:50:05.378300Z

@borkdude Still the same.

Karol W贸jcik 2021-05-03T10:50:13.378700Z

Both on emulator and real device

borkdude 2021-05-03T10:50:39.378900Z

ok, I will ask the person who designed the site to take a look

borkdude 2021-05-03T10:54:56.379100Z

@karol.wojcik Users can add dependencies to bb.edn or via babashka.deps/add-deps, or via babashka.classpath/add-classpath

Karol W贸jcik 2021-05-03T11:00:26.379300Z

@borkdude But can they use regular stuartsierra.component if its already provided in classpath?

borkdude 2021-05-03T11:00:52.379500Z

they should, I think, yes

Karol W贸jcik 2021-05-03T11:00:57.379700Z

Ok great 馃槃

Karol W贸jcik 2021-05-03T13:15:06.380700Z

@borkdude Confirmed. Works!

Karol W贸jcik 2021-05-03T13:24:33.381100Z

Last question. How add-deps know where to write deps?

borkdude 2021-05-03T13:25:55.381300Z

add-deps doesn't write

borkdude 2021-05-03T13:26:11.381500Z

it only adds deps in memory

2021-05-03T13:27:02.381700Z

ah, tailwindcss. https://github.com/green-coder/girouette and babashka would be a good match.

Karol W贸jcik 2021-05-03T13:27:23.382Z

The thing is that I'm adding all .jars which are in Lambda context to BABASHKA_CLASSPATH, so no add-deps in needed. Unfortunetely when one use add-deps then getting download

Karol W贸jcik 2021-05-03T13:27:40.382200Z

I suspect that there is some environment variable for it as well

borkdude 2021-05-03T13:28:36.382400Z

This is using deps.clj so same as before, it downloads to your .m2 or mvn/local-repo

borkdude 2021-05-03T13:29:02.382600Z

But I think you can recommend people to just use bb.edn if you are going to use your framework

Karol W贸jcik 2021-05-03T13:31:17.382800Z

I cannot 馃槥

Karol W贸jcik 2021-05-03T13:31:34.383Z

There is no bb.edn in Lambda context. Just pure sources

Karol W贸jcik 2021-05-03T13:31:50.383200Z

So I cannot set :mvn/local-repo

borkdude 2021-05-03T13:32:49.383500Z

yeah, but you can get their deps before you make the lambda right?

borkdude 2021-05-03T13:32:55.383700Z

if they are in bb.edn

Karol W贸jcik 2021-05-03T13:33:29.383900Z

I'm taking deps from both bb.edn and deps.edn

borkdude 2021-05-03T13:33:46.384100Z

so then it's good?

Karol W贸jcik 2021-05-03T13:34:58.384300Z

I think so. The only issue is that in lambda context someone may call add-deps and the artifact is being downloaded. I'm missing some environment variable probably 馃槃 No more questions. 馃槃

mike_ananev 2021-05-03T13:39:10.386600Z

@borkdude is there any way to set PKI certs or disable SSL in babashka? I started bb in corporate network under Windows 10 (w/o WSL) and got following error

borkdude 2021-05-03T13:45:41.387300Z

@mike1452 The download happens here: https://github.com/borkdude/deps.clj/blob/9e0ca8002cca486223a962c06865dbbe3bc1917a/src/borkdude/deps.clj#L181 Not sure what should happen to solve your problem

borkdude 2021-05-03T13:46:01.387900Z

But you could perhaps download the tools jar manually and put it in the expected location

mike_ananev 2021-05-03T13:49:03.390400Z

In java we add certificates in trusted JKS to avoid this problem. But in babashka it is not clear, what JKS or truststores are used during SSL handshakes? I'll try to download them manually, but afraid that other deps of my project should be downloaded too.

borkdude 2021-05-03T13:49:50.390700Z

AFAIK it uses the same stuff as Java

borkdude 2021-05-03T13:50:27.391100Z

Not sure how exactly this works with graalvm

borkdude 2021-05-03T14:12:52.391300Z

Here is some info: https://www.graalvm.org/reference-manual/native-image/JCASecurityServices/

mike_ananev 2021-05-03T14:14:34.392900Z

I think here plays role what cacerts are used during bb binary compilation. But in our corporate network we use our own certs which are absent in cacerts.

mike_ananev 2021-05-03T14:20:47.394Z

I have bb.exe (binary) that has no connection with GraalVM.

borkdude 2021-05-03T14:21:21.394400Z

@mike1452 I found something here: https://www.jetdrone.xyz/2019/04/16/Full-SSL-Trust-in-Native-Images.html

./dad-jokes \
  -Djavax.net.ssl.trustStore=./cacerts \
  -Djavax.net.ssl.trustAnchors=./cacerts

borkdude 2021-05-03T14:21:35.394800Z

This suggests you can set the Java property to point at your certificates

borkdude 2021-05-03T14:22:34.395100Z

(yes, you can set java properties this way with bb too)

mike_ananev 2021-05-03T14:23:00.395500Z

Thank you! I'll try it

mike_ananev 2021-05-03T15:52:36.397700Z

These options has no effect for me. Babashka not using them. It seems, that in corporate networks, without option for disabling SSL certificate check babashka.tasks/clojure cannot download deps.

mike_ananev 2021-05-03T15:53:04.398100Z

I'll try to copy .m2 manually

borkdude 2021-05-03T15:53:21.398500Z

@mike1452 Can you reproduce that by trying to download with a JVM?

mike_ananev 2021-05-03T15:53:36.398900Z

yeah, i'll try

borkdude 2021-05-03T15:55:57.399700Z

@mike1452 you can reproduce this with pure java by using this uberjar: https://github.com/borkdude/deps.clj/releases/download/v0.0.14/deps.clj-0.0.14-standalone.jar and running it with java -jar ...

borkdude 2021-05-03T15:56:15.400100Z

and java -<http://Djavax.net|Djavax.net>.ssl.... -jar ...

mike_ananev 2021-05-03T15:56:28.400300Z

oh! cool!

borkdude 2021-05-03T15:56:53.400700Z

or heck, I guess you could even use the babashka uberjar, but that requires Java 11

borkdude 2021-05-03T15:56:58.400900Z

not sure which java you are using

mike_ananev 2021-05-03T15:58:00.401200Z

I can use java 8 or 11

borkdude 2021-05-03T15:58:39.401600Z

ok: https://github.com/babashka/babashka/releases/download/v0.3.7/babashka-0.3.7-standalone.jar java -<http://Djavax.net|Djavax.net>.ssl... -jar babashka-....jar

borkdude 2021-05-03T16:02:19.402200Z

does it help if you put ./cacerts or .\cacerts ?

borkdude 2021-05-03T16:02:42.402600Z

and you can please put long output in a gist/pastebin?

mike_ananev 2021-05-03T16:03:46.403600Z

i'm under vpn right now. corporate policy blocks pastebin for me during vpn session. 馃槀

borkdude 2021-05-03T16:04:38.404Z

Slack also allows uploading snippets as files :)

borkdude 2021-05-03T16:05:59.404600Z

alternatively you can try a full path, like here: https://stackoverflow.com/a/2645939/6264

borkdude 2021-05-03T16:19:37.405Z

@mike1452 Locally I am trying this now too. It seems to not work

borkdude 2021-05-03T16:19:46.405200Z

I am asking in the graalvm slack: https://app.slack.com/client/TN37RDLPK/CN9KSFB40

borkdude 2021-05-03T16:21:16.405700Z

@mike1452 would it help in any way if curl downloaded the jar?

borkdude 2021-05-03T16:22:18.406600Z

I guess downloading deps would still need a certificate, but maybe it works. Can you please test this by downloading the tools jar to your system manually and test if it can download a dependency afterwards?

borkdude 2021-05-03T16:25:19.407300Z

So follow these "instructions":

Could not find /Users/borkdude/.deps.clj/1.10.3.822/ClojureTools/clojure-tools-1.10.3.822.jar
Attempting download from <https://download.clojure.org/install/clojure-tools-1.10.3.822.zip>
Download the zip, unzip it and place the jar in the expected location. And then try to run bb and see if it can download deps.

mike_ananev 2021-05-03T19:38:31.412400Z

@borkdude thank you for your help. I think my situation a bit harder. I suppose our corporate network has inspecting proxy like Bluecoat or other. So, PKI certs are dynamic for proxy pool and add them to cacerts file has no effect. I will try to use curl but, I think, right solution would be to get access to our corporate Nexus mirror and download deps from there. Does deps.clj has functionality to download deps from local Nexus with login/pass credentials?

borkdude 2021-05-03T19:39:32.412800Z

@mike1452 is that similar to using a proxy? https://github.com/borkdude/deps.clj#proxy-environment-variables

borkdude 2021-05-03T19:40:51.413400Z

@mike1452 I am trying to communicate a few times that the tools.jar is not the same as downloading deps.

borkdude 2021-05-03T19:41:19.414Z

The tools jar is not a dependency (in the usual sense). It is the program that will download the dependencies. It contains tools.deps.alpha. So bb first needs that jar in a certain place so it can execute it.

borkdude 2021-05-03T19:42:18.414800Z

So first take care of that, then try again. And after that we can take a look at dependency downloading. These are two separate things. If you manage to download the tools.jar using curl, that is 50% of the solution. The other 50% we have to look at separately.

borkdude 2021-05-03T19:46:05.415900Z

but if you have a proxy that you are allowed to download through, then the above settings will apply to both parts of the solution

mike_ananev 2021-05-03T20:41:21.418900Z

I have corporate Nexus with clojars mirror and maven central. Unfortunately it requires authentication. I cannot find does deps.clj supports settigns.xml or not? settings.xml contains urls and credentials for private mirrors. Also I think https://clojure.atlassian.net/browse/TDEPS-177 may affect to my case.

borkdude 2021-05-03T20:42:56.419200Z

@mike1452 It says: > April 22, 2021, 8:26 PM > Applied for next release

mike_ananev 2021-05-03T23:37:31.422900Z

@borkdude, I solved the problem! Your deps.exe saved me. I have two JVMs on my Windows machine and one of them had no trusted certs from our internal CA. After I added them into cacerts file, deps.exe started to download any deps. Cool! Now I can develop my Clojure projects not only on BYOD Mac but also on Windows VM.

mike_ananev 2021-05-03T23:38:33.423600Z

also, I configured correct settings.xml using https://clojure.org/reference/deps_and_cli#_maven_authenticated_repos