holy-lambda 2021-04-21

@viesti has joined the channel

Hello 馃槃

Good to see you guys 馃檪 Let me know whether there is something we can do in holy-lambda to improve it 馃檪

Thought that I missed the channel, but not with that many days 馃槃

@ekoontz has joined the channel

Neat to see the effort, been thinking that JVM/Clojure support in Lambda is a good thing and I like the JVM/Runtime -> native-image progression

I guess there could be progression levels, from babashka to jvm runtime to native-image even, but yeah

Actually making a babashka runtime would be fairly easy on holy-lambda side.

Maybe that's something that could potentially bring more people into the project

Does babashka supports namespaces?

Ok let me know whether I understand it correctly, but it seems that all I would have to do is to provide babashka pod

Wondering if babashka supports defmacro though

0% bb
Babashka v0.3.5 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (defmacro foo [x] 1)
#'user/foo
user=> (foo 42)
1
dummy example though 馃檪

Wonderful

I want to keep functionality parity between runtimes.

babashka supports namespaces also, I think all in all a lot of Clojure things, but there are exceptions, like deftype , since that is low level facility to generate a class

holy-lambda has that polling loop also, to support the custom runtime

so I guess the thing would be that if the interface that holy-lambda provides for writing code against, is supported via babashka too

You can make an issue on the repository 馃檪 Would love to support babashka as well 馃檪

ah, true 馃檪

I will implement it probably on weekend since I'm working student 馃槥

馃槄 1

a babashka lambda could be packaged with docker container format even, like that example by Lukaz https://clojurians.slack.com/archives/CLX41ASCS/p1618416923161500

Ahh. Does aws lambda supports custom docker images now? I'm not aware of it

ah and forgot that https://github.com/dainiusjocas/babashka-lambda that you linked in the docs too

yeah, haven't tried out what limits there are, but Lambda supports OCI images now: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html > AWS provides a set of open-source聽https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-images-lp聽that you can use to create your container image. These base images include a聽https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client聽to manage the interaction between Lambda and your function code.

On holy-lambda side things are very simple. All I have to do is babashka-pod. Entrypoint is the same 馃檪

not sure about pod actually

Meh. Not interested in packaging lambda in docker image. Zip is better imho. 馃槃

babashka pod is a subprocess that babashka can run. I think the ideas is to package stuff that can't be run with the babashka interpreter into a pod, and then use it. Allows to keep the babashka binary itself small, and extend it via the pod subprocess

That's wonderful approach. That way I can package babashka-holy-lambda pod as an aws layer. Zip will include just a source code for a project

hum, was also thinking that could entrypoint generate something that bb interpreter could run directly? :)

thing then is that bb code might not be able to run all that java code runs, but one might be able to branch with reader conditionals

thinking that if there's reader conditional over say, bb aws pod, then you could load the java library in jvm/graal, and the pod in bb code (https://github.com/babashka/pod-babashka-aws)

but haven't looked at holy-lambda "interface" that much yet 馃檪

vomiting ideas here a bit 馃檪

Entrypoint generates a main function which is automatically called in bootstrap-native. The thing holy-lambda should provide is just a pod. Of course if it's possible to pack defmacro in a pod, which I now doubt.

馃憤 on asking on bb channel, there's good set of brains there 馃檪

I guess I was thinking that could it be possible, that the whole code that is written with the holy-lambda "interface", could be runnable via bb

in which case, I guess the lambda would start by calling bb with that piece of code, which would then run the polling loop etc

if I understood it correctly that you meant to provide babashka itself as a pod, might have gotten it wrong 馃檪

I mean that holy-lambda is so simple that if I provide holy-lambda pod then all the boostrap-native will do is:

bb some-file-which-defines-entrypoint.clj

yeah, exactly 馃檪

what would be in the holy-lambda pod?

Hmm.. Wait...

Maybe we can do this without making another repository. Maybe I can just use those reader_conditionals.

@viesti is metosin interested in providing babashka pod?

hmm so babashka calls pods, not the other way around 馃檪

I mean jsonista pod

馃槃

bb includes cheshire already

I can pack holy-lambda with jsonista into native image, but I would rather not.

haven't tried if jsonista runs with bb actually

but probably ~same classes used from jackson

Jsonista has to be registered in a pod. https://github.com/babashka/pod-registry

might miss some classes

didn't know 馃檪

much stuff happening in and around metosin, don't know all the things 馃檪

ah, misread

jsonista not registered as pod

should not be needed as a pod

if you have time to provide PR for jsonista reflection hints, it's all good 馃槈

I will put it clear. Pod is just a library compiled with native-image which in main provides some additional functionality. I can do the following: Create fierycod.holy-lambda.pod and expose all the necessary vars for babashka runtime. Register it as a pod, but jsonista is then compiled with holy-lambda.

Babashka can run libraries not packaged as pods?

it can run code from jars

Whaat?

it can use normal java classpath, load code from jars

So why I want to create babashka pod XD?

if the clojure code in a jar users form that generate calls to JVM that are supported by babashka, that code will run

that I was wondering 馃檪

why a holy-lambda pod :)

but it's all good

talking out loud, getting ideas etc 馃檪

Ok I think it clicks in my mind now. I will get rid of reflections in jsonista.

thank you 馃檪

thinking that could just try running that example (https://github.com/FieryCod/holy-lambda#example) with bb, and see what fails and plug in stuff to make it work with babashka 馃檪

deployment will be different per each runtime though

keeping that simple will require some effort

Yep. But I will hack it somehow in makefile

have forgotten all about make but that file based dependency thing is actually neat 馃檪

File based dependency?

like target/output.jar -> rule to create target/output.jar

https://github.com/FieryCod/holy-lambda/blob/master/docker/ce/Dockerfile#L7-L33, this made me wonder that had you already thought about docker image deployment for Lambda, but I guess not 馃檪

It's for compiling lambda.

Native compiled lambda needs only scratch image AFAIK.

So something lke:

FROM scratch

COPY output .

ENTRYPOINT ['/boostrap-native']

@viesti Very funny. But after installing locally jsonista reflections are gone.

aa, hehe, neat 馃檪

faint memory there being improvements on type hints lately

on jsonista, I'm a bit new with out release processes, but I'll ask around 馃檪

so rigged my local clojars config with help of the guys here and managed to put out 0.3.2 of jsonista, with the ObjectMapper type hint, so should compile better with Graal/native-image now 馃檪 @karol.wojcik

Lovely @viesti! Today i will roll out new version of holy lambda with babashka layer and jsonista 0.3.2

馃憤 1

It makes me smile that AWS author cannot have polish letters. What a shame :D

another thing actually that I had in mind is tools.deps support

would have to have step to AOT compile

Feel free to create an issue 馃檪

鉁旓笍 1

@thegeez has joined the channel

馃憢 1

@dcj has joined the channel

Question: Should we support node.js as well? 馃槃 Edit: I had to provide some #(:cljs) conditionals so that cljdoc would pass the build and i have realized that support for nodejs could be easily added.

Braindump Babashka layer would consist of babashka (bb), holy-lambda-babashka (jar) (still need to patch jsonista functions though), clojure 1.10.0 (jar) User will have the layer referenced via ARN. Deployment artifact will consist of plain sources packed in .jar. This way we will keep deploy artifacts super small. No clojure, no babashka just sources (like in php 馃槀).