-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add basic proof of concept using proxy store * tidy and hook into existing CI * readme updates * add to publish ci * merge existing demo image with new image * move build to docker compose and tidy --------- Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com>
- Loading branch information
1 parent
a893cce
commit c20dee1
Showing
26 changed files
with
314 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2023-2024 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG BASE_IMAGE_NAME=tinkerpop/gremlin-server | ||
ARG BASE_IMAGE_TAG=3.7.1 | ||
|
||
# Base image provides WORKDIR, USER and ENTRYPOINT | ||
FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} | ||
|
||
# Copy JARS | ||
COPY ./target/dependency/*.jar ext/gafferpop/plugin/ | ||
|
||
# Copy configs | ||
COPY ./conf/ conf/ | ||
|
||
# Set server to run | ||
CMD ["conf/gaffer-gremlin-server.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# gaffer-gremlin | ||
|
||
## Build | ||
|
||
Run the supplied `build.sh` script with the required environment vars (can | ||
source `accumolo2.env` file) to pull all dependencies and build the container. | ||
|
||
_Note requires Maven and Docker_ | ||
|
||
Optionally run each command separately to configure the containers tags etc. | ||
|
||
## Configure | ||
|
||
The container will use the Gaffer Proxy store by default to connect to an | ||
existing graph and provide a Gremlin endpoint to connect to (see the [Tinkerpop docs](https://tinkerpop.apache.org/docs/current/reference/#connecting-gremlin-server)). | ||
|
||
The Gaffer graph the container will connect to can be configured as usual by | ||
editing the `store.properties` file, which you can also bind mount over on an | ||
existing image. The config file locations are under the predefined workdir | ||
set by the parent gremlin server image the key locations in the image are: | ||
|
||
- `/opt/gremlin-server/conf/gaffer/store.properties` - Override for custom store properties. | ||
- `/opt/gremlin-server/conf/gafferpop/gafferpop.properties` - Override to configure the graph. | ||
|
||
The configuration for the Gremlin server is provided by the `gaffer-gremlin-server.yaml` | ||
this again can be modified as needed or bind mounted over. Please see the | ||
[official Gaffer docs](https://gchq.github.io/gaffer-doc/latest/administration-guide/gaffer-deployment/gremlin/) | ||
for more information on configuring this image. | ||
|
||
## Run | ||
|
||
Simply run the container to publish the Gremlin server making sure to make the | ||
configured port available (port 8182 by default) this can then be connected to | ||
via the address specified in the server's yaml config to use Gremlin traversal. | ||
The server can then be connected via the Gremlin console e.g. if using | ||
`gremlinpython`: | ||
|
||
```python | ||
from gremlin_python.process.anonymous_traversal_source import traversal | ||
|
||
g = traversal().withRemote( | ||
DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')) | ||
``` | ||
|
||
### Demo Deployment | ||
|
||
A demo/example using the tinkerpop 'modern' dataset and accumulo backed Gaffer | ||
is available under the `example` directory. This can be ran using docker compose | ||
to deploy the containers then, the provided jupiter notebook demonstrates how to | ||
connect and some basic queries on the data using `gremlinpython`. | ||
|
||
Run the example with: | ||
|
||
```bash | ||
docker compose up | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# Copyright 2023-2024 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
declare SCRIPT_DIR="$(readlink -f "$(dirname "${0}")")" | ||
|
||
# Check if already have env var for version | ||
[[ -z "${GAFFER_VERSION}" ]] && \ | ||
echo "Missing GAFFER_VERSION env var" && \ | ||
exit 1 | ||
[[ -z "${TINKERPOP_VERSION}" ]] && \ | ||
echo "Missing TINKERPOP_VERSION env var" && \ | ||
exit 1 | ||
|
||
# Build from relevant directory | ||
pushd "${SCRIPT_DIR}" || exit 1 | ||
# Download JARs | ||
mvn clean dependency:copy-dependencies --define gaffer.version="${GAFFER_VERSION}" | ||
|
||
# Build container | ||
docker compose build | ||
|
||
# Clean | ||
mvn clean | ||
popd || exit 1 | ||
|
||
echo "Build Successful" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
version: "3.7" | ||
|
||
services: | ||
gaffer-gremlin: | ||
image: gchq/gaffer-gremlin:${GAFFER_VERSION}-gremlin-${TINKERPOP_VERSION} | ||
build: | ||
context: . | ||
args: | ||
BASE_IMAGE_TAG: ${TINKERPOP_VERSION} | ||
ports: | ||
- 8182:8182 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright 2023-2024 Crown Copyright | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
gaffer.store.class=uk.gov.gchq.gaffer.proxystore.ProxyStore | ||
# These can be configured to an existing graph deployment | ||
gaffer.host=localhost | ||
gaffer.port=8080 | ||
gaffer.context-root=/rest/latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.