This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-15
Channels
- # babashka (41)
- # beginners (47)
- # calva (7)
- # cider (5)
- # cljsrn (2)
- # clojure (38)
- # clojure-europe (74)
- # clojure-nl (2)
- # clojure-spec (1)
- # clojure-uk (38)
- # clojurescript (42)
- # component (30)
- # core-async (2)
- # cryogen (6)
- # cursive (47)
- # datahike (7)
- # datomic (18)
- # defnpodcast (1)
- # fulcro (17)
- # graalvm (8)
- # graphql (4)
- # helix (5)
- # honeysql (5)
- # introduce-yourself (1)
- # jobs (5)
- # jobs-discuss (4)
- # malli (20)
- # meander (4)
- # mental-health (1)
- # off-topic (41)
- # pathom (18)
- # podcasts-discuss (2)
- # re-frame (20)
- # react (1)
- # reagent (22)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # reveal (2)
- # sci (10)
- # shadow-cljs (42)
- # sql (20)
- # tools-deps (7)
- # vim (2)
- # xtdb (51)
Hi, when I do
$ bb uberscript pg_copycat.clj -m pg_copycat.core
$ bb pg_copycat.core
everything goes fine…
When I do
$ bb -cp $(clojure -Spath) --classpath src uberjar pg_copycat.jar -m pg_copycat.core
$ bb pg_copycat.jar
it fails with
----- Context ------------------------------------------------------------------
1: (ns user (:require [pg-copycat.core])) (apply pg-copycat.core/-main *command-line-args*)
^--- Could not resolve symbol: pg-copycat.core/-main
If I rename pg_copycat.core to pg-copycat.core in /src/pg_copycat/core.clj then it works.
But all other namespaces (like pg_copycat.utils) can stay with underscore.
I would like to keep naming consistent across namespaces. Thanks
for directory / file names (on the classpath) use underscores, but in code, always use hyphens
Hi, I am trying to pack my script with all the dependencies bb.edn
{:paths ["src"]
:deps {seancorfield/honeysql {:mvn/version "2.0.0-beta2"}
douglass/clj-psql {:mvn/version "0.1.2"}
clojure-term-colors/clojure-term-colors {:mvn/version "0.1.0"}
borkdude/spartan.spec {:git/url ""
:sha "12947185b4f8b8ff8ee3bc0f19c98dbde54d4c90"}}}
I tried to use both
$ bb -cp $(clojure -Spath) --classpath src uberjar pg_copycat.jar -m pg-copycat.core
$ bb uberscript pg_copycat.clj -m pg-copycat.core
but it still needs to download dependencies from bb.edn when $ bb pg_copycat.jar
on different server.
What should I to create a script which depends only on BB?
Thanks again@zikajk if you have a bb.edn
in your local directory, bb will always load dependencies. if you want to run the uberscript, then run it from a directory without the bb.edn
Ahh, this does work with uberscript but does not work with uberjar. So i will get back to using uberscript and I will delete bb.edn during the deployment. Thanks
I am not sure what i am doing wrong but i am not skilful with java classpaths tbh
$ bb -cp $(clojure -Spath) --classpath src uberjar pg_copycat.jar -m pg-copycat.core
$ rm bb.edn
$ bb pg_copycat.jar
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Could not find namespace: clojure.term.colors.
Location: 2:3
----- Stack trace --------------------------------------------------------------
- <expr>:2:3
- <expr>:3:3
- <expr>:1:10
$ bb uberscript pg_copycat.clj -m pg-copycat.core
$ rm bb.edn
$ bb pg_copycat.clj
{:exit 2, :out localhost:5432 - no response
, :err }
Cannot connect to database [postgres].
Here is an uberjar example:
borkdude@MBP2019 /tmp $ cat src/program.clj
(ns program
(:require [medley.core :as m]))
(defn -main [& _args]
(prn (m/index-by :id [{:id 1} {:id 2}])))
borkdude@MBP2019 /tmp $ bb uberjar foo.jar -m program
borkdude@MBP2019 /tmp $ cat bb.edn
{:paths ["src"]
:deps {medley/medley {:mvn/version "1.3.0"}}}
borkdude@MBP2019 /tmp $ bb --classpath "" foo.jar
{1 {:id 1}, 2 {:id 2}}
Cannot connect to database [postgres]
doesn't seem to be related to bb but more related to your configThe issue with -cp $(clojure -Spath) --classpath src
is that you are setting the classpath twice. The second option will override the first option
The connection to database is awaited output comming from uberscript. Thank you it seems to be the problem
@borkdude how to run two tasks with parameters in parallel? e.g. bb run --parallel 'task1 param1' 'task2 param1'
@U097654L8 bb doesn't support invoking multiple tasks from the command line yet.
The --parallel
option just means that task dependencies of the invoked task are ran in parallel
Thank you.
Hm, it seems that babashka doesn’t work on Alpine linux. Has anyone else noticed this?
FROM alpine:latest
RUN apk add --no-cache bash curl
RUN curl -sL | bash
RUN ls -l /usr/local/bin/
RUN /usr/local/bin/bb -h
---> Running in edd842dd84de
total 88200
-rwxr-xr-x 1 3434 3434 90311864 Jun 13 20:04 bb
Removing intermediate container edd842dd84de
---> 5930268b3b7d
Step 5/7 : RUN /usr/local/bin/bb -h
---> Running in a5f4abfb1f4c
/bin/sh: /usr/local/bin/bb: not found
basically it’s not seen as executable by the loader for some reason
@grazfather you should use the --static
option
you think it’s a shared lib issue? --static
is an option to the install script now?
yep, I just expected a clearer error about missing libs if that were the issue 🙂
This error is not printed by Babashka Not sure if it is the shell, linker or even Linux itself, but really nothing we could do
(from alpine, not from bb)
Confirmed this works great 🙂
FROM alpine:latest
# Needed to install babashka itself
RUN apk add --no-cache bash curl
RUN curl -sL \
| bash -s -- --static
@grazfather Cool! Note that there is also https://hub.docker.com/layers/babashka/babashka/0.4.6-alpine/images/sha256-352797da9c15b7a91d003527c13cf5ede62e904934c0bd10e9cb772754c01728?context=explore
oh, nice, maybe I will use that as my FROM 🙂 I add a bit after what is shown, it’s to test out my dotfiles installer
hm you have a redundant CMD
in there
@grazfather if youre referring to the CMD ["/bin/sh"]
that comes from the base alpine image which we extend. This is the Dockerfile we use: https://github.com/babashka/babashka/blob/master/Dockerfile.alpine
ah, Yeah, that makes sense