Metabase - ElasticBeanStalk - Athena

Hi my company had an existing Metabase instance set up in AWS Elastic Beanstalk. Everything was running just fine. We have been developing a Data Lake which we currently access through Athena. I was tasked with adding the Athena drivers to our current implementation. I have successfully updated the Metabase version to v.0.36.4 and through the DockerFile I have been able to download the dacort Athena driver into the containers /plugins directory, here is an entry from the EB logs:

e[0me[91msaving to ‘athena.metabase-driver.jar’
e[0me[91mathena.metabase-driv 65% |********************* | 6089k 0:00:00 ETA
e[0me[91mathena.metabase-driv 100% |********************************| 9252k 0:00:00 ETA
‘athena.metabase-driver.jar’ saved
e[0mRemoving intermediate container 6999c6249324

And the command I run from my DockerFile to get the driver:

RUN cd /plugins && wget https://github.com/dacort/metabase-athena-driver/releases/download/v1.1.0/athena.metabase-driver.jar

Now when I log into our Metabase instance and go to Add Database AWS Athena doesn’t show up in the list.

Any ideas on how this can be resolved?

-Kris

Hi @breakaway9
Check the log during startup - it will tell you of any problems with loading drivers.
My first guess is that it has something to do with file permissions.

Okay I tried chmoding that file to 777 and had no success, the logs indicate that the command ran successfully but still no AWS Athena in the menu when adding a database.

@breakaway9 I think you misunderstood - the log will show which drivers are being loaded during startup.

I understood, and there were no references in the logs to the athena driver being loaded, or an attempt to load the driver. It basically just said the .jar file was downloaded. I set the permissions to wide open for testing based on your suggestion that it may be a permissions issue. I see other drivers being loaded but there is no mention in that section about the athena driver…

@breakaway9 Post the startup log.

Sorry I found something, it was not showing up in the “last 100 lines” log I was looking at before, this seems to be the issue:

08-24 17:18:02 e[1mWARN metabase.pluginse[0m :: Metabase cannot use the plugins directory /plugins
Please make sure the directory exists and that Metabase has permission to write to it. You can change the directory Metabase uses for modules by setting the environment variable MB_PLUGINS_DIR. Falling back to a temporary directory for now.
java.lang.AssertionError: Assert failed: Metabase does not have permissions to write to plugins directory /plugins
(Files/isWritable path)

Okay in an attempt to fix the permissions error so that Metabase can write to the /plugins directory, I have changed the Dockerfile to this :

RUN chmod 777 /plugins && cd /plugins && wget github link && chmod 777 athena.metabase-driver.jar

And here is the top of the startup log file:

`Warning: environ value jdk-11.0.8+10 for key :java-version has been overwritten with 11.0.8
08-24 18:00:11 e[1mINFO metabase.utile[0m :: Loading Metabase…
08-24 18:00:11 e[1mINFO metabase.utile[0m :: Maximum memory available to JVM: 1.9 GB
WARNING: not-empty already refers to: #'clojure.core/not-empty in namespace: metabase.mbql.schema, being replaced by: #'metabase.mbql.schema/not-empty
08-24 18:00:22 e[1mINFO util.encryptione[0m :: Saved credentials encryption is DISABLED for this Metabase instance. :unlock:
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
08-24 18:00:28 e[1mWARN metabase.coree[0m :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
08-24 18:00:28 e[1mINFO metabase.coree[0m :: Starting Metabase in STANDALONE mode
08-24 18:00:28 e[1mINFO metabase.servere[0m :: Launching Embedded Jetty Webserver with config:
{:port 3000, :host “0.0.0.0”}

08-24 18:00:28 e[1mINFO metabase.coree[0m :: Starting Metabase version v0.36.4 (196c1f6 release-0.36.x) …
08-24 18:00:28 e[1mINFO metabase.coree[0m :: System info:
{“file.encoding” “UTF-8”,
“java.runtime.name” “OpenJDK Runtime Environment”,
“java.runtime.version” “11.0.8+10”,
“java.vendor” “AdoptOpenJDK”,
“java.vendor.url” “https://adoptopenjdk.net/”,
“java.version” “11.0.8”,
“java.vm.name” “OpenJDK 64-Bit Server VM”,
“java.vm.version” “11.0.8+10”,
“os.name” “Linux”,
“os.version” “4.14.152-98.182.amzn1.x86_64”,
“user.language” “en”,
“user.timezone” “GMT”}

08-24 18:00:29 e[1mWARN metabase.pluginse[0m :: Metabase cannot use the plugins directory /plugins
Please make sure the directory exists and that Metabase has permission to write to it. You can change the directory Metabase uses for modules by setting the environment variable MB_PLUGINS_DIR. Falling back to a temporary directory for now.
java.lang.AssertionError: Assert failed: Metabase does not have permissions to write to plugins directory /plugins
(Files/isWritable path)
at metabase.plugins$fn__71034$fn__71035.invoke(plugins.clj:28)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2320)
at clojure.core$deref.invoke(core.clj:2306)
at metabase.plugins$plugins_dir.invokeStatic(plugins.clj:50)
at metabase.plugins$plugins_dir.invoke(plugins.clj:50)
at metabase.plugins$load_BANG_.invokeStatic(plugins.clj:140)
at metabase.plugins$load_BANG_.invoke(plugins.clj:139)
at metabase.plugins$fn__71111$fn__71112.invoke(plugins.clj:147)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2320)
at clojure.core$deref.invoke(core.clj:2306)
at metabase.plugins$load_plugins_BANG_.invokeStatic(plugins.clj:149)
at metabase.plugins$load_plugins_BANG_.invoke(plugins.clj:149)
at metabase.core$init_BANG_.invokeStatic(core.clj:66)
at metabase.core$init_BANG_.invoke(core.clj:54)
at metabase.core$start_normally.invokeStatic(core.clj:119)
at metabase.core$start_normally.invoke(core.clj:113)
at metabase.core$_main.invokeStatic(core.clj:152)
at metabase.core$_main.doInvoke(core.clj:146)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
08-24 18:00:29 e[1mINFO metabase.pluginse[0m :: Loading plugins in /tmp…
e[32mExtract file /modules/snowflake.metabase-driver.jar -> /tmp/snowflake.metabase-driver.jar took 215.2 mse[0m
e[32mExtract file /modules/googleanalytics.metabase-driver.jar -> /tmp/googleanalytics.metabase-driver.jar took 6.5 mse[0m
e[32mExtract file /modules/druid.metabase-driver.jar -> /tmp/druid.metabase-driver.jar took 3.9 mse[0m
e[32mExtract file /modules/redshift.metabase-driver.jar -> /tmp/redshift.metabase-driver.jar took 16.0 mse[0m
e[32mExtract file /modules/sparksql.metabase-driver.jar -> /tmp/sparksql.metabase-driver.jar took 398.2 mse[0m`

Is this what you were looking for?

@breakaway9 It says pretty clearly what the problem is. That was why I asked for the startup log.
Otherwise use MB_PLUGINS_DIR to define your own directory, you know exists and has the correct permissions.

That’s why I posted the Dockerfile statement, shouldn’t that be giving the /plugins directory permissions and for good measure the athena jar file permissions as well?

@breakaway9 Post the entire Dockerfile.
Metabase already creates the directory and sets permissions:
https://github.com/metabase/metabase/blob/master/bin/docker/Dockerfile

Thanks flamber I finally fixed it by just copying the athena jar file to /tmp and just ignoring anything to do with the /plugins folder.

@breakaway9 Remember that will be lost if you reboot the EBS. You might want to have a look at this:
Installing plugins (Oracle driver) on an AWS EB instance

That’s funny, that’s where I started off trying to get this to work…

@breakaway9 That would have been good if you started by saying that. I guess something went wrong, since your /plugins has become non-writable for the Metabase process (2000:2000).