This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-26
Channels
- # announcements (5)
- # architecture (79)
- # babashka (48)
- # beginners (148)
- # calva (57)
- # cider (31)
- # clara (2)
- # clj-kondo (4)
- # cljs-dev (6)
- # cljsrn (1)
- # clojure (10)
- # clojure-australia (4)
- # clojure-dev (5)
- # clojure-europe (13)
- # clojure-france (1)
- # clojure-nl (6)
- # clojure-provo (4)
- # clojure-uk (51)
- # clojurescript (38)
- # conjure (20)
- # core-logic (18)
- # cursive (28)
- # datomic (12)
- # duct (2)
- # emacs (16)
- # figwheel-main (3)
- # fulcro (43)
- # honeysql (17)
- # hoplon (3)
- # jobs (1)
- # meander (4)
- # mount (5)
- # off-topic (32)
- # pathom (6)
- # pedestal (5)
- # re-frame (1)
- # reagent (2)
- # reveal (8)
- # shadow-cljs (209)
- # spacemacs (5)
- # tools-deps (37)
- # xtdb (18)
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?
I suppose that’s what pods do?
Thanks! I’ll have to experiment with that.
Also see: https://book.babashka.org/#_classpath https://book.babashka.org/#babashka_classpath https://book.babashka.org/#babashkadeps
Thanks will read this thoroughly
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/libc.so.6: version `GLIBC_2.14' not found (required by /home1/[redacted]/.babashka/pods/repository/org.babashka/postgresql/0.0.1/pod-babashka-postgresql)
----- Error --------------------------------------------------------------------
Type: java.io.IOException
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
2:
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?Oh I missed that flag sorry about that. Thanks again!
@jayzawrotny you could try compiling the pod statically. https://www.graalvm.org/reference-manual/native-image/StaticImages/ Maybe have the uberjar and then use native-image --static ...
? Thats how we build the babashka static binary
Thanks I think I was missing the static flag!
The static steps here might help: https://github.com/babashka/babashka/blob/master/.circleci/config.yml#L142
https://github.com/babashka/babashka/blob/master/script/compile#L71 this section is helping me a lot too
That worked! Thanks again for all the help borkdude and lispyclouds.
What’s the best way to use honeysql? Is it still what’s recommended here? https://github.com/babashka/babashka-sql-pods/#honeysql
@jayzawrotny This is now the more easy way: https://github.com/babashka/pod-babashka-sqlite3#honeysql We should update the sql-pods docs
So:
(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])
@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
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
And I should do that in the babashka build docker container then upload to my shared host?
oh, I see, no you don't need to build babashka itself to be able to use it with source libraries
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
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
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
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.
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?
Oh yes! That would reduce some steps for people. How can I help with that?
We generate a CircleCI config here: https://github.com/babashka/babashka-sql-pods/blob/master/script/generate_circleci.clj
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
Cool, I can handle that. Thanks again!