Fork me on GitHub
#nbb
<
2022-10-27
>
Hankstenberg07:10:04

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
borkdude07:10:45

How did you add sente to your project?

Hankstenberg07:10:15

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

borkdude07:10:49

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

Hankstenberg07:10:53

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

borkdude07:10:00

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

borkdude07:10:10

have you tried using websockets directly using an npm library?

Hankstenberg08:10:21

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

borkdude09:10:38

I'll take a look at the sente error now

🙌 1
borkdude09:10:51

I can reproduce the error locally

👍 1
borkdude10:10:02

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

borkdude10:10:16

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

Hankstenberg10:10:03

Ah, okay. Thanks for looking into it so quickly! 🙂

genRaiy09:10:53

I'm seeing this in our CI logs

genRaiy09:10:09

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

borkdude09:10:27

@raymcdermott nbb uses bb to fetch and unpack deps

genRaiy09:10:41

so that's new since a few release ago

borkdude09:10:56

it only does this if you have an nbb.edn

borkdude09:10:24

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

genRaiy10:10:18

+ curl -sLO 

+ chmod +x install

+ ./install

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

borkdude10:10:00

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

borkdude10:10:09

or install which :)

😅 1
borkdude10:10:16

what image is this?

genRaiy10:10:14

its the aws/nodejs

borkdude10:10:11

@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

genRaiy10:10:21

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

borkdude11:10:14

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

genRaiy11:10:57

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

genRaiy11:10:56

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

genRaiy11:10:14

great, obvious Dockerfile from the AWS crew

genRaiy11:10:26

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 /

genRaiy11:10:34

it's weird cos their examples use tar

borkdude11:10:42

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

genRaiy11:10:45

I'm using this thread as therapy

lispyclouds11:10:39

@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

lispyclouds11:10:29

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

borkdude11:10:49

but you only need bb at build time

borkdude11:10:04

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

lispyclouds11:10:32

yeah can use node:19 as a builder stage

borkdude11:10:53

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

borkdude11:10:22

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

genRaiy11:10:57

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.

borkdude11:10:50

@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

borkdude11:10:06

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

genRaiy12:10:56

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

borkdude12:10:17

screw the dependency then ;)

borkdude12:10:23

what dependency is it?

genRaiy13:10:11

snake-camel-kebab

genRaiy13:10:51

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

genRaiy13:10:43

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

genRaiy13:10:12

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

genRaiy13:10:10

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

genRaiy13:10:12

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

borkdude13:10:17

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

genRaiy13:10:17

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

genRaiy13:10:26

so fucking close now

genRaiy13:10:39

what the shit heck is this?

genRaiy13:10:50

ha, this is my code 🙂

genRaiy14:10:53

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

genRaiy09:10:30

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