This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-11
Channels
- # announcements (3)
- # asami (4)
- # babashka (79)
- # babashka-sci-dev (47)
- # beginners (97)
- # biff (12)
- # calva (7)
- # clj-commons (3)
- # clj-kondo (22)
- # clj-on-windows (13)
- # cljdoc (31)
- # cljfx (2)
- # cljs-dev (1)
- # clojure (85)
- # clojure-austin (4)
- # clojure-dev (12)
- # clojure-europe (15)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-uk (4)
- # community-development (19)
- # conjure (3)
- # core-typed (40)
- # cursive (9)
- # datahike (21)
- # datomic (1)
- # emacs (7)
- # exercism (2)
- # graalvm (20)
- # graphql (1)
- # honeysql (16)
- # jobs (1)
- # malli (2)
- # off-topic (3)
- # pathom (28)
- # pedestal (3)
- # polylith (7)
- # reitit (14)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (4)
- # shadow-cljs (21)
- # sql (21)
- # testing (8)
- # tools-deps (23)
- # vscode (8)
- # xtdb (38)
Hello lovely people! what is the recommended way to bake in pods in a container when using babashka/babashka:latest Docker?
Would it be to copy my local ~/.babashka/pods/
into the container?
@hallstrom.eric Probably build a custom docker image and during build time download the pods into the image
You can download the pods by just evaluating an expression and having them in your bb.edn
Is there some flag or something for bb where you can specify where the pods folder is located?
I was thinking if I copy the pod into the container and the specify the location for that pod
Because I'm trying to run the aws pod inside a lambda but having this error
xception in thread "main" java.io.FileNotFoundException: /home/sbx_user1051/.babashka/pods/repository/org.babashka/aws/0.1.2/manifest.edn (No such file or directory)
I assumed it didn't manage to download the podif you use :path
then it will not download the pod but expect the pod to be there already
Is it supposed to look like this:
:pods {org.babashka/aws {:version "0.1.2"
:path "/var/task/pods/aws"}
if I have the pod under a directory there; with these files:
manifest.edn metadata.cache pod-babashka-aws
Oh but then I can't require that pod in my namespace with just this
(:require
[pod.babashka.aws :as aws]))
it seems to be still downloading itwhen you call it org.babashka/aws
will it default to the pod registry and go and fetch it from there @U04V15CAJ?
So I'm pointing to the binary in bb.edn ->
:pods {org.babashka/aws {:version "0.1.2"
:path "./pods/aws/0.1.2/pod-babashka-aws"}}
and in my namespace I require it like this:
(:require [pod.babashka.aws :as aws]))
It still downloads the pod though 😕./pods/aws/0.1.2/pod-babashka-aws: 1: : not found
./pods/aws/0.1.2/pod-babashka-aws: 2: Syntax error: word unexpected (expecting ")")
and if I require it inside the namespace like this
(pods/load-pod "./pod-babashka-aws")
I get this error:
` 8: (pods/load-pod "./pod-babashka-aws")
^--- Invalid netstring. Unexpected end of input.
`
and this is with
babashka v0.8.0
So it seems like it still wants a URL to fetch it from:version
must not be there. It's that or path, not both. So start there. Then you have some other problem. :)
You don't need to explicitly load it with path either, so get rid of that
The next thing to look at is if the binary it's pointed at is a valid executable for that platform
It's throwing some errors trying to execute the pod binary it looks like
Hmm ok; I took the binary from my local pod that was under : ~/.babashka/pods/repository/org.babashka/aws/0.1.2/ should I create the binary by building the git repo instead?
What OS and arch are you on and what OS and arch is the lambda on? They should match
I'm running macos monterey, the other OS is on aws lambda where I started the thingy in a container like this -
Dockerfile
FROM babashka/babashka:latest
WORKDIR /var/task
copy app/src src
copy app/bb.edn .
copy app/src/lambda/bootstrap .
copy app/pods/aws/0.1.2/pod-babashka-aws .
RUN chmod +x pod-babashka-aws
CMD ["./bootstrap"]
So then it seems that the container running on aws don't have access to ~/.babashka/pods/ or something
You can just download the linux binaries when creating the image and then copy them to a path
I mean in a multi-staged step. @U7ERLH6JX can tell you more about this. Else take a look at #holy-lambda which has support for #babashka + pods
Using the linux binary of the pod did of course work; super thank you for the help again!
Perhaps there's a way to detect this and give a better error message?
not seeing anything super obvious short of reading binary headers or similar
haha, yeah for sure
@hallstrom.eric I forgot to mention:
> Is there some flag or something for bb where you can specify where the pods folder is located?
The environment variables XDG_CACHE
and XDG_DATA
can be set to influence this
E.g.:
XDG_DATA=pods bb XDG_CACHE=pods
will download the pods to pods/.babashka/pods/repository/....
I will add BABASHKA_PODS_DIR
for the next release which will cover everything related to pod downloading
Any recommendations for a time library for bb? Something along the lines of tick.
@markbastian I recommend using java.time
directly, but cljc.time is a library that also works
/var/task/./pod-babashka-aws: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /var/task/./pod-babashka-aws)
/var/task/./pod-babashka-aws: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/./pod-babashka-aws)
when I try to load aws pod in docker image. Using babashka/babashka:latest . Tried apt-get -y install libc6
but that is not itwhat is the base image of the docker image youre using?
FROM babashka/babashka:latest as BABASHKA
FROM clojure:tools-deps as BUILDER
ah actually now I see I think in the context of it throwing I'm in this tools-deps image w/eI don't understand this error message, when using the (newest) aws pod, this is a static binary
from the aws pod compile script:
BABASHKA_STATIC=${BABASHKA_STATIC:-}
BABASHKA_MUSL=${BABASHKA_MUSL:-}
if [ "$BABASHKA_STATIC" = "true" ]; then
args+=("--static")
if [ "$BABASHKA_MUSL" = "true" ]; then
args+=("--libc=musl"
# see
"-H:CCompilerOption=-Wl,-z,stack-size=2097152")
else
# see
args+=("-H:+StaticExecutableWithDynamicLibC")
fi
fi
maybe it has a dependency on a version of glibc that the clojure base image doesnt have. we prefer static graal binaries in most places
should I set "MUSL" to true as well? I think just using BABASHKA_STATIC=true did not do it
because of the session-token in credentials provider 😅 I a use case where setting the properties is not viable because I'd like to use different clients in the same process
(defn -kludge-full-basic-credentials-provider
"Given a map with :access-key-id and :secret-access-key,
returns an implementation of CredentialsProvider which returns
those credentials on fetch.
- Ben: Added session token "
[{:keys [access-key-id secret-access-key session-token]}]
(assert access-key-id "Missing")
(assert secret-access-key "Missing")
(create-provider
(reify creds/CredentialsProvider
(fetch [_]
{:aws/access-key-id access-key-id
:aws/secret-access-key secret-access-key
:aws/session-token session-token}))))
added this to credentials.clj|
https://github.com/SingularityGroup/pod-babashka-aws/commit/1716fb326a50676e9ab049fe7c9a126c330ead4a