Fork me on GitHub
eccentric J01:01:28

If this is covered in the docs I’ll look harder but didn’t see it on first pass: Is there a way to break up scripts into separate files in bb and require them?

eccentric J02:01:28

I suppose that’s what pods do?


You can use add-classpath to tell bb to search other places for your ns

eccentric J06:01:21

Thanks! I’ll have to experiment with that.

eccentric J15:01:52

Thanks will read this thoroughly

eccentric J06:01:54

I used the dockerfile from the babashka repo to compile the postgresql pod. I copied the generated binary to my server in the .babashka/pods/repository/org.babashka/postgresql/0.0.1 directory then tried to run the postgresql sample code:

.babashka/pods/repository/org.babashka/postgresql/0.0.1/pod-babashka-postgresql: /lib64/ version `GLIBC_2.14' not found (required by /home1/[redacted]/.babashka/pods/repository/org.babashka/postgresql/0.0.1/pod-babashka-postgresql)
----- Error --------------------------------------------------------------------
Message:  Stream closed
Location: /home1/[redacted]/public_html/clj-test/cgi-bin/./test.clj:4:1

----- Context ------------------------------------------------------------------
1: #!/home1/[redacted]/public_html/clj-test/bb
3: (require '[babashka.pods :as pods])
4: (pods/load-pod 'org.babashka/postgresql "0.0.1")
   ^--- Stream closed
5: (require '[pod.babashka.postgresql :as pg])

----- Stack trace --------------------------------------------------------------
user - /home1/[redacted]/public_html/clj-test/cgi-bin/./test.clj:4:1
Any thoughts how I can compile the pod to not require GLIBC_2.14?


Yes, you need to use the --static flag to compile it to a static binary on linux

eccentric J15:01:16

Oh I missed that flag sorry about that. Thanks again!


@jayzawrotny you could try compiling the pod statically. Maybe have the uberjar and then use native-image --static ...? Thats how we build the babashka static binary

eccentric J15:01:49

Thanks I think I was missing the static flag!

eccentric J22:01:45

That worked! Thanks again for all the help borkdude and lispyclouds.

eccentric J22:01:01

What’s the best way to use honeysql? Is it still what’s recommended here?


@jayzawrotny This is now the more easy way: We should update the sql-pods docs


(PR always welcome)



(ns honeysql-script
  (:require [babashka.deps :as deps]
            [babashka.pods :as pods]))

;; Load HoneySQL from Clojars:
(deps/add-deps '{:deps {honeysql/honeysql {:mvn/version "1.0.444"}}})

(require '[honeysql.core :as sql]
         '[honeysql.helpers :as helpers])


ah let me just update it right now


@jayzawrotny Note that using babashka.deps requires a JVM and is only fast when the classpath is cached. I'm not sure if that's available on your shared host


But you can build an uberjar with babashka as well and upload that

eccentric J22:01:07

So that means building a static babashka + honeysql as a static binary and babashka-sql-pod as a static binary?


To build an uberjar, add honeysql to a deps.edn and then bb -cp "$(clojure -Spath)" -m your-script.main --uberjar foo.jar You don't need to change babashka itself


this is just to prevent needing a JVM in the shared host

eccentric J23:01:34

And I should do that in the babashka build docker container then upload to my shared host?


you can run docker containers there?


oh, I see, no you don't need to build babashka itself to be able to use it with source libraries

eccentric J23:01:33

I just meant build it in your linux container for babashka on my local


as long as you manage to get the source on the classpath, it's fine. babashka.deps can manage this for you (through tools.deps on the JVM) or you can do it yourself in some other way


e.g. an uberjar is a way to package the source in a standalone file


well "standalone". you still need bb to execute it: bb foo.jar


I guess you can even package the pod in resources and then spit it out on the shared host using io/copy the first time


but you will also need to copy bb itself there, so maybe one extra binary file to copy isn't that bad

eccentric J23:01:39

I’ll have to try that tonight. Thanks for all the help, I really appreciate it!


No problem. You can also git clone honeysql and then add the source to the classpath using babashka.classpath. This is another way without the JVM


assuming it has no dependencies

eccentric J23:01:28

I’m thinking getting some third-party libs like honeysql in there is the last major problem that needs to be worked out and tested before at least writing a guide\tutorial, then with that super uberjar that might streamline the process.

eccentric J23:01:57

One thought I haven’t decided yet on though is if I should make a PR to add a dockerfile to the sql pod (and eventually other pods) or if I should create a template repo with some scripts and presets to help others get started?


We can publish a static release if that helps

eccentric J23:01:21

Oh yes! That would reduce some steps for people. How can I help with that?


We generate a CircleCI config here: You would just have to add one extra job that is the same as the other linux one but with the --static, which you could do using an environment variable


I'm off now, getting late. PR welcome

eccentric J23:01:25

Cool, I can handle that. Thanks again!