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.

馃憤 2
FITH21:07:20

There was an https://clojurians.slack.com/archives/CLX41ASCS/p1652642195641759 about resolving dependancies on hosts without a network connection, but I鈥檓 finding myself in a slightly different problem. When I鈥檓 at work, I鈥檓 behind a corporate firewall that is the only way to get to HTTP(S) connections. I鈥檝e 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鈥檓 only including the top level of the traceback, but can send it in full if needed. I鈥檝e 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鈥檚 still trying to directly connect to the ip 151.101.212.209 which is http://repo1.maven.org. I鈥檝e also tried changing the envrionment settings for http_proxy/https_proxy to bogus URL鈥檚 and can see the results reflected in the java process that is spawned. It seems like it鈥檚 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鈥檛 think I have anything that weird in my setup鈥 Actually, I鈥檒l create another user and try running from there just incase there鈥檚 something with my environment, or some other 鈥渓eftover鈥 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鈥檒l grab some source and also double check the URL. I鈥檓 fairly certain we aren鈥檛 blocking out Maven, but now that you say that I鈥檓 not SURE we鈥檙e aren鈥檛, will check in the morning when I鈥檓 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鈥檝e 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鈥檓 still looking through the code there. The following is the minimal case for the java that is exec鈥檈d 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鈥檛 yet narrowed down the exact place it鈥檚 reaching out to http://repo1.maven.org so I鈥檓 not sure why the java System Properties for the proxies are being ignored.

borkdude20:07:46

interesting