Fork me on GitHub
#babashka
<
2022-07-11
>
ordnungswidrig10:07:07

Does anybody has practical experience with pod-babashka-aws . Like "does it work stable enough for production"?

👍 1
borkdude10:07:28

I think so, but I'll let others comment on that. Also check out https://github.com/grzm/awyeah-api which is a minor rewrite of cognitect aws-api for bb.

Karol Wójcik10:07:34

Works stable enough yes!

pinkfrog12:07:49

I am thinking achieving a simple tool like https://www.fabfile.org/ where on my laptop issue commands that will be run on remote machines. My conceived workflow is: 1. use bb on local laptop to launch tasks. 2. The task will first ssh to the remote machince, download bb if not already installed there. 3. Also, transfer clj files to the remote machine 4. On the remote machine, use bb to run the clj files 5. get back the result Anyone has done that before? I wonder is nbb or bb more suitable to do that?

pinkfrog12:07:32

Does nbb have a hard dependency on node?

borkdude12:07:51

And nbb: yes, it has a hard dependency on node, although you can make a self-contained executable with caxa. (https://github.com/babashka/nbb/tree/main/doc/caxa)

pinkfrog12:07:56

Thanks guys. Rather informative.

vlad_poh15:07:23

anyone have a simple bb script to convert svg to png?

borkdude15:07:47

If you don't mind using nodejs, here is an example using #nbb https://github.com/babashka/nbb/blob/main/examples/sharp/example.cljs

jmglov14:07:30

It sounds like you already have what you need, but just for posterity, you can also probably do it by calling convert from ImageMagick, if you have that installed.

👍 3
FITH21:07:20

There was an https://clojurians.slack.com/archives/CLX41ASCS/p1652642195641759 about resolving dependancies on hosts without a network connection, but I’m finding myself in a slightly different problem. When I’m at work, I’m behind a corporate firewall that is the only way to get to HTTP(S) connections. I’ve created a bb.edn that consists of { :deps { etaoin/etaoin {:mvn/version "0.4.6"} } } and so far nothing else in the directory. If I run bb it eventually comes back with:

Error building classpath. Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.1
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.1

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.clojure:clojure:pom:1.11.1 from/to central (): Connect to  timed out

Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.clojure:clojure:pom:1.11.1 from/to central (): Connect to  timed out

Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to  timed out
I’m only including the top level of the traceback, but can send it in full if needed. I’ve run this with -http://Djava.net.useSystemProxies=true and in fact I can see the java process that is spawned with the correct proxies set, but it still seems to be unable to contact http://repo1.maven.org. Have I missed something in the documentation about working behind proxies? Or is there a better way forward than building uberjars on a host outside the work network?

borkdude21:07:36

Perhaps you can try this: https://github.com/borkdude/deps.clj#proxy-environment-variables bb uses deps.clj to download dependencies

FITH22:07:12

Ah okay, I can actually see the results of that, my http_proxy and https_proxy were already set, and I can see the -Dhttp.proxyHost (and Port) and the https equivalent set on the java command line, but looking at packet traces it’s still trying to directly connect to the ip 151.101.212.209 which is http://repo1.maven.org. I’ve also tried changing the envrionment settings for http_proxy/https_proxy to bogus URL’s and can see the results reflected in the java process that is spawned. It seems like it’s ignoring the proxy configuration?

borkdude22:07:32

Can you perhaps try with deps.clj alone and then use -Sdeps-file=bb.edn?

borkdude22:07:39

To see what happens

FITH22:07:04

I had actually just grabbed the binary from the deps.clj site to start and got:

$ env | grep proxy
https_proxy=
http_proxy=

$ deps -Sverbose -Sdeps-file bb.edn
deps.clj version = 0.1.1100
version          = 1.11.0.1100
install_dir      = /usr/local/lib/clojure
config_dir       = /home/fith/.clojure
config_paths     = /usr/local/lib/clojure/deps.edn /home/fith/.clojure/deps.edn deps.edn
cache_dir        = /home/fith/.clojure/.cpcache
cp_file          = /home/fith/.clojure/.cpcache/C0FEA91FB41E7AA69DBED62612D56780.cp

Refreshing classpath
Error building classpath. Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.0
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.0
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.clojure:clojure:pom:1.11.0 from/to central (): Connect to  timed out
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.clojure:clojure:pom:1.11.0 from/to central (): Connect to  timed out
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to  timed out
But I am also seeing identical results running the uberjar that you linked
$ java -jar ~/Downloads/deps.clj-0.1.1100-standalone.jar -Sdeps-file=bb.edn
Invalid option: -Sdeps-file=bb.edn

$ java -jar ~/Downloads/deps.clj-0.1.1100-standalone.jar -Sdeps-file bb.edn
Error building classpath. Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.0
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.clojure:clojure:jar:1.11.0
I don’t think I have anything that weird in my setup… Actually, I’ll create another user and try running from there just incase there’s something with my environment, or some other “leftover” from previous projects

FITH22:07:16

Same thing with a fresh user, it times out trying to get to http://Maven.org

borkdude22:07:55

Perhaps you can grab the deps.clj source and debug a little to see if there's anything unexpected

Bob B01:07:02

Another possibility, especially if the proxy seems to be being used - I'm similarly behind a company firewall, so I have a proxy set up using system properties and so on, but I can't get to maven central at work because we have an in-house artifact server, so big repos (maven central, npm, etc) are blocked because we're meant to use the in-house one. Obviously I can't say that this is definitely what's happening here, but one thing to try might be browsing to that URL through the proxy (in a browser or via curl or what have you) and seeing if that's blocked. If you know that you can usually get to maven central, please ignore this. 🙂

FITH01:07:38

Interesting on both points, I’ll grab some source and also double check the URL. I’m fairly certain we aren’t blocking out Maven, but now that you say that I’m not SURE we’re aren’t, will check in the morning when I’m back 🙂 Thank you both!

borkdude07:07:24

If all else fails, you could always build an uberjar of the deps on some other system and bring it over, and then use --classpath deps.jar

FITH20:07:22

Okay, so I’ve narrowed this down to being outside of deps.clj and babashka per se… It appears to be coming from within clojure.tools.deps.alpha.script.make-classpath2. I’m still looking through the code there. The following is the minimal case for the java that is exec’ed by deps.clj to build the classpath.

/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Dhttp.proxyHost=172.16.10.20 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=172.16.10.20 -Dhttps.proxyPort=8080 -Xms256m -classpath /home/fith/.deps.clj/1.11.0.1100/ClojureTools/clojure-tools-1.11.0.1100.jar clojure.main
-m clojure.tools.deps.alpha.script.make-classpath2
I haven’t yet narrowed down the exact place it’s reaching out to http://repo1.maven.org so I’m not sure why the java System Properties for the proxies are being ignored.

borkdude20:07:46

interesting