This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-26
Channels
- # announcements (1)
- # atom-editor (7)
- # babashka (9)
- # beginners (46)
- # cider (1)
- # circleci (2)
- # clj-on-windows (1)
- # cljdoc (5)
- # cljsrn (2)
- # clojure (25)
- # clojure-austin (8)
- # clojure-brasil (4)
- # clojure-europe (52)
- # clojure-nl (1)
- # clojure-norway (162)
- # clojure-uk (2)
- # cursive (3)
- # datalevin (134)
- # datomic (16)
- # defnpodcast (8)
- # graphql (9)
- # honeysql (5)
- # hoplon (26)
- # hyperfiddle (18)
- # introduce-yourself (1)
- # lsp (4)
- # malli (19)
- # nbb (16)
- # nrepl (1)
- # practicalli (3)
- # releases (3)
- # shadow-cljs (36)
- # tools-deps (7)
- # vim (2)
- # xtdb (9)
I'm trying to implement a lib for enhancing my personal workflow with datomic projects, is there a good way to execute datomic from a clojure code? For both start methods that I know I managed this way:
• For using datomic pro zip I can manage using a local env var like DATOMIC_DIR and on repl start execute (sh "bin/transactor" ...) and even bin/console.
• For using cognitec dev tools I had to runhttps://docs.datomic.com/cloud/dev-local.html on my downloaded zip and then connecting the client
Both ways I had to manually install some zip and do something more than lein deps
or just executing my REPL. I can think of manually wget
with sh
, or even add to git versioning but I was thinking if could be a better solution, some magic .jar
that can be run or even a lib to add on app.edn
.
The goal is to just execute my REPL and with one function I could start datomic, console, localstack, etc, and I already got it. But it would be awesome avoid downloading/installing any zip or file, to local development setup be just a REPL start.
clj -Sdeps '{:deps {com.datomic/datomic-free,{:mvn/version"0.9.5697"}}}' -M -e "(require,'[datomic.api,:as,d])" --repl
WARNING: requiring-resolve already refers to: #'clojure.core/requiring-resolve in namespace: datomic.common, being replaced by: #'datomic.common/requiring-resolve
user=> (d/q '[:find ?e :where [_ :k ?e]] [[0 :k 42]])
#{[42]}
unfortunately datomic team do not update datomic-free anymore so to use updated datomic, we need to do like a cave-man, click on links, receive emails, download zips, etc
Thats actually awesome, but is a version from 2012 😢
Something updated like this in maven would work perfectly for what I am thinking
I looked here, not really familiar with this maven website
my bad. now you can use:
clj -Sdeps '{:deps {com.datomic/peer,{:mvn/version"1.0.6726"}}}' -M -e "(require,'[datomic.api,:as,d])" --repl
user=> (d/q '[:find ?e :where [_ :k ?e]] [[0 :k 42]])
#{[42]}
the correct link is:
https://central.sonatype.com/artifact/com.datomic/peer/1.0.6726But for using peer we need a transactor running, right? I was trying to create a database and it fails (d/create-database "datomic:dev:/ /localhost:4400/teste?password=123")
, my intention is to run datomic without switching for other terminal and run bin/transactor
No. Just use (def conn (-> "datomic:<mem://hello|mem://hello>" (doto d/create-database) d/connect))
I'll try that, it works only for memory datomic? Or datomic:dev too?
I don't see any reason to work with datomic:dev locally. I only use datomic:dev when I was restoring a prod database locally to do some analysis The best part o datomic is that you can create memory databases and run integration tests as if it is an unit test, without mocking
I am exactly on a current work that I restore a lot prod database to run the processes with real data, the data Is really complex to manually add to datomic and Is a legacy system without good seeders. 🥲
There is docs about run a local transactor. It should be ok to run. But you need a license key in the config file.
Yes, thats actually achievable by downloading a datomic-pro and add the path to a var like DATOMIC_DIR, then run (sh "bin/transactor..."
. My point was to avoid this manual download and export manually a var. Then without this manually overheads I could add to a lib that would simplify my workflow on REPL.
I was reading bin/transactor and the command to start is exec java -server -cp
bin/classpath` $XMX $XMS $JAVA_OPTS clojure.main --main datomic.launcher "$@"` what made me think if I could run (datomic.launcher)
from a clojure file instead of using bash for it. But it seems easier create a dockerfile that runs a wget and start bin/transactor.