This is not necessarily a better way, but just a slight variation from OP’s solution that does not require a “accessible-oracle-driver-url”. So if you have a copy of ojdbcX.jar
, but not sure how to serve it over a url, then this will be easier for you.
First, you need the EB deployment .zip file for metabase. If you already deployed base install to EB, then you can download from Application Versions. Or you can find link to it on Metabase documentation page for running Metabase on Elastic Beanstalk under the Deploying new versions of Metabase section.
Unzip it to metabase-aws-eb/
. In the same folder save your copy of ojdbcX.jar
. It should be at same level as the Dockerrun.aws.json
file.
Edit Dockerrun.aws.json
same way OP did to add the Volumes
"Volumes": [
{
"HostDirectory": "/opt/plugins", "ContainerDirectory": "/plugins"
}
]
The host location is up to you as there is no standard that I am aware of. I chose /opt/plugins
.
For those like me who are not Docker experts: This will mount the file location of /opt/plugins
on the EC2 instance to /plugins
in the Docker container that is running on the EC2 instance.
The choice of /plugins
for the container is because that is the default plugin location Metabase uses for docker deployments.
This by itself is not enough. We still need EB to automatically create the /opt/plugins
folder and place the ojdbcX.jar
file in it whenever it deploys a new EC2 instance.
EB advanced configurations use the .ebextensions
folder which you should notice is also in metabase-aws-eb/
. Edit the file 01_metabase.config
and add the following container commands to the end of the list (but before the option settings).
06_plugins:
command: "mkdir /opt/plugins && chmod 777 /opt/plugins"
ignoreErrors: true
07_install_oracle_driver:
command: "cp ojdbc6.jar /opt/plugins"
ignoreErrors: true
Obviously, if you chose a different path, replace references to /opt/plugins
. Keep in mind this is YAML syntax so indentation matters.
Now re-zip the files you unzipped including the Oracle driver. Upload zip file to EB as a new Application Version and deploy it.
Again for the those of us not Docker experts: Whenever a new EC2 instance or application version is deployed, the contents of metabase-aws-eb.zip
are extracted to /var/app/current/
on the EC2 instance. This now includes our Oracle driver we packaged. Before the application is started, these container commands will be run on the EC2 instance (not within the container). So this creates the /opt/plugins
directory we specified for the HostDirectory
, then copies the Oracle driver to that directory. The chmod
command is to make sure the Docker process can also write to this directory as all these container commands are executed as root user. This is needed for our case because when Metabase deploys it unpacks several .jar
files to the same /plugins
folder inside the container.
You can verify Oracle driver was properly installed by either attempting to set up an Oracle database in Metabase or check the Metabase logs in the Admin section under Troubleshooting.