nbb 2022-10-27

Did anybody manage to make sente (https://github.com/ptaoussanis/sente) run on nbb? I tried to add it to nbb.edn, but I'm getting "Message: Could not find namespace: taoensso.sente"

βœ… 1

How did you add sente to your project?

I created an nbb.edn with {:deps {com.taoensso/sente {:mvn/version "1.17.0"}} in it.

and what program have you tried to load sente? what invocation of nbb? which nbb version?

Oh thanks for asking, I just noticed that I still had 0.6.something globally! Apparently that was before nbb.edn support. Now it starts downloading the deps and fails with: ... Extracting dependencies... Done. ----- Error -------------------------------------- Message: Could not resolve symbol: sci.impl.records/pop Phase: analysis Could not resolve symbol: sci.impl.records/pop

hmm, that doesn't ring a bell but I'll look later today.

have you tried using websockets directly using an npm library?

I was just eyeballing http://socket.io when I thought about using sente instead.

I'll take a look at the sente error now

πŸ™Œ 1

Thanks πŸ™‚

I can reproduce the error locally

πŸ‘ 1

I have a repro:

$ npx nbb -e "(deftype RingBuffer [head tail] Object (pop [_]))"
----- Error --------------------------------------
Message:  Could not resolve symbol: sci.impl.records/pop
Phase:    analysis
Could not resolve symbol: sci.impl.records/pop
This code is a bit unexpected, but it's coming from core.async

which won't work in nbb anyway, so I recommend going with http://socket.io for now

Ah, okay. Thanks for looking into it so quickly! πŸ™‚

I'm seeing this in our CI logs

Command failed: bb --config .nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/deps.edn uberjar .nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps.jar
/bin/sh: bb: command not found

@raymcdermott nbb uses bb to fetch and unpack deps

so that's new since a few release ago

it only does this if you have an nbb.edn

or rather, it should only do that. it has always used bb to implement this functionality

+ curl -sLO 

+ chmod +x install

+ ./install

./install: line 105: which: command not found

you can just download a bb binary manually and place it on the path

or install which :)

πŸ˜… 1

what image is this?

its the aws/nodejs

@raymcdermott What is probably a better idea: build the stuff in ubuntu or so image, then copy the extra .nbb directory into the aws/nodejs image

I'd rather have everything built on CI ... more reproducible

I'm not saying you shouldn't do that on CI

/bin/sh: line 45: tar: command not found

Docker confi .... this is where all the fucking time disappears into 😠

great, obvious Dockerfile from the AWS crew

FROM scratch
ADD x86_64/0ee8b806ca44bee5a42222fb47b16dadc2bb0dde923e3ff961470a962ed7c2f6.tar.xz /
ADD x86_64/19706c75fe373a1651ae22a9af06bf3274c0190f46e2fa6b106a231bad8de6b0.tar.xz /
ADD x86_64/7a57b3bce00897c83ba301363e8f370e1655f988a17199ee04023dcd37f59676.tar.xz /
ADD x86_64/a3fc3f66d5a4f8467b57b5c39cd29b5835ca16ba4a227811cbf77ea06465fdc0.tar.xz /
ADD x86_64/d0f9563470ad687f4b3d0d7a464d8a1a8a360d8eda0a21a50873d21b58c1da69.tar.xz /
ADD x86_64/fa13b472ae60f71418c7d4421b0c194d8a82bb6c8808b021d8bbff254f936dd7.tar.xz /

it's weird cos their examples use tar

my earlier suggestion was: Do the deps stuff in an ubuntu image, then copy the files to the aws container. E.g. like here: https://github.com/babashka/babashka/blob/9de689c62360c964b0b476302eaae5c0ede9e772/Dockerfile.alpine#L28

I'm using this thread as therapy

@raymcdermott maybe just using node:19 or node:19-slim is just better than all of this dancing. bit fatter images but more peace of mind

the aws one is waaay to minimal, less than alpine. quite a thing to install anything let alone bb

but you only need bb at build time

so you can just copy your files to the aws one at the end

yeah can use node:19 as a builder stage

you also need java, so maybe take a circleci clojure node image or so

the same one I'm using for building nbb would do

It’s all to allow nbb.edn so I might just drop the dependency. I’ll try with your suggested image as a final attempt.

@raymcdermott if it's just one dependency, you could also just git clone that dependency and add the directory of that dependency to the nbb classpath

@raymcdermott or add {:paths ["../foobar/dep/src"]} in nbb.edn (should probably also work, without bb)

it's all getting quite hacky but thanks for the ideas

screw the dependency then ;)

what dependency is it?

snake-camel-kebab

which is nice for converting between Postgres names and idiomatic clojure keys

the main thing I like about nbb and scittle is that I don't have to worry about build

I'm sure that some folks are happy to get into it but I'm holding out

if I have to go through all the build processes, I'm less convinced that I would stick

there are still some sharp edges in nbb which I tolerate because of its simplicity

well, fetching dependencies is part of a build step, not much I can do about that

Downloading dependencies...
Clojure tools not yet in expected location: /root/.deps.clj/1.11.1.1165/ClojureTools/clojure-tools-1.11.1.1165.jar
Downloading  to /root/.deps.clj/1.11.1.1165/ClojureTools
Successfully installed clojure tools!
Downloading: org/clojure/clojure/1.11.1/clojure-1.11.1.pom from central
Downloading: camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.pom from clojars
Downloading: org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.pom from central
Downloading: org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.pom from central
Downloading: org/clojure/pom.contrib/1.1.0/pom.contrib-1.1.0.pom from central
Downloading: org/clojure/clojure/1.11.1/clojure-1.11.1.jar from central
Downloading: org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar from central
Downloading: org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar from central
Downloading: camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar from clojars
Extracting dependencies...
Done.
----- Error --------------------------------------
Message:  Could not resolve symbol: data-definition
Phase:    analysis
Could not resolve symbol: data-definition

so fucking close now

what the shit heck is this?

ha, this is my code πŸ™‚

this worked:

- yum update -q -y
      - yum -q -y install tar gzip java-11-amazon-corretto-headless
      - curl -sLO 
      - tar xzf babashka-1.0.164-linux-amd64.tar.gz -C /usr/local/bin

ah, ok - so I need to add that extra install step now