Open fooblahblah opened 5 years ago
There was mention of ~/.m2/settings.xml, but I haven't added any credentials there yet. Might that be my problem?
That seems like we misconfigured something on our end. The pro build still isn't tested yet. We'll get to that eventually as we also need it.
Since you're using pro I'm guessing you're using this professionally. Can I ask what company this is for?
This is for www.homebay.com and we have a larger Datomic instance backed by Dynamo.
I managed to spoof the issue above by populating my ~/.m2
directory with the datomic-pro jar and pom and then rebuilding which leinigen seemed happy with, thus building the uber jar. When I run metabase with the resulting jar it's detected and I get a configuration screen. When I try and configure the driver against a Datomic instance in our staging env which has a uri like datomic:ddb://us-east-1/fooblahblah-staging/bogus
I get the following:
07-08 15:21:56 INFO metabase.driver :: Registered driver :datomic 🚚
Load lazy loading driver :datomic took 674 ms
07-08 15:21:57 DEBUG middleware.log :: POST /api/setup/validate 400 896 ms (0 DB calls)
{:errors {:dbname "java.lang.ExceptionInInitializerError"}}
07-08 15:21:57 DEBUG middleware.log :: POST /api/setup/validate 400 1 ms (0 DB calls)
{:errors {:dbname "java.lang.NoClassDefFoundError: Could not initialize class datomic.ddb_cluster__init"}}
I've verified I'm able to access the instance from my machine so I don't think security perms are an issue. Seems to be some ddb related class loader issue?
Has anyone successfully connected to a pro Datomic out on AWS?
Note: I can connect to a local Datomic instance using the same jar and see some data so that's promising!
The fact that it's not finding the ddb classes probably means it's not actually using the pro library. You could try this as a hack/workaround
export CLASSPATH=`find ~/.m2 -name datomic-pro*.jar -print -quit`
# now start metabase
Ah, interesting. Ok, I'll keep poking at it. Thanks!
I re-ran metabase with the following command:
CLASSPATH=`find ~/.m2 -name "datomic-pro*.jar" -print -quit` java -jar metabase.jar
Still seeing the same classpath issue.
The result of the find command is:
$ find ~/.m2 -name "datomic-pro*.jar" -print -quit
/home/jsimpson/.m2/repository/com/datomic/datomic-pro/0.9.5786/datomic-pro-0.9.5786.jar
Also I had previously modified deps.edn
which is as follows:
{:paths ["../metabase-datomic/src"
"../metabase-datomic/resources"]
:deps {}
:aliases
{:metabase
{:extra-deps {org.clojure/clojure {:mvn/version "1.10.0"}
;; Apache Commons Lang, this seems to be a missing dependency of
;; the current master of Metabase (2019-05-09)
commons-lang {:mvn/version "2.4"}
metabase-core {:mvn/version "1.0.0-SNAPSHOT"
:scope "provided"}}}
:dev
{:extra-paths ["../metabase-datomic/dev"]
:extra-deps {nrepl {:mvn/version "0.6.0"}
vvvvalvalval/scope-capture {:mvn/version "0.3.2"}}}
:datomic-free
{:extra-deps {com.datomic/datomic-free {:mvn/version "0.9.5697"
:exclusions [org.slf4j/jcl-over-slf4j
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j
org.slf4j/slf4j-nop]}}}
:datomic-pro
{:extra-deps {com.datomic/datomic-pro {:mvn/version "0.9.5786"
:exclusions [org.slf4j/jcl-over-slf4j
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j
org.slf4j/slf4j-nop]}}
;; :mvn/repos
;; {"my.datomic.com" {:url "https://my.datomic.com/repo"}}}
}
:test
{:extra-paths ["../metabase/src"
"../metabase/test"
"../metabase-datomic/test"]
:jvm-opts ["-Dmb.db.file=metabase.datomic.test"
"-Dmb.jetty.port=3999"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-418"}
expectations {:mvn/version "2.2.0-beta2"}
nubank/matcher-combinators {:mvn/version "0.9.0"}}}}}
Here's the result of a lein build:
lein with-profiles +datomic-pro uberjar
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 -Duser.timezone=UTC
If there are a lot of uncached dependencies this might take a while ...
Warning: skipped duplicate file: metabase/driver/datomic.clj
Warning: skipped duplicate file: metabase/driver/datomic/fix_types.clj
Warning: skipped duplicate file: metabase/driver/datomic/monkey_patch.clj
Warning: skipped duplicate file: metabase/driver/datomic/query_processor.clj
Warning: skipped duplicate file: metabase/driver/datomic/util.clj
Warning: skipped duplicate file: metabase-plugin.yaml
Created /home/jsimpson/Downloads/metabase-datomic/target/uberjar+provided+datomic-pro/datomic-driver-1.0.0-SNAPSHOT-0.9.5697.jar
Created /home/jsimpson/Downloads/metabase-datomic/target/uberjar/datomic.metabase-driver.jar
Anything else seem amiss?
I am using a pretty new version of the pro jar, maybe an older one would have the correct function? i.e. I'll try 0.9.5697
and see if it matches the code better.
I reverted the change to deps.edn
and tried using 0.9.5561.62
, but still hitting the issue. I was using the following command:
CLASSPATH=/home/jsimpson/.m2/repository/com/datomic/datomic-pro/0.9.5561.62/datomic-pro-0.9.5561.62.jar java -jar metabase.jar
The plugin was rebuilt with lein and copied to plugins
.
Not sure how to proceed.
Maybe this is useful, but the uberjar seems to have the datomic classes baked, so maybe there's some other classloader issue going on?
$jar tvf /home/jsimpson/Downloads/metabase-datomic/target/uberjar/datomic.metabase-driver.jar | grep "ddb_cluster"
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 -Duser.timezone=UTC
3148 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster__init.class
3147 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$create_connection.class
1391 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$key_path.class
2994 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$loading__5569__auto____10955.class
1370 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$fn__11079.class
The output matches what I see in the datomic-pro jar in ~/.m2:
jar tvf /home/jsimpson/.m2/repository/com/datomic/datomic-pro/0.9.5561.62/datomic-pro-0.9.5561.62.jar| grep "ddb_cluster"
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 -Duser.timezone=UTC
3148 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster__init.class
3147 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$create_connection.class
1391 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$key_path.class
2994 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$loading__5569__auto____10955.class
1370 Thu Oct 05 18:33:42 UTC 2017 datomic/ddb_cluster$fn__11079.class
A short update here, we've also ran into various issues, the approach as documented creates an uberjar which includes metabase and its dependencies, all of them AOT compiled, which seems to mess things up. And on top of that it seems that the way Metabase's plugin mechanism modifies the classpath isn't good to enough for it to find and load the datomic classes in the uberjar.
Instead the best approach I've come up so far has been:
lein with-profiles +datomic-free jar
metabase/plugins
lein update-in :dependencies conj \
'[com.datomic/datomic-free "0.9.5697"
:exclusions [org.slf4j/jcl-over-slf4j
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j
org.slf4j/slf4j-nop]]' \
-- run -m metabase.core
You need the slf4j exclusions or slf4j will complain and refuse to start.
Well, this workaround is definitely not working. Is this project even alive still?
PR welcome @zilti. Sorry not sorry that people who gave you something for free are not doing more work for free to cater to your every need.
(Yes, this project is still "alive", whatever that means, I'll be pushing compatibility for the latest datomic soon)
Apologies for closing this abruptly, for an overburdened open source maintainer it's easy to hit a sore spot.
I'll improve the docs on this, what we are doing at the moment is patching project.clj to add datomic-pro in a profile, as well as putting the driver source on the classpath. We then use our own main function to start metabase and initialize the driver. This last bit is not necessary if you compile the driver with datomic-pro and put the jar on the classpath so metabase's plugin mechanism loads it, but I find it more reliable to bypass that plugin mechanism and to initialize the driver manually. It prevents issues with the driver being aot compiled against wrong dependencies (like the wrong datomic), and makes it easier when actually working on the driver.
See dev/user.clj
for an example of what that looks like.
In project.clj
:datomic
{:dependencies [[com.datomic/datomic-pro "1.0.6202" :exclusions [org.slf4j/jcl-over-slf4j
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j
org.slf4j/slf4j-nop]]
[com.amazonaws/aws-java-sdk-dynamodb "1.11.587"]
[com.amazonaws/aws-java-sdk-core "1.11.587"]
[com.amazonaws/aws-java-sdk-s3 "1.11.587"]]
:source-paths ["../metabase-datomic/src"
"../metabase-datomic/resources"]
:main foo.metabase-init}
Sorry as well. I didn't mean to come across rude. I actually got it to work with the Metabase version referred in the Dockerfile (v0.32.8), with datomic-pro. The issue with newer Metabase versions seem to be, among others, that the util.date namespace got replaced.
(Seems like for whatever reason it is pretty much unusable for my Datomic structure, but I haven't quite figured out yet why. It seems it doesn't correctly handle to-many relationships in my case. But that is another issue.)
Yeah, we're pinning to that version for now. IIRC there's also a big change in how metabase handles joins, and probably other stuff. They have zero interest in offering a stable API for drivers so upgrading is a PITA. I think eventually we will but it's not a priority for my client at the moment.
@zilti hello, could you please share the Dockerfile with the working changes? 🙏
Probably related to https://github.com/lambdaisland/metabase-datomic/issues/3, but I'm hitting the following error trying to build an uberjar for datomic pro