Coder Social home page Coder Social logo

Comments (17)

fooblahblah avatar fooblahblah commented on May 18, 2024

There was mention of ~/.m2/settings.xml, but I haven't added any credentials there yet. Might that be my problem?

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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?

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

This is for www.homebay.com and we have a larger Datomic instance backed by Dynamo.

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

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!

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

Ah, interesting. Ok, I'll keep poking at it. Thanks!

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

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?

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

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.

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

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.

from metabase-datomic.

fooblahblah avatar fooblahblah commented on May 18, 2024

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

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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:

  • build a regular jar, not an uberjar. so no AOT, and only package the driver namespaces. e.g. lein with-profiles +datomic-free jar
  • copy this jar to metabase/plugins
  • add the datomic dependency (pro or free) directly to metabase. Either update metabase's project.clj, or do something like
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.

from metabase-datomic.

zilti avatar zilti commented on May 18, 2024

Well, this workaround is definitely not working. Is this project even alive still?

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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)

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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}

from metabase-datomic.

zilti avatar zilti commented on May 18, 2024

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.)

from metabase-datomic.

plexus avatar plexus commented on May 18, 2024

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.

from metabase-datomic.

ballad89 avatar ballad89 commented on May 18, 2024

@zilti hello, could you please share the Dockerfile with the working changes? 🙏

from metabase-datomic.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.