Fork me on GitHub
#babashka
<
2020-05-24
>
steveb8n05:05:14

Q: I’m considering re-writing my deploy scripts (currently jvm clj) using bb. my naive design is that it’s just logic wrapped around shell calls to the aws cli. I wonder if there’s a better way than shelling out or some other trick I haven’t thought of. Has anyone done anything like this already?

steveb8n05:05:46

One alternative would be nodejs for the scripting and using it’s aws client. but bb is so cool, I want to explore the comparison of the two designs

solf05:05:56

Apparently the aws-api lib doesn't work with graalvm, so I don't have other ideas besides shelling out to aws cli.

borkdude08:05:48

@U0FT7SRLP also had some kind of stripped down AWS clojure lib that worked with babashka or GraalVM I believe

jeroenvandijk15:05:00

@U0510KXTU For a long term tool I have done a lot of manually work to get part of the aws-api working (https://github.com/AdGoji/aws-api/blob/master/dev/examples.clj), but for more adhoc stuff I had more success wrapping the aws cli tool https://gist.github.com/jeroenvandijk/e4fca617cf3eea82d58bc87e37e35465#file-spire-clj-L31-L50

steveb8n00:05:35

@U0FT7SRLP thanks. that’s really helpful. even just confirming the using shell calls is a valid solution is good

👍 4
andrea.crotti09:05:22

I was thinking if it could be possible to use bb as interactive shell

andrea.crotti09:05:15

Eshell is a good example of a lisp based shell, where if don't put any parenthesis is just interpreted as something to shell out

andrea.crotti09:05:28

It would be a dream to have all the same auto completion I have in fish /bash plus the ability to switch up clojure whenever I want

borkdude09:05:31

There is a shell macro here: https://gist.github.com/borkdude/63a86a04f5d97aae4825326c0309dad2#file-macro-clj-L19 Not the same as a REPL, but a custom REPL can be built on top of clojure.main/repl which is available as a function inside babashka. This allows you to start a REPL inside a script, but can also be used to create custom things.

borkdude09:05:55

Alternatively there is https://github.com/dundalek/closh which tries to be a Clojure shell replacement. There is work in progress to leverage sci to be able to run on GraalVM

Crispin14:05:34

Bootleg 0.1.8 released. the babashka pod release - add babashka pod support - YAML upgrade to SnakeYAML 2.0 - Fix Build failed when trying build with graalvm-ce-java11-19.3.0 - Fix the ns/require code from spire in bootleg? - Fix Running from file in same directory requires leading ./ - Fix Generating XML preserving the tag name case - Fix reflection error preventing XML roundtrip https://github.com/retrogradeorbit/bootleg

🎉 12
borkdude14:05:38

Really awesome job @retrogradeorbit: I think this is the most extensive pod so far.

Crispin14:05:26

Thanks! Hopefully people put it to some good use. Get their babashka scripts processing heaps of html!

Crispin14:05:35

As a large library with lots of namespaces there is bound to be parts that dont work right in the pod form. Remember to open tickets for anything that has issues! Mention in the ticket its as a pod!

littleli15:05:03

both babashka and bootleg are in scoop now. Scoop users can enjoy the fruits right after update.

❤️ 12
littleli15:05:44

I put there a troubleshooting section, because of the vcredist2015 dependency that needs to be installed in addition. But otherwise should be good.

borkdude19:05:49

Is someone in here running macOS Catalina? There are some articles on the internet about slowdown of executables due to a notarization check: https://lapcatsoftware.com/articles/catalina-executables.html

borkdude19:05:07

I'm still on Mojave myself

Darin Douglass19:05:21

hmm, i'm on catalina. lemme check real quick

Darin Douglass19:05:11

immediately after startup it was really slow, but then dropped to instant:

.../src on  master [✘!?] at dev (dev-view-us)
➜ time /tmp/test.sh && time /tmp/test.sh
Hello
/tmp/test.sh  0.00s user 0.00s system 0% cpu 10.844 total
Hello
/tmp/test.sh  0.00s user 0.00s system 0% cpu 10.301 total

.../src on  master [✘!?] at dev (dev-view-us) took 21s
➜ time /tmp/test.sh && time /tmp/test.sh
Hello
/tmp/test.sh  0.00s user 0.00s system 83% cpu 0.005 total
Hello
/tmp/test.sh  0.00s user 0.00s system 87% cpu 0.005 total
i changed the script and it's name, and got about the same result every time:
.../src on  master [✘!?] at dev (dev-view-us)
➜ time /tmp/test-other-one.sh && time /tmp/test-other-one.sh
foobar
/tmp/test-other-one.sh  0.00s user 0.00s system 0% cpu 1.086 total
foobar
/tmp/test-other-one.sh  0.00s user 0.00s system 0% cpu 1.012 total

.../src on  master [✘!?] at dev (dev-view-us) took 3s
➜ time /tmp/test-other-one.sh && time /tmp/test-other-one.sh
foobar
/tmp/test-other-one.sh  0.00s user 0.00s system 0% cpu 1.015 total
foobar
/tmp/test-other-one.sh  0.00s user 0.00s system 0% cpu 1.015 total

borkdude20:05:30

1.015 still seems slow compared to the 0.005 in other runs?

Darin Douglass20:05:13

Yeah, agreed. I’m not sure why it never dipped back down. Definitely feels like there’s something there. Maybe later I’ll install Little Snitch and block some outgoing traffic

borkdude20:05:59

I've got a similar app called TripMode which I'm using to block traffic from certain apps when I'm on the train. Wonder if that also works for this.