From f85cee2e2d1990e7c3a7b53b62b92dabe6422f9b Mon Sep 17 00:00:00 2001 From: Mihail Radkov Date: Tue, 24 Sep 2024 11:44:58 +0300 Subject: [PATCH 1/2] GDB-10532: Added configuration examples for GraphDB virtualization features The examples describe how to provide JDBC drives to GraphDB's classpath in two different ways, one of which is by copying them with `kubectl`. Added short description for a third option that includes an existing PV. --- examples/virtualization/README.md | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 examples/virtualization/README.md diff --git a/examples/virtualization/README.md b/examples/virtualization/README.md new file mode 100644 index 0000000..7b82e26 --- /dev/null +++ b/examples/virtualization/README.md @@ -0,0 +1,50 @@ +# GraphDB Virtualization Examples + +This folder contains examples of how to configure GraphDB's virtualization features by providing JDBC drivers to GraphDB's classpath. +See https://graphdb.ontotext.com/documentation/10.7/virtualization.html for more information and [Ontop](https://ontop-vkg.org/guide/) +configuration examples. + +## Using GraphDB Persistence + +For GraphDB to pick up and use JDBC drivers, their JAR files must be registered in the classpath. +The Helm chart configures GraphDB to expect JDBC drivers at `/opt/graphdb/home/jdbc-driver` from where the database will pick them up. +This detection is dynamic so you don't need to restart GraphDB when provisioning drivers. + +The directory `/opt/graphdb/home/jdbc-driver` is located inside the default persistence volume. +JDBC drivers that have been provisioned in this directory will be available between pod restarts and GraphDB updates. + +There are two common ways to provide drivers inside existing PV: + +* Using a custom init container that will download JDBC jars from the internet. +* Copying the files manually using `kubectl` or from another PV. + +This example will focus on copying JAR files with `kubectl`. + +For example, to configure GraphDB with a JDBC driver for PostgreSQL inside the GraphDB pod `graphdb-0`, you can use: + +```bash +kubectl cp postgresql-42.7.4.jar graphdb-0:/opt/graphdb/home/jdbc-driver/ +``` + +In case of a GraphDB cluster setup, you have to provide the driver to all pods: + +```bash +kubectl cp postgresql-42.7.4.jar graphdb-0:/opt/graphdb/home/jdbc-driver/ +kubectl cp postgresql-42.7.4.jar graphdb-1:/opt/graphdb/home/jdbc-driver/ +kubectl cp postgresql-42.7.4.jar graphdb-2:/opt/graphdb/home/jdbc-driver/ +``` + +## Using Another Persistence Volume + +Another option is to prepare a different PVC and PV, copy the JDBC drivers inside that PV and configure GraphDB to use this with: + +```yaml +extraVolumes: + - name: jdbc-drivers + persistentVolumeClaim: + claimName: jdbc-drivers + +extraVolumeMounts: + - name: jdbc-drivers + mountPath: /opt/graphdb/home/jdbc-driver +``` From dececfb6b0783850e1335d3b12e422228b5547df Mon Sep 17 00:00:00 2001 From: Mihail Radkov Date: Wed, 25 Sep 2024 09:00:20 +0300 Subject: [PATCH 2/2] GDB-10532: Added configuration examples for extra GraphDB plugins The examples describe how to provide plugin JARs to GraphDB's classpath in two different ways, one of which is by copying them with `kubectl`. Added short description for a third option that includes an existing PV. Configured `graphdb.extra.plugins` to load plugins from `/opt/graphdb/home/extra-plugins` by default. --- CHANGELOG.md | 1 + examples/plugins/README.md | 49 +++++++++++++++++++++ templates/graphdb/configmap-properties.yaml | 1 + 3 files changed, 51 insertions(+) create mode 100644 examples/plugins/README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6317d9b..f25c787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Cloud backups support uploading the GraphDB backup archives in one of the supported cloud object storage services, configured with `backup.cloud` - Added a new example under [examples/backup-local](examples/backup-local) showing how to use the local backup feature with `backup.local` - Added a new property `security.provisioner.passwordHash` to define an initial password for the provisioner user as a bcrypt hash. +- Configured `graphdb.extra.plugins` to load plugins from `/opt/graphdb/home/extra-plugins` by default ### Fixed diff --git a/examples/plugins/README.md b/examples/plugins/README.md new file mode 100644 index 0000000..5160ce6 --- /dev/null +++ b/examples/plugins/README.md @@ -0,0 +1,49 @@ +# GraphDB External Plugins Examples + +This folder contains examples of how to configure GraphDB with external plugins by providing them to the classpath. +See https://graphdb.ontotext.com/documentation/10.7/plug-in-api.html#adding-external-plugins-to-graphdb for more information and +configuration examples. + +## Using GraphDB Persistence + +For GraphDB to pick up and use external plugins, their JAR files must be registered in the classpath. +The Helm chart configures GraphDB to expect extra plugins at `/opt/graphdb/home/extra-plugins` from where the database will pick them up. + +The directory `/opt/graphdb/home/extra-plugins` is located inside the default persistence volume. +Any extra plugins that have been provisioned in this directory will be available between pod restarts and GraphDB updates. + +There are two common ways to provide extra plugins inside existing PV: + +* Using a custom init container that will download JARs from the internet or from other locations. +* Copying the files manually using `kubectl` from your local system or copying them from another PV. + +This example will focus on copying JAR files with `kubectl`. + +For example, to configure GraphDB with an external plugin inside the GraphDB pod `graphdb-0`, you can use: + +```bash +kubectl cp custom-plugin.jar graphdb-0:/opt/graphdb/home/extra-plugins/ +``` + +In case of a GraphDB cluster setup, you have to provide the plugin to all pods: + +```bash +kubectl cp custom-plugin.jar graphdb-0:/opt/graphdb/home/extra-plugins/ +kubectl cp custom-plugin.jar graphdb-1:/opt/graphdb/home/extra-plugins/ +kubectl cp custom-plugin.jar graphdb-2:/opt/graphdb/home/extra-plugins/ +``` + +## Using Another Persistence Volume + +Another option is to prepare a different PVC and PV, copy the plugins inside that PV and configure GraphDB to use it with: + +```yaml +extraVolumes: + - name: extra-plugins + persistentVolumeClaim: + claimName: graphdb-extra-plugins + +extraVolumeMounts: + - name: extra-plugins + mountPath: /opt/graphdb/home/extra-plugins +``` diff --git a/templates/graphdb/configmap-properties.yaml b/templates/graphdb/configmap-properties.yaml index 597c68c..a5a2469 100644 --- a/templates/graphdb/configmap-properties.yaml +++ b/templates/graphdb/configmap-properties.yaml @@ -17,6 +17,7 @@ data: graphdb.append.request.id.headers=true graphdb.workbench.importDirectory=/opt/graphdb/home/graphdb-import graphdb.ontop.jdbc.path=/opt/graphdb/home/jdbc-driver + graphdb.extra.plugins=/opt/graphdb/home/extra-plugins {{- if eq (int .Values.replicas) 1}} graphdb.external-url={{ include "graphdb.external-url" . }} {{- end }}