From 72537c1249e0a835ba0c41319df9df7f1b67ff51 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:32:39 +0100 Subject: [PATCH 1/9] Gh 318: Fix integration tests (#319) * Add tester version to integration test workflow * Update tag structure in ITs * Change ITs to use docker compose --- .github/workflows/integration-test.yaml | 31 +++---------------- docker/accumulo1.env | 1 + docker/accumulo2.env | 1 + .../docker-compose.yaml | 8 ++--- .../docker-compose.yaml | 8 ++--- kubernetes/gaffer/integration-tests.yaml | 4 +-- kubernetes/gaffer/values.yaml | 2 +- 7 files changed, 18 insertions(+), 37 deletions(-) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index 5b29e53f..af6c07fc 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -23,35 +23,14 @@ jobs: runs-on: ubuntu-latest env: GAFFER_VERSION: develop - steps: + GAFFER_TESTER_VERSION: develop + steps: - uses: actions/checkout@v3 - - name: Build images - run: | - source ./docker/accumulo/.env - docker compose --project-directory ./docker/accumulo/ -f ./docker/accumulo/docker-compose.yaml build - docker compose --project-directory ./docker/gaffer/ -f ./docker/gaffer/docker-compose.yaml build - docker compose --project-directory ./docker/gaffer-integration-tests/ -f ./docker/gaffer-integration-tests/docker-compose.yaml build - - - name: Install Helm charts - run: ./cd/install_dependencies.sh - - - name: Start KinD - run: | - source ./docker/accumulo/.env - kind create cluster --config ./cd/kind.yaml --image kindest/node:v1.24.4 - kind load docker-image gchq/hdfs:$HADOOP_VERSION - kind load docker-image gchq/gaffer:$GAFFER_VERSION-accumulo-$ACCUMULO_VERSION - kind load docker-image gchq/gaffer-rest:$GAFFER_VERSION-accumulo-$ACCUMULO_VERSION - kind load docker-image gchq/gaffer-integration-tests:$GAFFER_VERSION-accumulo-$ACCUMULO_VERSION - - - name: Deploy Gaffer - run: | - helm install gaffer ./kubernetes/gaffer --timeout=6m -f ./kubernetes/gaffer/integration-tests.yaml \ - --set accumulo.hdfs.config.hdfsSite."dfs\.namenode\.datanode\.registration\.ip-hostname-check"=false - - name: Run Integration Tests - run: helm test gaffer --timeout=40m + run: | + cd docker/gaffer-integration-tests/ + docker compose up --exit-code-from gaffer-integration-tests - name: Send success message to ms teams if: ${{ success()}} diff --git a/docker/accumulo1.env b/docker/accumulo1.env index 9dafe00e..570967fb 100644 --- a/docker/accumulo1.env +++ b/docker/accumulo1.env @@ -4,5 +4,6 @@ ACCUMULO_VERSION=1.9.3 HADOOP_CONF_DIR=/etc/hadoop/conf ACCUMULO_CONF_DIR=/etc/accumulo/conf GAFFER_VERSION=2.0.0 +GAFFER_TESTER_VERSION=2.0.0 GAFFERPY_VERSION=2.0.0 SPARK_VERSION=3.1.2 diff --git a/docker/accumulo2.env b/docker/accumulo2.env index 4d0e533b..d4d48ddb 100644 --- a/docker/accumulo2.env +++ b/docker/accumulo2.env @@ -4,5 +4,6 @@ ACCUMULO_VERSION=2.0.1 HADOOP_CONF_DIR=/etc/hadoop/conf ACCUMULO_CONF_DIR=/etc/accumulo/conf GAFFER_VERSION=2.0.0 +GAFFER_TESTER_VERSION=2.0.0 GAFFERPY_VERSION=2.0.0 SPARK_VERSION=3.1.2 diff --git a/docker/gaffer-federated-integration-tests/docker-compose.yaml b/docker/gaffer-federated-integration-tests/docker-compose.yaml index 6221dee6..7fcc4a86 100644 --- a/docker/gaffer-federated-integration-tests/docker-compose.yaml +++ b/docker/gaffer-federated-integration-tests/docker-compose.yaml @@ -96,9 +96,7 @@ services: GAFFER_VERSION: ${GAFFER_VERSION} BASE_IMAGE_NAME: gchq/accumulo BASE_IMAGE_TAG: ${ACCUMULO_VERSION} - # Before calling entrypoint, create a delayed background process that - # will correctly setup auths so that tests can run - entrypoint: bash -c '{ sleep 150; ./opt/accumulo/bin/accumulo shell -u root -p secret -e "setauths -u root -s vis1,vis2,publicVisibility,privateVisibility,public,private"; } & /entrypoint.sh accumulo master' + command: master container_name: accumulo-master hostname: accumulo-master environment: @@ -117,7 +115,9 @@ services: interval: 30s timeout: 5s retries: 3 - command: tserver + # Before calling entrypoint, create a background process that + # will correctly setup auths so that tests can run + entrypoint: bash -c '{ ./opt/accumulo/bin/accumulo shell -u root -p secret -e "setauths -u root -s vis1,vis2,publicVisibility,privateVisibility,public,private"; } & /entrypoint.sh accumulo tserver' container_name: accumulo-tserver hostname: accumulo-tserver environment: diff --git a/docker/gaffer-integration-tests/docker-compose.yaml b/docker/gaffer-integration-tests/docker-compose.yaml index 8071b5ee..028f99b2 100644 --- a/docker/gaffer-integration-tests/docker-compose.yaml +++ b/docker/gaffer-integration-tests/docker-compose.yaml @@ -96,9 +96,7 @@ services: GAFFER_VERSION: ${GAFFER_VERSION} BASE_IMAGE_NAME: gchq/accumulo BASE_IMAGE_TAG: ${ACCUMULO_VERSION} - # Before calling entrypoint, create a delayed background process that - # will correctly setup auths so that tests can run - entrypoint: bash -c '{ sleep 150; ./opt/accumulo/bin/accumulo shell -u root -p secret -e "setauths -u root -s vis1,vis2,publicVisibility,privateVisibility,public,private"; } & /entrypoint.sh accumulo master' + command: master container_name: accumulo-master hostname: accumulo-master environment: @@ -117,7 +115,9 @@ services: interval: 30s timeout: 5s retries: 3 - command: tserver + # Before calling entrypoint, create a background process that + # will correctly setup auths so that tests can run + entrypoint: bash -c '{ ./opt/accumulo/bin/accumulo shell -u root -p secret -e "setauths -u root -s vis1,vis2,publicVisibility,privateVisibility,public,private"; } & /entrypoint.sh accumulo tserver' container_name: accumulo-tserver hostname: accumulo-tserver environment: diff --git a/kubernetes/gaffer/integration-tests.yaml b/kubernetes/gaffer/integration-tests.yaml index 40aa04b1..698fe6fe 100644 --- a/kubernetes/gaffer/integration-tests.yaml +++ b/kubernetes/gaffer/integration-tests.yaml @@ -15,7 +15,7 @@ api: user: root image: - tag: develop + tag: develop-accumulo-2.0.1 test: runIntegrationTests: true @@ -23,7 +23,7 @@ test: accumulo: image: - tag: develop + tag: develop-accumulo-2.0.1 hdfs: postInstallCommands: - hadoop fs -mkdir -p /accumulo diff --git a/kubernetes/gaffer/values.yaml b/kubernetes/gaffer/values.yaml index 02579faa..6f9fafea 100644 --- a/kubernetes/gaffer/values.yaml +++ b/kubernetes/gaffer/values.yaml @@ -52,7 +52,7 @@ test: images: integration: repository: gchq/gaffer-integration-tests - tag: develop + tag: develop-accumulo-2.0.1 curl: repository: curlimages/curl tag: 7.67.0 From f13bb50e56e6faa236688bea4bf6401f2966eeb2 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Fri, 30 Jun 2023 15:13:28 +0100 Subject: [PATCH 2/9] Gh-322: Added gremlin gaffer image and compose (#323) * Added gremlin gaffer image and compose --------- Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> --- docker/gremlin-gaffer/.env | 7 + docker/gremlin-gaffer/Dockerfile | 51 +++++ docker/gremlin-gaffer/README.md | 39 ++++ .../gafferpop/gaffer/schema/elements.json | 52 +++++ .../conf/gafferpop/gaffer/schema/types.json | 22 ++ .../conf/gafferpop/gaffer/store.properties | 24 +++ .../gafferpop-tinkerpop-modern.properties | 20 ++ docker/gremlin-gaffer/conf/graphConfig.json | 3 + .../conf/gremlin-server-empty-gaffer.yaml | 43 ++++ docker/gremlin-gaffer/docker-compose.yaml | 203 ++++++++++++++++++ docker/gremlin-gaffer/files/.gitignore | 2 + .../gremlin-gaffer-modern-example.ipynb | 136 ++++++++++++ 12 files changed, 602 insertions(+) create mode 100644 docker/gremlin-gaffer/.env create mode 100644 docker/gremlin-gaffer/Dockerfile create mode 100644 docker/gremlin-gaffer/README.md create mode 100644 docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json create mode 100644 docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json create mode 100644 docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties create mode 100644 docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties create mode 100644 docker/gremlin-gaffer/conf/graphConfig.json create mode 100644 docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml create mode 100644 docker/gremlin-gaffer/docker-compose.yaml create mode 100644 docker/gremlin-gaffer/files/.gitignore create mode 100644 docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb diff --git a/docker/gremlin-gaffer/.env b/docker/gremlin-gaffer/.env new file mode 100644 index 00000000..b9a28848 --- /dev/null +++ b/docker/gremlin-gaffer/.env @@ -0,0 +1,7 @@ +ZOOKEEPER_VERSION=3.7.1 +GAFFER_VERSION=2.0.0 +GREMLIN_VERSION=3.6.4 +ACCUMULO_VERSION=2.0.1 +HADOOP_VERSION=3.3.3 +ACCUMULO_CONF_DIR=/etc/accumulo/conf +HADOOP_CONF_DIR=/etc/hadoop/conf diff --git a/docker/gremlin-gaffer/Dockerfile b/docker/gremlin-gaffer/Dockerfile new file mode 100644 index 00000000..ffb80399 --- /dev/null +++ b/docker/gremlin-gaffer/Dockerfile @@ -0,0 +1,51 @@ +# Copyright 2023 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 BUILDER_IMAGE_NAME=maven +ARG BUILDER_IMAGE_TAG=3.8.4-jdk-8 + +ARG BASE_IMAGE_NAME=tinkerpop/gremlin-server +ARG BASE_IMAGE_TAG=3.6.4 + +FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder + +ARG BASE_IMAGE_TAG +ARG GAFFER_VERSION=2.0.0 +ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 +ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git + +WORKDIR /jars + +# Allow users to provide their own JAR files +COPY ./files/ . +# Try to download required version from Maven Central, otherwise build from source +RUN allFilesDownloaded="TRUE" && \ + if [ ! -f "./tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" ] && [ "${allFilesDownloaded}" = "TRUE" ]; then \ + wget -nv "${GAFFER_DOWNLOAD_URL}/uk/gov/gchq/gaffer/tinkerpop/${GAFFER_VERSION}/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" || allFilesDownloaded="FALSE"; \ + fi && \ + if [ "${allFilesDownloaded}" = "FALSE" ]; then \ + git clone ${GAFFER_GIT_REPO} /tmp/gaffer && \ + cd /tmp/gaffer && \ + git checkout ${GAFFER_VERSION} || git checkout gaffer2-${GAFFER_VERSION} && \ + mvn clean package -Pquick -pl :tinkerpop && \ + if [ ! -f "/jars/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" ]; then \ + cp ./library/tinkerpop/target/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar /jars; \ + fi \ + fi + +FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} +COPY --from=builder --chown=root:root /jars/*.jar ext/gafferpop/plugin/ +COPY ./conf/gafferpop/ conf/gafferpop/ +COPY ./conf/gremlin-server-empty-gaffer.yaml conf/gremlin-server-empty-gaffer.yaml +CMD ["conf/gremlin-server-empty-gaffer.yaml"] diff --git a/docker/gremlin-gaffer/README.md b/docker/gremlin-gaffer/README.md new file mode 100644 index 00000000..018e76d6 --- /dev/null +++ b/docker/gremlin-gaffer/README.md @@ -0,0 +1,39 @@ +Gremlin Gaffer Plugin +====== +In this folder you can find the required files for building and running a gremlin-server with the Gaffer plugin loaded. + +The Docker image uses TinkerPop's gremlin-server with GafferPop config and plugin jars added in. +When run with docker compose it will provide you a full accumulo ecosystem complete with [hdfs](../hdfs) and the [Gaffer REST API](../gaffer-rest). + +# Running Locally +The easiest way to build and run these services is to use docker compose, by running the following from this directory: +```bash +docker compose up +``` + +## Example Notebook +See `gremlin-gaffer-modern-example.ipynb` for an example using the "TinkerPop Modern" demo graph. + +## Customising the build +Custom Gaffer TinkerPop plugin jars can be added in the files directory. The Gaffer schema, store properties and gafferpop properties can be found in `conf/gafferpop` and are customised in a docker compose build using volumes. The `gremlin-server-empty-gaffer.yaml` cannot be overwritten in a volume, it must be built into the image. + +## Containers that are started: +* Zookeeper +* HDFS + * Datanode + * Namenode +* Accumulo + * Monitor + * GC + * tserver + * Master +* Gaffer REST +* Gremlin Server with GafferPop + +Access the HDFS NameNode web UI at: http://localhost:9870 + +Access the Accumulo Monitor UI at: http://localhost:9995 + +Access the Gaffer REST API at: http://localhost:8080/rest/ + +Access the Gremlin Server with GafferPop at: http://localhost:8182/ diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json b/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json new file mode 100644 index 00000000..7508117d --- /dev/null +++ b/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json @@ -0,0 +1,52 @@ +{ + "entities": { + "person": { + "vertex": "person", + "properties": { + "name": "name.string", + "age": "age.integer" + }, + "aggregate": false + }, + "software": { + "vertex": "software", + "properties": { + "name": "name.string", + "lang": "name.string" + }, + "aggregate": false + } + }, + "edges": { + "knows": { + "source": "person", + "destination": "person", + "directed": "true", + "properties": { + "weight": "weight.double" + }, + "aggregate": false + }, + "created": { + "source": "person", + "destination": "software", + "directed": "true", + "properties": { + "weight": "weight.double" + }, + "aggregate": false + }, + "dependsOn": { + "source": "software", + "destination": "software", + "directed": "true", + "aggregate": false + }, + "encapsulates": { + "source": "software", + "destination": "software", + "directed": "true", + "aggregate": false + } + } +} diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json b/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json new file mode 100644 index 00000000..95784312 --- /dev/null +++ b/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json @@ -0,0 +1,22 @@ +{ + "types": { + "person": { + "class": "java.lang.String" + }, + "software": { + "class": "java.lang.String" + }, + "true": { + "class": "java.lang.Boolean" + }, + "name.string": { + "class": "java.lang.String" + }, + "age.integer": { + "class": "java.lang.Integer" + }, + "weight.double": { + "class": "java.lang.Double" + } + } +} diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties b/docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties new file mode 100644 index 00000000..efb5b466 --- /dev/null +++ b/docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties @@ -0,0 +1,24 @@ +# +# Copyright 2016-2023 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.accumulostore.AccumuloStore +gaffer.store.properties.class=uk.gov.gchq.gaffer.accumulostore.AccumuloProperties +accumulo.instance=accumulo +accumulo.zookeepers=zookeeper +accumulo.user=root +accumulo.password=secret +# General store config +gaffer.cache.service.class=uk.gov.gchq.gaffer.cache.impl.HashMapCacheService +gaffer.store.job.tracker.enabled=true diff --git a/docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties b/docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties new file mode 100644 index 00000000..2bb1fbfb --- /dev/null +++ b/docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties @@ -0,0 +1,20 @@ +# +# Copyright 2016-2023 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. +# +gremlin.graph=uk.gov.gchq.gaffer.tinkerpop.GafferPopGraph +gaffer.graphId=graph1 +gaffer.storeproperties=conf/gafferpop/gaffer/store.properties +gaffer.schemas=conf/gafferpop/gaffer/schema/ +gaffer.userId=user01 diff --git a/docker/gremlin-gaffer/conf/graphConfig.json b/docker/gremlin-gaffer/conf/graphConfig.json new file mode 100644 index 00000000..57f97103 --- /dev/null +++ b/docker/gremlin-gaffer/conf/graphConfig.json @@ -0,0 +1,3 @@ +{ + "graphId": "graph1" +} \ No newline at end of file diff --git a/docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml b/docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml new file mode 100644 index 00000000..0fae7ec1 --- /dev/null +++ b/docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml @@ -0,0 +1,43 @@ +# Copyright 2023 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. + +host: localhost +port: 8182 +evaluationTimeout: 30000 +graphs: { + graph: conf/gafferpop/gafferpop-tinkerpop-modern.properties} +scriptEngines: { + gremlin-groovy: { + plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + uk.gov.gchq.gaffer.tinkerpop.gremlinplugin.GafferPopGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {enableThreadInterrupt: true}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}} + } +} +serializers: + - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} # application/vnd.graphbinary-v1.0-stringd + +metrics: { + slf4jReporter: {enabled: true, interval: 180000}} +strictTransactionManagement: false +idleConnectionTimeout: 0 +keepAliveInterval: 0 +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 10485760 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +enableAuditLog: true diff --git a/docker/gremlin-gaffer/docker-compose.yaml b/docker/gremlin-gaffer/docker-compose.yaml new file mode 100644 index 00000000..4bb32592 --- /dev/null +++ b/docker/gremlin-gaffer/docker-compose.yaml @@ -0,0 +1,203 @@ +# Copyright 2020-2023 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: + + zookeeper: + image: zookeeper:${ZOOKEEPER_VERSION} + healthcheck: + test: echo ruok | nc 127.0.0.1 2181 | grep imok + interval: 30s + timeout: 5s + retries: 3 + container_name: zookeeper + hostname: zookeeper + environment: + - ZOO_SERVERS=server.1=zookeeper:2888:3888;2181 + - ZOO_4LW_COMMANDS_WHITELIST=* + volumes: + - /data + - /datalog + + hdfs-namenode: + image: gchq/hdfs:${HADOOP_VERSION} + depends_on: + zookeeper: + condition: service_healthy + healthcheck: + test: curl -f http://localhost:9870 || exit 1 + interval: 30s + timeout: 10s + retries: 3 + build: + context: ../hdfs/ + args: + HADOOP_VERSION: ${HADOOP_VERSION} + command: namenode + container_name: hdfs-namenode + hostname: hdfs-namenode + environment: + - HADOOP_CONF_DIR=${HADOOP_CONF_DIR} + ports: + - 9870:9870 + volumes: + - ../hdfs/conf:${HADOOP_CONF_DIR}:ro + - /var/log/hadoop + - /data1 + - /data2 + + hdfs-datanode: + image: gchq/hdfs:${HADOOP_VERSION} + depends_on: + hdfs-namenode: + condition: service_healthy + command: datanode + container_name: hdfs-datanode + hostname: hdfs-datanode + environment: + - HADOOP_CONF_DIR=${HADOOP_CONF_DIR} + volumes: + - ../hdfs/conf:${HADOOP_CONF_DIR}:ro + - /var/log/hadoop + - /data1 + - /data2 + + accumulo-master: + image: gchq/gaffer:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + depends_on: + hdfs-namenode: + condition: service_healthy + healthcheck: + test: cat /proc/net/tcp | grep 270F + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s + build: + context: . + args: + GAFFER_VERSION: ${GAFFER_VERSION} + BASE_IMAGE_NAME: gchq/accumulo + BASE_IMAGE_TAG: ${ACCUMULO_VERSION} + command: master + container_name: accumulo-master + hostname: accumulo-master + environment: + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + # There doesn't seem to be an easy way (with docker-compose) to init our + # HDFS instance with the right permissions so that Accumulo can create the + # file structure it needs. Using the following workaround to allow + # accumulo to "auth" with HDFS as the super user so that it can: + - HADOOP_USER_NAME=hadoop + volumes: + - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - /var/log/accumulo + + accumulo-tserver: + image: gchq/gaffer:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + depends_on: + accumulo-master: + condition: service_healthy + healthcheck: + test: cat /proc/net/tcp | grep 270D + interval: 30s + timeout: 5s + retries: 3 + command: tserver + container_name: accumulo-tserver + hostname: accumulo-tserver + environment: + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + # There doesn't seem to be an easy way (with docker-compose) to init our + # HDFS instance with the right permissions so that Accumulo can create the + # file structure it needs. Using the following workaround to allow + # accumulo to "auth" with HDFS as the super user so that it can: + - HADOOP_USER_NAME=hadoop + volumes: + - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - /var/log/accumulo + + accumulo-monitor: + image: gchq/gaffer:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + depends_on: + accumulo-master: + condition: service_healthy + command: monitor + container_name: accumulo-monitor + hostname: accumulo-monitor + environment: + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + # There doesn't seem to be an easy way (with docker-compose) to init our + # HDFS instance with the right permissions so that Accumulo can create the + # file structure it needs. Using the following workaround to allow + # accumulo to "auth" with HDFS as the super user so that it can: + - HADOOP_USER_NAME=hadoop + ports: + - 9995:9995 + volumes: + - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - /var/log/accumulo + + accumulo-gc: + image: gchq/gaffer:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + depends_on: + accumulo-master: + condition: service_healthy + command: gc + container_name: accumulo-gc + hostname: accumulo-gc + environment: + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + # There doesn't seem to be an easy way (with docker-compose) to init our + # HDFS instance with the right permissions so that Accumulo can create the + # file structure it needs. Using the following workaround to allow + # accumulo to "auth" with HDFS as the super user so that it can: + - HADOOP_USER_NAME=hadoop + volumes: + - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - /var/log/accumulo + + gaffer-rest: + image: gchq/gaffer-rest:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + depends_on: + accumulo-tserver: + condition: service_healthy + build: + context: ../gaffer-rest/ + args: + GAFFER_VERSION: ${GAFFER_VERSION} + ACCUMULO_VERSION: ${ACCUMULO_VERSION} + ports: + - 8080:8080 + volumes: + - ./conf/graphConfig.json:/gaffer/graph/graphConfig.json:ro + - ./conf/gafferpop/gaffer/store.properties:/gaffer/store/store.properties:ro + - ./conf/gafferpop/gaffer/schema:/gaffer/schema:ro + + gremlin-gaffer: + image: gchq/gremlin-gaffer:${GREMLIN_VERSION}-gaffer-${GAFFER_VERSION} + depends_on: + accumulo-tserver: + condition: service_healthy + build: + context: . + args: + GAFFER_VERSION: ${GAFFER_VERSION} + GREMLIN_VERSION: ${GREMLIN_VERSION} + ports: + - 8182:8182 + volumes: + - ./conf/gafferpop:/opt/gremlin-server/conf/gafferpop:ro diff --git a/docker/gremlin-gaffer/files/.gitignore b/docker/gremlin-gaffer/files/.gitignore new file mode 100644 index 00000000..fd807ac5 --- /dev/null +++ b/docker/gremlin-gaffer/files/.gitignore @@ -0,0 +1,2 @@ +*.tar.gz +*.jar diff --git a/docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb b/docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb new file mode 100644 index 00000000..d0a6bb79 --- /dev/null +++ b/docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb @@ -0,0 +1,136 @@ +{ + "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Gremlin Gaffer modern example" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "# Common imports\n", + "from gremlin_python.process.anonymous_traversal import traversal\n", + "from gremlin_python.process.graph_traversal import __\n", + "from gremlin_python.process.strategies import *\n", + "from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\n", + "from gremlin_python.process.traversal import *\n", + "from gremlin_python.driver.client import Client\n", + "import nest_asyncio\n", + "\n", + "from_ = Direction.OUT\n", + "to = Direction.IN\n", + "nest_asyncio.apply()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create gremlin client to run gremlin scripts directly\n", + "client = Client('ws://localhost:8182/gremlin', 'g')\n", + "# Import graphml data with script\n", + "client.submit(\"graph.io(graphml()).readGraph('data/tinkerpop-modern.xml')\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# Setup a connection with the gremlin rest server\n", + "g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin', 'g'))" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[{'name': ['marko'], 'age': [29]}]\n" + ] + } + ], + "source": [ + "# Get properties from an Entity\n", + "print(g.V('1').valueMap().to_list())" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[0.5]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Starting with multiple Entity seeds, filter by those with group \"person\", hop down an \"known\" edges, and print properties less than 1\n", + "g.V('1', '2').hasLabel('person').outE('knows').values().is_(lt(1)).to_list()" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[path[v[1], v[3]], path[v[1], v[4], v[3]]]" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Calculate up to 6 paths between two Entities\n", + "g.V('1').repeat(__.both().simplePath()).until(__.hasId('3')).limit(6).path().to_list()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "tinkerpop", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.16" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} From 53dfcbf1b7f9e36f55e0f996bcdbd84b3e4c257f Mon Sep 17 00:00:00 2001 From: cn337131 <141730190+cn337131@users.noreply.github.com> Date: Wed, 13 Sep 2023 07:37:37 +0000 Subject: [PATCH 3/9] Gh-24: Integrate any documentation into the Gaffer-Doc project (#324) * update READMEs and remove transferred files --- CONTRIBUTING.md | 33 ---- README.md | 28 ++-- docker/README.md | 21 --- kubernetes/README.md | 28 ---- kubernetes/accumulo/docs/kind-deployment.md | 48 ------ kubernetes/docs/add-libraries.md | 63 ------- kubernetes/docs/aws-eks-deployment.md | 156 ------------------ kubernetes/docs/change-accumulo-passwords.md | 37 ----- kubernetes/docs/change-graph-metadata.md | 61 ------- kubernetes/docs/deploy-empty-graph.md | 69 -------- kubernetes/docs/guides.md | 11 -- kubernetes/docs/kind-deployment.md | 63 ------- kubernetes/docs/schema.md | 67 -------- .../gaffer-jhub/docs/kind-deployment.md | 56 ------- .../docs/aws-eks-deployment.md | 52 ------ .../docs/kind-deployment.md | 60 ------- kubernetes/gaffer/docs/aws-eks-deployment.md | 51 ------ kubernetes/gaffer/docs/kind-deployment.md | 54 ------ kubernetes/hdfs/docs/aws-eks-deployment.md | 37 ----- kubernetes/hdfs/docs/kind-deployment.md | 45 ----- 20 files changed, 16 insertions(+), 1024 deletions(-) delete mode 100644 CONTRIBUTING.md delete mode 100644 docker/README.md delete mode 100644 kubernetes/README.md delete mode 100644 kubernetes/accumulo/docs/kind-deployment.md delete mode 100644 kubernetes/docs/add-libraries.md delete mode 100644 kubernetes/docs/aws-eks-deployment.md delete mode 100644 kubernetes/docs/change-accumulo-passwords.md delete mode 100644 kubernetes/docs/change-graph-metadata.md delete mode 100644 kubernetes/docs/deploy-empty-graph.md delete mode 100644 kubernetes/docs/guides.md delete mode 100644 kubernetes/docs/kind-deployment.md delete mode 100644 kubernetes/docs/schema.md delete mode 100644 kubernetes/gaffer-jhub/docs/kind-deployment.md delete mode 100644 kubernetes/gaffer-road-traffic/docs/aws-eks-deployment.md delete mode 100644 kubernetes/gaffer-road-traffic/docs/kind-deployment.md delete mode 100644 kubernetes/gaffer/docs/aws-eks-deployment.md delete mode 100644 kubernetes/gaffer/docs/kind-deployment.md delete mode 100644 kubernetes/hdfs/docs/aws-eks-deployment.md delete mode 100644 kubernetes/hdfs/docs/kind-deployment.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 0751889e..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,33 +0,0 @@ -# How to contribute - -We love your input! And we want to make it as easy as possible for you to contribute, whether it's by: -* Highlighting a bug -* Discussing an idea -* Proposing a new feature -* Creating a pull request - -## Getting started -* Make sure you have a [GitHub account](https://github.com/). -* Maybe create a [GitHub issue](https://github.com/gchq/gaffer-docker/issues): Does an issue already exist? If you have a new issue then describe it in as much detail as you can, e.g. step-by-step to reproduce. -* Fork the repository on GitHub. -* Clone the repo: `git clone https://github.com/gchq/gaffer-docker.git` -* Create a branch for your change, probably from the develop branch. Please don't work on develop. Try this: `git checkout -b gh--my_contribution develop` - -## Making changes -* Make sure you can reproduce any bugs you find. -* Make your changes and test. Make sure you include new or updated tests if you need to. -* Run the tests locally by following this guide on [Deploying using Kind](kubernetes/kind-deployment.md). - -## Submitting changes -* Sign the [GCHQ Contributor Licence Agreement](https://github.com/gchq/Gaffer/wiki/GCHQ-OSS-Contributor-License-Agreement-V1.0). -* Push your changes to your fork. -* Submit a [pull request](https://github.com/gchq/gaffer-docker/pulls). -* Link the issue by putting `closes #` in the description -* We'll look at it pretty soon after it's submitted, and we aim to respond within one week. - -## Getting it accepted -Here are some things you can do to make this all smoother: -* If you think it might be controversial then discuss it with us beforehand, via a GitHub issue. -* Add tests. -* Avoid hardcoded values in templates or Docker Compose files. Try and extract them to the Values.yaml or .env files if you can. -* Include the copyright banner on new files diff --git a/README.md b/README.md index 986fe353..085a6be0 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -Gaffer Docker -================ +# Gaffer Docker -This repo contains the code needed to run Gaffer using Docker or Kubernetes. +This repo contains the code needed to run Gaffer using Docker or Kubernetes. There are two main sub-folders, 'docker' and 'kubernetes' which contain the project files you need for starting Gaffer using those services. # Running Gaffer Using Docker -For information on how to run Gaffer using Docker containers, please see the README in the docker directory: [Gaffer Docker README](docker/README.md) + +For information on how to run Gaffer using Docker containers, please see the documentation: [Gaffer Docker Docs](https://gchq.github.io/gaffer-doc/latest/dev/docker/) # Running Gaffer Using Kubernetes -For information on how to run Gaffer using Kubernetes, please see the README in the kubernetes directory: [Kubernetes README](kubernetes/README.md) + +For information on how to run Gaffer using Kubernetes, please see the documentation: [Gaffer Kubernetes Docs](https://gchq.github.io/gaffer-doc/latest/dev/kubernetes-guide/kubernetes/) # Versioning + Each of our images which is released will be tagged with the version of the software they represent. Every release, we update the `latest` tag for each image and add a new release which has the corresponding version tag. If we release Gaffer version 2.1.2, the following images would be uploaded: -* gchq/gaffer:latest -* gchq/gaffer:2 -* gchq/gaffer:2.1 -* gchq/gaffer:2.1.2 -* gchq/gaffer:2.1.2-accumulo-2.0.1 +- gchq/gaffer:latest +- gchq/gaffer:2 +- gchq/gaffer:2.1 +- gchq/gaffer:2.1.2 +- gchq/gaffer:2.1.2-accumulo-2.0.1 We maintain mutable versions of latest, as well as the major, minor and bugfix versions of Gaffer. For reproducibility make sure to use the full version in your build metadata. For `gaffer`/`gaffer-rest` images, we also create a tag including the @@ -30,7 +32,9 @@ are not published but can be build locally if required. The release process is automated by GitHub actions. # Known Compatible Docker Versions -* 20.10.23 + +- 20.10.23 # Contributing -If you would like to make a Contribution, we have all the details for doing that [here](CONTRIBUTING.md) + +We welcome contributions to this project. Detailed information on our ways of working can be found in our [developer docs](https://gchq.github.io/gaffer-doc/latest/dev/ways-of-working/). diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index e3fd37b1..00000000 --- a/docker/README.md +++ /dev/null @@ -1,21 +0,0 @@ -Docker -======= - -In this directory you can find the Dockerfiles and docker compose files for building container images for: -* [Gaffer](gaffer/) -* Gaffer's [REST API](gaffer-rest/) -* Gaffer's [Road Traffic Data Loader](gaffer-road-traffic-loader/) -* [HDFS](hdfs/) -* [Accumulo](accumulo/) -* Gaffer [Integration Test Runner](gaffer-integration-tests/) -* [gafferpy Jupyter Notebook](gaffer-pyspark-notebook/) -* Gaffer [options server for JupyterHub](gaffer-jhub-options-server/) -* [Spark](spark-py/) - -For more specific information on what these images are for and how to build them, please see their respective READMEs. - -Please note that some of these containers will only be useful if utilised by the Helm Charts under [Kubernetes](/kubernetes/), and may not be possible to run on their own. - -# Requirements -Before you can build and run these containers you will need to install Docker along with the compose plugin. Information on this can be found in the docker docs -* [Installing docker](https://docs.docker.com/get-docker/) diff --git a/kubernetes/README.md b/kubernetes/README.md deleted file mode 100644 index 74c25914..00000000 --- a/kubernetes/README.md +++ /dev/null @@ -1,28 +0,0 @@ -Kubernetes -========== -In this directory you can find the Helm charts required to deploy various applications onto Kubernetes clusters. -The Helm charts and associated information for each application can be found in the following places: -* [HDFS](kubernetes/hdfs/) -* [Accumulo](kubernetes/accumulo/) -* [Gaffer](kubernetes/gaffer/) -* [Example Gaffer Graph containing Road Traffic Dataset](kubernetes/gaffer-road-traffic/) -* [JupyterHub with Gaffer integrations](kubernetes/gaffer-jhub/) - -These charts can be accessed by cloning our repository or by using our Helm repo hosted on our [GitHub Pages Site](https://gchq.github.io/gaffer-docker) - - -## Adding this repo to Helm -To add the gaffer-docker repo to helm run: -```bash -helm repo add gaffer-docker https://gchq.github.io/gaffer-docker -``` - -# Kubernetes How-to Guides -We have a number of [guides](./docs/guides.md) to help you deploy Gaffer on Kubernetes. It is important you look at these before you get started, they provide the initial steps for running these applications. - -# Requirements -Before you can deploy any of these applications you need to have installed Kubernetes. -* [Installing Kubernetes](https://kubernetes.io/docs/setup/) - -You will also need to install Docker and the compose plugin. -* [installing docker](https://docs.docker.com/get-docker/) diff --git a/kubernetes/accumulo/docs/kind-deployment.md b/kubernetes/accumulo/docs/kind-deployment.md deleted file mode 100644 index b2d95cb8..00000000 --- a/kubernetes/accumulo/docs/kind-deployment.md +++ /dev/null @@ -1,48 +0,0 @@ -Deploying Accumulo using kind -================================= - -All the scripts found here are designed to be run from the kubernetes/accumulo folder. - -First follow the [instructions here](../../docs/kind-deployment.md) to provision and configure a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that the Accumulo Helm Chart can be deployed on. - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -helm dependency update - -helm install accumulo . \ - --set hdfs.namenode.tag=${HADOOP_VERSION} \ - --set hdfs.datanode.tag=${HADOOP_VERSION} \ - --set hdfs.shell.tag=${HADOOP_VERSION} \ - --set accumulo.image.tag=${GAFFER_VERSION} - -helm test accumulo -``` - -# Accessing Web UIs (via `kubectl port-forward`) -| Component | Command | URL | -| ----------- | ---------------------------------------------------------------- | --------------------------- | -| Accumulo | `kubectl port-forward svc/road-traffic-gaffer-monitor 9995:80` | http://localhost:9995/ | - - -# Accessing Web UIs (via [Nginx Ingress Controller](https://github.com/kubernetes/ingress-nginx)) -Register the FQDNs for each component in DNS e.g. -``` -echo "127.0.0.1 gaffer.k8s.local accumulo.k8s.local hdfs.k8s.local" | sudo tee -a /etc/hosts -``` - -Update the Gaffer deployment to route ingress based on FQDNs: -``` -helm upgrade accumulo . -f ./values-host-based-ingress.yaml --reuse-values -``` - -Set up port forwarding to the nginx ingress controller: -``` -sudo KUBECONFIG=$HOME/.kube/config kubectl port-forward -n ingress-nginx svc/ingress-nginx 80:80 -``` - -Access the web UIs using the following URLs: -| Component | URL | -| ----------- | ----------------------------- | -| Accumulo | http://accumulo.k8s.local/ | \ No newline at end of file diff --git a/kubernetes/docs/add-libraries.md b/kubernetes/docs/add-libraries.md deleted file mode 100644 index 24d98c9f..00000000 --- a/kubernetes/docs/add-libraries.md +++ /dev/null @@ -1,63 +0,0 @@ -Adding your own libraries and functions -======================================= -By default with the Gaffer deployment you get access to the: -* Sketches library -* Time library -* Bitmap Library -* JCS cache library - -If you want more libraries than this (either one of ours of one of your own) you will need to customise the docker images and use them in place of the defaults. - -You will need a basic Gaffer instance deployed on Kubernetes. Here is [how to do that](./deploy-empty-graph.md). - -# Overwrite the REST war file -At the moment, Gaffer uses a runnable jar file located at /gaffer/jars. When it runs it includes the /gaffer/jars/lib on the classpath. There is nothing in there by default because all the dependencies are bundled in to the JAR. However, if you wanted to add your own jars, you can do it like this: -```Dockerfile -FROM gchq/gaffer-rest:latest -COPY ./my-custom-lib:1.0-SNAPSHOT.jar /gaffer/jars/lib/ -``` - -Build the image using: -```bash -docker build -t custom-rest:latest . -``` - -# Add the extra libraries to the Accumulo image -Gaffer's Accumulo image includes support for the following Gaffer libraries: -* The Bitmap Library -* The Sketches Library -* The Time Library - -In order to push down any extra value objects and filters to Accumulo that are not in those libraries, we have to add the jars to the accumulo /lib/ext directory. Here is an example `Dockerfile`: -```Dockerfile -FROM gchq/gaffer:latest -COPY ./my-library-1.0-SNAPSHOT.jar /opt/accumulo/lib/ext -``` -Then build the image -```bash -docker build -t custom-gaffer-accumulo:latest . -``` - -# Switch the images in the deployment -You will need a way of making the custom images visible to the kubernetes cluster. With EKS, you can do this by uploading the images to ECR. There is an example for how to do that in one of our [other guides](./aws-eks-deployment.md#Container+Images). With KinD, you just run `kind load docker-image `. - -Once visible you can switch them out. Create a `custom-images.yaml` file with the following contents: -```yaml -api: - image: - repository: custom-rest - tag: latest - -accumulo: - image: - repository: custom-gaffer-accumulo - tag: latest -``` - -To switch them run: -```bash -helm upgrade my-graph gaffer-docker/gaffer -f custom-images.yaml --reuse-values -``` - -# What next? -See our [guides](./guides.md) for other things you can do with Gaffer on Kubernetes. diff --git a/kubernetes/docs/aws-eks-deployment.md b/kubernetes/docs/aws-eks-deployment.md deleted file mode 100644 index b80e80f7..00000000 --- a/kubernetes/docs/aws-eks-deployment.md +++ /dev/null @@ -1,156 +0,0 @@ -Deploying Gaffer on AWS EKS -=========================== -The following instructions will guide you through provisioning and configuring an [AWS EKS](https://aws.amazon.com/eks/) cluster that our Helm Charts can be deployed on. - -# Install CLI Tools -* [docker compose](https://github.com/docker/compose/releases/latest) -* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -* [helm](https://github.com/helm/helm/releases) -* [aws-cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) -* [eksctl](https://github.com/weaveworks/eksctl/releases/latest) - - -# Container Images -If the versions of the container images you would like to deploy are not available in [Docker Hub](https://hub.docker.com/u/gchq) then you will need to host them in a registry yourself. - -The following instructions build all the container images and host them in AWS ECR when run from the ./kubernetes folder: - - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -docker compose --project-directory ../docker/accumulo/ -f ../docker/accumulo/docker-compose.yaml build -docker compose --project-directory ../docker/gaffer-road-traffic-loader/ -f ../docker/gaffer-road-traffic-loader/docker-compose.yaml build - -HADOOP_IMAGES="hdfs" -GAFFER_IMAGES="gaffer gaffer-rest gaffer-road-traffic-loader" - -ACCOUNT=$(aws sts get-caller-identity --query Account --output text) -[ "${REGION}" = "" ] && REGION=$(aws configure get region) -[ "${REGION}" = "" ] && REGION=$(curl --silent -m 5 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f 4) -REPO_PREFIX="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/gchq" - -for repo in ${HADOOP_IMAGES} ${GAFFER_IMAGES}; do - aws ecr create-repository --repository-name gchq/${repo} -done - -echo $(aws ecr get-login-password) | docker login -u AWS --password-stdin https://${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com - -for repo in ${HADOOP_IMAGES}; do - docker image tag gchq/${repo}:${HADOOP_VERSION} ${REPO_PREFIX}/${repo}:${HADOOP_VERSION} - docker image push ${REPO_PREFIX}/${repo}:${HADOOP_VERSION} -done - -for repo in ${GAFFER_IMAGES}; do - docker image tag gchq/${repo}:${GAFFER_VERSION} ${REPO_PREFIX}/${repo}:${GAFFER_VERSION} - docker image push ${REPO_PREFIX}/${repo}:${GAFFER_VERSION} -done -``` - -# EKS Cluster -There are a number of ways to provision an AWS EKS cluster. This guide uses a cli tool called `eksctl`. Documentation is available at https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html for some of the other methods. - -Before issuing any commands, the subnets that will be used by your EKS cluster need to be tagged accordingly: -| Subnet Type | Tag Key | Tag Value | -| ----------- | ------------------------------- | --------- | -| Public | kubernetes.io/role/elb | 1 | -| Private | kubernetes.io/role/internal-elb | 1 | - -If you want the cluster to spin up in a VPC that is not the default, then set `$VPC_ID`. - -```bash -EKS_CLUSTER_NAME=${EKS_CLUSTER_NAME:-gaffer} -KUBERNETES_VERSION=${KUBERNETES_VERSION:-1.15} - -[ "${VPC_ID}" = "" ] && VPC_ID=$(aws ec2 describe-vpcs --filters Name=isDefault,Values=true --query Vpcs[0].VpcId --output text) -[ "${VPC_ID}" = "" ] && echo "Unable to detect default VPC ID, please set \$VPC_ID" && exit 1 - -# Obtain a list of public and private subnets that the cluster will be deployed into by querying for the required 'elb' tags -PUBLIC_SUBNET_IDS=$(aws ec2 describe-subnets --filters Name=vpc-id,Values=${VPC_ID} Name=tag-key,Values=kubernetes.io/role/elb --query Subnets[].SubnetId --output text | tr -s '[:blank:]' ',') -PRIVATE_SUBNET_IDS=$(aws ec2 describe-subnets --filters Name=vpc-id,Values=${VPC_ID} Name=tag-key,Values=kubernetes.io/role/internal-elb --query Subnets[].SubnetId --output text | tr -s '[:blank:]' ',') -[ "${PUBLIC_SUBNET_IDS}" = "" ] && echo "Unable to detect any public subnets. Make sure they are tagged: kubernetes.io/role/elb=1" && exit 1 -[ "${PRIVATE_SUBNET_IDS}" = "" ] && echo "Unable to detect any private subnets. Make sure they are tagged: kubernetes.io/role/internal-elb=1" && exit 1 - -eksctl create cluster \ - -n "${EKS_CLUSTER_NAME}" \ - --version "${KUBERNETES_VERSION}" \ - --managed \ - --nodes 3 \ - --nodes-min 3 \ - --nodes-max 12 \ - --node-volume-size 20 \ - --full-ecr-access \ - --alb-ingress-access \ - --vpc-private-subnets "${PRIVATE_SUBNET_IDS}" \ - --vpc-public-subnets "${PUBLIC_SUBNET_IDS}" - -aws eks update-kubeconfig --name ${EKS_CLUSTER_NAME} -``` - -# Ingress -Deploy the AWS ALB Ingress Controller, using the docs at https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html - -At the time of writing, this involves issuing the following commands: - -```bash -EKS_CLUSTER_NAME=${EKS_CLUSTER_NAME:-gaffer} - -[ "${ACCOUNT}" = "" ] && ACCOUNT=$(aws sts get-caller-identity --query Account --output text) -[ "${REGION}" = "" ] && REGION=$(aws configure get region) -[ "${REGION}" = "" ] && REGION=$(curl --silent -m 5 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f 4) -[ "${REGION}" = "" ] && echo "Unable to detect AWS region, please set \$REGION" && exit 1 - -eksctl utils associate-iam-oidc-provider \ - --region "${REGION}" \ - --cluster "${EKS_CLUSTER_NAME}" \ - --approve - -aws iam create-policy \ - --policy-name ALBIngressControllerIAMPolicy \ - --policy-document https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json - -kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml - -eksctl create iamserviceaccount \ - --region "${REGION}" \ - --name alb-ingress-controller \ - --namespace kube-system \ - --cluster "${EKS_CLUSTER_NAME}" \ - --attach-policy-arn arn:aws:iam::${ACCOUNT}:policy/ALBIngressControllerIAMPolicy \ - --override-existing-serviceaccounts \ - --approve - -curl https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/alb-ingress-controller.yaml | sed "s/# - --cluster-name=devCluster/- --cluster-name=${EKS_CLUSTER_NAME}/" | kubectl apply -f - -``` - -# Deploy Helm Charts -* [HDFS](../hdfs/docs/aws-eks-deployment.md) -* [Gaffer](../gaffer/docs/aws-eks-deployment.md) -* [Example Gaffer Graph containing Road Traffic Dataset](../gaffer-road-traffic/docs/aws-eks-deployment.md) - - -# Access Web UIs -The AWS ALB Ingress Controller will create an application load balancer (ALB) for each Ingress resource deployed into the EKS cluster. - -You can find out the URL that you can use to access each ingress with `kubectl get ing` - -**⚠️ WARNING ⚠️**\ -By default, the security group assigned to the ALBs will allow anyone to access them. We highly recommend attaching a combination of the [other annotations available](https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/#security-groups) to each of your Ingress resources to control access to them. - - -# Uninstall -```bash -EKS_CLUSTER_NAME=${EKS_CLUSTER_NAME:-gaffer} - -# Use helm to uninstall any deployed charts -for release in $(helm ls --short); do - helm uninstall ${release} -done - -# Ensure EBS volumes are deleted -kubectl get pvc --output name | xargs kubectl delete - -# Delete the EKS cluster -eksctl delete cluster --name "${EKS_CLUSTER_NAME}" -``` diff --git a/kubernetes/docs/change-accumulo-passwords.md b/kubernetes/docs/change-accumulo-passwords.md deleted file mode 100644 index f16ebe78..00000000 --- a/kubernetes/docs/change-accumulo-passwords.md +++ /dev/null @@ -1,37 +0,0 @@ -Changing the Accumulo Passwords -=============================== - -When deploying Accumulo - either as part of a Gaffer stack or as a standalone, the passwords for all the users and the instance.secret are set to default values and should be changed. The instance.secret cannot be changed once deployed as it is used in initalisation. - -When deploying the Accumulo helm chart, the following values are set. If you are using the Gaffer helm chart with the Accumulo integration, the values will be prefixed with "accumulo": - -| Name | value | default value -|----------------------|-----------------------------------------------|----------------- -| Instance Secret | `config.accumuloSite."instance.secret"` | "DEFAULT" -| Root password | `config.userManagement.rootPassword` | "root" -| Tracer user password | `config.userManagement.users.tracer.password` | "tracer" - -When you deploy the Gaffer Helm chart with Accumulo, a "gaffer" user with a password of "gaffer" is used by default following the same pattern as the tracer user. - -So to install a new Gaffer with Accumulo store, create an `accumulo-passwords.yaml` with the following contents: - -```yaml -accumulo: - enabled: true - config: - accumuloSite: - instance.secret: "changeme" - userManagement: - rootPassword: "changeme" - users: - tracer: - password: "changme" - gaffer: - password: "changeme" -``` - -You can install the graph with: - -```bash -helm install my-graph gaffer-docker/gaffer -f accumulo-passwords.yaml -``` diff --git a/kubernetes/docs/change-graph-metadata.md b/kubernetes/docs/change-graph-metadata.md deleted file mode 100644 index a8daa3b3..00000000 --- a/kubernetes/docs/change-graph-metadata.md +++ /dev/null @@ -1,61 +0,0 @@ -Changing the Graph Id and Description -======================================= -By default, the default Gaffer deployment ships with the Graph name "simpleGraph" and description "A graph for demo purposes" These are just placeholders and can be overwritten. This guide will show you how. - -The first thing you will need to do is [deploy an empty graph](./deploy-empty-graph.md). - -# Changing the description -Create a file called `graph-meta.yaml`. We will use this file to add our description and graph Id. -Changing the description is as easy as changing the `graph.config.description` value. -```yaml -graph: - config: - description: "My graph description" -``` -Feel free to be a bit more imaginative. - -# Deploy the new description -Upgrade your deployment using helm: - -```bash -helm upgrade my-graph gaffer-docker/gaffer -f graph-metadata.yaml --reuse-values -``` - -The `--reuse-values` argument means we do not override any passwords that we set in the initial construction. - -You can see your new description if you go to the Swagger UI and call the /graph/config/description endpoint. - -# Updating the Graph Id -This may be simple or complicated depending on your store type. If you are using the Map or Federated store, you can just set the `graph.config.graphId` value in the same way. Though if you are using a MapStore, the graph will be emptied as a result. - -However, if you are using the Accumulo store, updating the graph Id is a little more complicated since the Graph Id corresponds to an Accumulo table. We have to change the gaffer users permissions to read and write to that table. To do that update the `graph-meta.yaml` file with the following contents: -```yaml -graph: - config: - graphId: "MyGraph" - description: "My Graph description" - -accumulo: - config: - userManagement: - users: - gaffer: - permissions: - table: - MyGraph: - - READ - - WRITE - - BULK_IMPORT - - ALTER_TABLE -``` - -# Deploy your changes -Upgrade your deployment using Helm. -```bash -helm upgrade my-graph gaffer-docker/gaffer -f graph-metadata.yaml --reuse-values -``` - -If you take a look at the Accumulo monitor, you will see your new Accumulo table - -# What next? -See our [guides](./guides.md) for other things you can do with Gaffer on Kubernetes. diff --git a/kubernetes/docs/deploy-empty-graph.md b/kubernetes/docs/deploy-empty-graph.md deleted file mode 100644 index b8589ebe..00000000 --- a/kubernetes/docs/deploy-empty-graph.md +++ /dev/null @@ -1,69 +0,0 @@ -How to deploy a simple graph -============================= -This guide will describe how to deploy a simple empty graph with the minimum configuration. - -You will need: -1. Helm -2. Kubectl -3. A Kubernetes cluster (local or remote) -4. An ingress controller running (for accessing UIs) - -# Add the Gaffer Docker repo -To start with, you should add the Gaffer Docker repo to your helm repos. This will save the need for cloning this Git repository. If you have already done this, you can skip this step. -```bash -helm repo add gaffer-docker https://gchq.github.io/gaffer-docker -``` - -# Choose the store -Gaffer can be backed with a number of different technologies to back its store. Which one you want depends on the use case but as a rule of thumb: -* If you just want something to spin up quickly at small scale and are not worried about persistance: use the [Map Store](#deploy-the-map-store). -* If you want to back it with a key value datastore, you can deploy the [Accumulo Store](#deploy-the-accumulo-store) -* If you want to join two or more graphs together to query them as one, you will want to use the [Federated Store](#deploy-the-federated-store) - -Other stores such as parquet or hbase could be supported by this helm chart if you wanted, but support for it is not available yet. - -## Deploy the Map Store -The Map store is just an in memory store that can be used for demos or if you need something small scale short term. It is our default store so there is no need for any extra configuration. - -You can install a Map Store by just running: -```bash -helm install my-graph gaffer-docker/gaffer -``` - -## Deploy the Accumulo Store -If you want to deploy Accumulo with your graph, it is relatively easy to do so with some small additional configuration. -Create a file called `accumulo.yaml` and add the following: -```yaml -accumulo: - enabled: true -``` - -By default, the Gaffer user is created with a password of "gaffer" the `CREATE_TABLE` system permission with full access to the `simpleGraph` table which is coupled to the graphId. All the default Accumulo passwords are in place so if you were to deploy this in production, you should consider [changing the default accumulo passwords](./change-accumulo-passwords.md). - -You can stand up the accumulo store by running: -```bash -helm install my-graph gaffer-docker/gaffer -f accumulo.yaml -``` - -## Deploy the Federated Store -If you want to deploy the Federated Store, all that you really need to do is set the store.properties. -To do this add the following to a `federated.yaml` file: - -```yaml -graph: - storeProperties: - gaffer.store.class: uk.gov.gchq.gaffer.federatedstore.FederatedStore - gaffer.store.properties.class: uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties - gaffer.serialiser.json.modules: uk.gov.gchq.gaffer.sketches.serialisation.json.SketchesJsonModules -``` - -The addition of the SketchesJsonModules is just to ensure that if the FederatedStore was connecting to a store which used sketches, they could be rendered nicely in json. - -We can create the graph with: - -``` -helm install federated gaffer-docker/gaffer -f federated.yaml -``` - -# What next? -See our [guides](./guides.md) for other things you can do with Gaffer on Kubernetes. diff --git a/kubernetes/docs/guides.md b/kubernetes/docs/guides.md deleted file mode 100644 index c50747b1..00000000 --- a/kubernetes/docs/guides.md +++ /dev/null @@ -1,11 +0,0 @@ -Guides -======== -Here you will find all our guides for deploying Gaffer on Kubernetes. - -1. [Deploy on a KinD cluster locally](./kind-deployment.md) -2. [Deploy to EKS](./aws-eks-deployment.md) -3. [Deploy a simple empty graph](./deploy-empty-graph.md) -4. [Add your schema](./schema.md) -5. [Change the Graph Id and Description](./change-graph-metadata.md) -6. [Adding your own functions and libraries](./add-libraries.md) -7. [Changing the passwords on the Accumulo store](./changing-accumulo-passwords.md) \ No newline at end of file diff --git a/kubernetes/docs/kind-deployment.md b/kubernetes/docs/kind-deployment.md deleted file mode 100644 index da8ea47a..00000000 --- a/kubernetes/docs/kind-deployment.md +++ /dev/null @@ -1,63 +0,0 @@ -How to deploy a Kubernetes cluster using Kind -============================================= -The following instructions will guide you through provisioning and configuring a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that our Helm Charts can be deployed on. - -# Install CLI Tools -* [docker compose](https://github.com/docker/compose/releases/latest) -* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -* [helm](https://github.com/helm/helm/releases) -* [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) - - -# Kubernetes Cluster -Simply run the following command to spin up a local Kubernetes cluster, running inside a Docker container: -``` -kind create cluster --image kindest/node:v1.24.4 -``` - - -# Container Images -If the versions of the container images you would like to deploy are not available in [Docker Hub](https://hub.docker.com/u/gchq) then you will need to build them yourself and import them into your kind cluster. - -To import the images, run this from the kubernetes directory: - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -docker compose --project-directory ../docker/accumulo/ -f ../docker/accumulo/docker-compose.yaml build -docker compose --project-directory ../docker/gaffer-road-traffic-loader/ -f ../docker/gaffer-road-traffic-loader/docker-compose.yaml build - -kind load docker-image gchq/hdfs:${HADOOP_VERSION} -kind load docker-image gchq/gaffer:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} -kind load docker-image gchq/gaffer-rest:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} -kind load docker-image gchq/gaffer-road-traffic-loader:${GAFFER_VERSION} -``` - -From here you should be able to follow the respective kind-deployment files for the services you would like to run. - -* [Accumulo](kubernetes/accumulo/) -* [Gaffer](kubernetes/gaffer/docs/kind-deployment.md) -* [Gaffer JupyterHub](kubernetes/gaffer-jhub/docs/kind-deployment.md) -* [Gaffer Road Traffic Dataset](kubernetes/gaffer-road-traffic/docs/kind-deployment.md) -* [HDFS](kubernetes/hdfs/docs/kind-deployment.md) - - -# Ingress -Deploy the Nginx Ingress Controller: -```bash -INGRESS_NGINX_VERSION="nginx-0.30.0" -kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/${INGRESS_NGINX_VERSION}/deploy/static/mandatory.yaml -kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/${INGRESS_NGINX_VERSION}/deploy/static/provider/baremetal/service-nodeport.yaml -``` - -# Deploy Helm Charts -* [HDFS](../hdfs/docs/kind-deployment.md) -* [Gaffer](../gaffer/docs/kind-deployment.md) -* [Example Gaffer Graph containing Road Traffic Dataset](../gaffer-road-traffic/docs/kind-deployment.md) - - -# Uninstall -``` -kind delete cluster -``` diff --git a/kubernetes/docs/schema.md b/kubernetes/docs/schema.md deleted file mode 100644 index 333c706b..00000000 --- a/kubernetes/docs/schema.md +++ /dev/null @@ -1,67 +0,0 @@ -How to Deploy your own Schema -============================== -Gaffer uses schema files to describe the data contained in a Graph. This guide will tell you how to deploy your own schemas with a Gaffer Graph. - -The first thing you will need to do is deploy a simple graph. We have a guide for how to do that [here](./deploy-empty-graph.md). - -Once you have that deployed, we can change the schema. - -# Edit the schema -If you run a GetSchema operation against the graph, you will notice that the count property is of type `java.lang.Integer` - change that property to be of type `java.lang.Long`. - -The easiest way to deploy a schema file is to use helms `--set-file` option which lets you set a value from the contents of a file. -Example of a `schema.json` file: - -```json -{ - "edges": { - "BasicEdge": { - "source": "vertex", - "destination": "vertex", - "directed": "true", - "properties": { - "count": "count" - } - } - }, - "entities": { - "BasicEntity": { - "vertex": "vertex", - "properties": { - "count": "count" - } - } - }, - "types": { - "vertex": { - "class": "java.lang.String" - }, - "count": { - "class": "java.lang.Long", - "aggregateFunction": { - "class": "uk.gov.gchq.koryphe.impl.binaryoperator.Sum" - } - }, - "true": { - "description": "A simple boolean that must always be true.", - "class": "java.lang.Boolean", - "validateFunctions": [ - { "class": "uk.gov.gchq.koryphe.impl.predicate.IsTrue" } - ] - } - } -} -``` - -# Update deployment with the new schema -For our deployment to pick up the changes, we need to run a helm upgrade: -```bash -helm upgrade my-graph gaffer-docker/gaffer --set-file graph.schema."schema\.json"=./schema.json --reuse-values -``` -The `--reuse-values` argument tells helm to re-use the passwords that we defined earlier. - -Now if we inspect the schema, you will see that the `count` property has changed to a Long. - - -# What next? -See our [guides](./guides.md) for other things you can do with Gaffer on Kubernetes. diff --git a/kubernetes/gaffer-jhub/docs/kind-deployment.md b/kubernetes/gaffer-jhub/docs/kind-deployment.md deleted file mode 100644 index e61bdfa4..00000000 --- a/kubernetes/gaffer-jhub/docs/kind-deployment.md +++ /dev/null @@ -1,56 +0,0 @@ -Deploying JupyterHub for Gaffer using kind -========================================== - -All scripts listed here are intended to be run from the `kubernetes/gaffer-jhub` folder. - -First, follow the [instructions here](../../gaffer-road-traffic/docs/kind-deployment.md) to provision and configure a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that has an instance of the Gaffer Road Traffic example graph deployed into it. - - -# Container Images - -Use the following commands to build and deploy the extra containers used by JupyterHub: -```bash -source ../../docker/gaffer-pyspark-notebook/.env -source ../../docker/gaffer-jhub-options-server/get-version.sh - -# Build Container Images -docker compose --project-directory ../../docker/gaffer-pyspark-notebook/ -f ../../docker/gaffer-pyspark-notebook/docker-compose.yaml build notebook -docker compose --project-directory ../../docker/spark-py/ -f ../../docker/spark-py/docker-compose.yaml build -docker compose --project-directory ../../docker/gaffer-jhub-options-server/ -f ../../docker/gaffer-jhub-options-server/docker-compose.yaml build - -# Deploy Images to Kind -kind load docker-image gchq/gaffer-pyspark-notebook:${GAFFER_VERSION} -kind load docker-image gchq/spark-py:${SPARK_VERSION} -kind load docker-image gchq/gaffer-jhub-options-server:${JHUB_OPTIONS_SERVER_VERSION} -``` - -# Deploy Helm Chart - -Once that's done, use the following commands to deploy a JupyterHub instance with Gaffer extensions: -```bash -helm dependency update -helm install jhub . -f ./values-insecure.yaml - -helm test jhub -``` - -# Accessing JupyterHub Web UIs (via `kubectl port-forward`) - -Run the following on the command line: -```bash -kubectl port-forward svc/proxy-public 8080:80 -``` - -Access the following URL in your browser: -http://localhost:8080 - -By default, JupyterHub's Dummy Authenticator is used so you can login using any username and password. - - -# Accessing example notebooks - -There are some example notebooks that demonstrate how to interact with HDFS, Gaffer and Spark. Copy them into your working directory, to make them easier to view and execute, by starting a Terminal tab and submitting the following command: -```bash -$ cp -r /examples . -``` - diff --git a/kubernetes/gaffer-road-traffic/docs/aws-eks-deployment.md b/kubernetes/gaffer-road-traffic/docs/aws-eks-deployment.md deleted file mode 100644 index ba376bc4..00000000 --- a/kubernetes/gaffer-road-traffic/docs/aws-eks-deployment.md +++ /dev/null @@ -1,52 +0,0 @@ -# Deploying Road Traffic Gaffer Graph on AWS EKS -All scripts listed here are intended to be run from the kubernetes/gaffer-road-traffic folder - -First follow the [instructions here](../../docs/aws-eks-deployment.md) to provision and configure an [AWS EKS](https://aws.amazon.com/eks/) cluster that the Gaffer Road Traffic Helm Chart can be deployed on. - -## Using ECR -If you are hosting the container images in your AWS account, using ECR, then run the following commands to configure the Helm Chart to use them: - -```bash -ACCOUNT=$(aws sts get-caller-identity --query Account --output text) -[ "${REGION}" = "" ] && REGION=$(aws configure get region) -[ "${REGION}" = "" ] && REGION=$(curl --silent -m 5 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f 4) -if [ "${REGION}" = "" ]; then - echo "Unable to detect AWS region, please set \$REGION" -else - REPO_PREFIX="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/gchq" - - EXTRA_HELM_ARGS="" - EXTRA_HELM_ARGS+="--set gaffer.accumulo.hdfs.namenode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.accumulo.hdfs.datanode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.accumulo.hdfs.shell.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.accumulo.image.repository=${REPO_PREFIX}/gaffer " - EXTRA_HELM_ARGS+="--set gaffer.api.image.repository=${REPO_PREFIX}/gaffer-rest " - EXTRA_HELM_ARGS+="--set loader.image.repository=${REPO_PREFIX}/gaffer-road-traffic-loader " -fi -``` - -## Deploy Helm Chart - -The last thing before deploying is to set the passwords for the various accumulo users in the values.yaml file. These are found under `accumulo.config.userManagement`. - -Finally, deploy the Helm Chart by running this from the kubernetes/gaffer-road-traffic folder: - -``` -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -helm dependency update ../accumulo/ -helm dependency update ../gaffer/ -helm dependency update - -helm install road-traffic . -f ./values-eks-alb.yaml \ - ${EXTRA_HELM_ARGS} \ - --set gaffer.hdfs.namenode.tag=${HADOOP_VERSION} \ - --set gaffer.hdfs.datanode.tag=${HADOOP_VERSION} \ - --set gaffer.hdfs.shell.tag=${HADOOP_VERSION} \ - --set gaffer.accumulo.image.tag=${GAFFER_VERSION} \ - --set gaffer.api.image.tag=${GAFFER_VERSION} \ - --set loader.image.tag=${GAFFER_VERSION} - -helm test road-traffic -``` diff --git a/kubernetes/gaffer-road-traffic/docs/kind-deployment.md b/kubernetes/gaffer-road-traffic/docs/kind-deployment.md deleted file mode 100644 index 4f91ab44..00000000 --- a/kubernetes/gaffer-road-traffic/docs/kind-deployment.md +++ /dev/null @@ -1,60 +0,0 @@ -# Deploying Road Traffic Gaffer Graph using kind -All scripts listed here are intended to be run from the kubernetes/gaffer-road-traffic folder. - -First follow the [instructions here](../../docs/kind-deployment.md) to provision and configure a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that the Gaffer Road Traffic Helm Chart can be deployed on. - -After the cluster is provisioned, update the values.yaml with the passwords for the various Accumulo users. These are found under `accumulo.config.userManagement`. - -Once that's done, run this to deploy and test the Road Traffic Graph. -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -helm dependency update ../accumulo/ -helm dependency update ../gaffer/ -helm dependency update - -helm install road-traffic . \ - --set gaffer.hdfs.namenode.tag=${HADOOP_VERSION} \ - --set gaffer.hdfs.datanode.tag=${HADOOP_VERSION} \ - --set gaffer.hdfs.shell.tag=${HADOOP_VERSION} \ - --set gaffer.accumulo.image.tag=${GAFFER_VERSION} \ - --set gaffer.api.image.tag=${GAFFER_VERSION} \ - --set loader.image.tag=${GAFFER_VERSION} - -helm test road-traffic -``` - - -## Accessing Web UIs (via `kubectl port-forward`) - -| Component | Command | URL | -| ----------- | ---------------------------------------------------------------- | --------------------------- | -| HDFS | `kubectl port-forward svc/road-traffic-hdfs-namenodes 9870:9870` | http://localhost:9870/ | -| Accumulo | `kubectl port-forward svc/road-traffic-gaffer-monitor 9995:80` | http://localhost:9995/ | -| Gaffer REST | `kubectl port-forward svc/road-traffic-gaffer-api 8080:80` | http://localhost:8080/rest/ | - - -## Accessing Web UIs (via [Nginx Ingress Controller](https://github.com/kubernetes/ingress-nginx)) - -Register the FQDNs for each component in DNS e.g. -``` -echo "127.0.0.1 gaffer.k8s.local accumulo.k8s.local hdfs.k8s.local" | sudo tee -a /etc/hosts -``` - -Update the Gaffer deployment to route ingress based on FQDNs: -``` -helm upgrade road-traffic . -f ./values-host-based-ingress.yaml --reuse-values -``` - -Set up port forwarding to the nginx ingress controller: -``` -sudo KUBECONFIG=$HOME/.kube/config kubectl port-forward -n ingress-nginx svc/ingress-nginx 80:80 -``` - -Access the web UIs using the following URLs: -| Component | URL | -| ----------- | ----------------------------- | -| HDFS | http://hdfs.k8s.local/ | -| Accumulo | http://accumulo.k8s.local/ | -| Gaffer REST | http://gaffer.k8s.local/rest/ | diff --git a/kubernetes/gaffer/docs/aws-eks-deployment.md b/kubernetes/gaffer/docs/aws-eks-deployment.md deleted file mode 100644 index aa8597f3..00000000 --- a/kubernetes/gaffer/docs/aws-eks-deployment.md +++ /dev/null @@ -1,51 +0,0 @@ -# Deploying Gaffer on AWS EKS -All scripts listed here are intended to be run from the kubernetes/gaffer folder - -First follow the [instructions here](../../docs/aws-eks-deployment.md) to provision and configure an [AWS EKS](https://aws.amazon.com/eks/) cluster that the Gaffer Road Traffic Helm Chart can be deployed on. - -## Using ECR -If you are hosting the container images in your AWS account, using ECR, then run the following commands to configure the Helm Chart to use them: - -```bash -ACCOUNT=$(aws sts get-caller-identity --query Account --output text) -[ "${REGION}" = "" ] && REGION=$(aws configure get region) -[ "${REGION}" = "" ] && REGION=$(curl --silent -m 5 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f 4) -if [ "${REGION}" = "" ]; then - echo "Unable to detect AWS region, please set \$REGION" -else - REPO_PREFIX="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/gchq" - - EXTRA_HELM_ARGS="" - EXTRA_HELM_ARGS+="--set gaffer.hdfs.namenode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.hdfs.datanode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.hdfs.shell.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set gaffer.accumulo.image.repository=${REPO_PREFIX}/gaffer " - EXTRA_HELM_ARGS+="--set gaffer.api.image.repository=${REPO_PREFIX}/gaffer-rest " - EXTRA_HELM_ARGS+="--set loader.image.repository=${REPO_PREFIX}/gaffer-road-traffic-loader " -fi -``` - -## Deploy Helm Chart - -By default the gaffer graph uses the in-memory MapStore. If you want to use an alternative store, we have a guide for that [here](../../docs/deploy-empty-graph.md) - - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -helm dependency update ../accumulo/ -helm dependency update ../gaffer/ -helm dependency update - -helm install gaffer . -f ./values-eks-alb.yaml \ - ${EXTRA_HELM_ARGS} \ - --set gaffer.accumulo.hdfs.namenode.tag=${HADOOP_VERSION} \ - --set gaffer.accumulo.hdfs.datanode.tag=${HADOOP_VERSION} \ - --set gaffer.accumulo.hdfs.shell.tag=${HADOOP_VERSION} \ - --set gaffer.accumulo.image.tag=${GAFFER_VERSION} \ - --set gaffer.api.image.tag=${GAFFER_VERSION} \ - --set loader.image.tag=${GAFFER_VERSION} - -helm test road-traffic -``` diff --git a/kubernetes/gaffer/docs/kind-deployment.md b/kubernetes/gaffer/docs/kind-deployment.md deleted file mode 100644 index 21080ee7..00000000 --- a/kubernetes/gaffer/docs/kind-deployment.md +++ /dev/null @@ -1,54 +0,0 @@ -Deploying Gaffer using kind -============================ - -All the scripts found here are designed to be run from the kubernetes/gaffer folder. - -First follow the [instructions here](../../docs/kind-deployment.md) to provision and configure a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that the Gaffer Helm Chart can be deployed on. - -The standard Gaffer deployment will give you an in-memory store. To change this see [our comprehensive guide](../../docs/deploy-empty-graph.md) to change the store type. - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} -export GAFFER_VERSION=${GAFFER_VERSION:-2.0.0} - -helm dependency update - -helm install gaffer . \ - --set hdfs.namenode.tag=${HADOOP_VERSION} \ - --set hdfs.datanode.tag=${HADOOP_VERSION} \ - --set hdfs.shell.tag=${HADOOP_VERSION} \ - --set accumulo.image.tag=${GAFFER_VERSION} \ - --set api.image.tag=${GAFFER_VERSION} - -helm test gaffer -``` - - -# Accessing Web UIs (via `kubectl port-forward`) - -| Component | Command | URL | -| ----------- | ---------------------------------------------------------- | --------------------------- | -| Gaffer REST | `kubectl port-forward svc/gaffer-api 8080:80` | http://localhost:8080/rest/ | - - -# Accessing Web UIs (via [Nginx Ingress Controller](https://github.com/kubernetes/ingress-nginx)) - -Register the FQDNs for each component in DNS e.g. -``` -echo "127.0.0.1 gaffer.k8s.local accumulo.k8s.local hdfs.k8s.local" | sudo tee -a /etc/hosts -``` - -Update the Gaffer deployment to route ingress based on FQDNs: -``` -helm upgrade gaffer . -f ./values-host-based-ingress.yaml --reuse-values -``` - -Set up port forwarding to the nginx ingress controller: -``` -sudo KUBECONFIG=$HOME/.kube/config kubectl port-forward -n ingress-nginx svc/ingress-nginx 80:80 -``` - -Access the web UIs using the following URLs: -| Component | URL | -| ----------- | ----------------------------- | -| Gaffer REST | http://gaffer.k8s.local/rest/ | \ No newline at end of file diff --git a/kubernetes/hdfs/docs/aws-eks-deployment.md b/kubernetes/hdfs/docs/aws-eks-deployment.md deleted file mode 100644 index e423ba43..00000000 --- a/kubernetes/hdfs/docs/aws-eks-deployment.md +++ /dev/null @@ -1,37 +0,0 @@ -# Deploying HDFS on AWS EKS -All scripts listed here are intended to be run from the kubernetes/hdfs folder - -First follow the [instructions here](../../docs/aws-eks-deployment.md) to provision and configure an [AWS EKS](https://aws.amazon.com/eks/) cluster that the HDFS Helm Chart can be deployed on. - -## Using ECR -If you are hosting the container images in your AWS account, using ECR, then run the following commands to configure the Helm Chart to use them: - -```bash -ACCOUNT=$(aws sts get-caller-identity --query Account --output text) -[ "${REGION}" = "" ] && REGION=$(aws configure get region) -[ "${REGION}" = "" ] && REGION=$(curl --silent -m 5 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f 4) -if [ "${REGION}" = "" ]; then - echo "Unable to detect AWS region, please set \$REGION" -else - REPO_PREFIX="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/gchq" - - EXTRA_HELM_ARGS="" - EXTRA_HELM_ARGS+="--set namenode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set datanode.repository=${REPO_PREFIX}/hdfs " - EXTRA_HELM_ARGS+="--set shell.repository=${REPO_PREFIX}/hdfs " -fi -``` - -## Deploy Helm chart - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} - -helm install hdfs . -f ./values-eks-alb.yaml \ - ${EXTRA_HELM_ARGS} \ - --set hdfs.namenode.tag=${HADOOP_VERSION} \ - --set hdfs.datanode.tag=${HADOOP_VERSION} \ - --set hdfs.shell.tag=${HADOOP_VERSION} - -helm test hdfs -``` diff --git a/kubernetes/hdfs/docs/kind-deployment.md b/kubernetes/hdfs/docs/kind-deployment.md deleted file mode 100644 index e21ced73..00000000 --- a/kubernetes/hdfs/docs/kind-deployment.md +++ /dev/null @@ -1,45 +0,0 @@ -# Deploying HDFS using kind -All scripts listed here are intended to be run from the kubernetes/hdfs folder - -First follow the [instructions here](../../docs/kind-deployment.md) to provision and configure a local Kubernetes cluster, using [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker), that the HDFS Helm Chart can be deployed on. - -## Deploying Helm charts - -```bash -export HADOOP_VERSION=${HADOOP_VERSION:-3.3.3} - -helm install hdfs . \ - --set hdfs.namenode.tag=${HADOOP_VERSION} \ - --set hdfs.datanode.tag=${HADOOP_VERSION} \ - --set hdfs.shell.tag=${HADOOP_VERSION} - -helm test hdfs -``` - -## Accessing Web UI (via `kubectl port-forward`) - -``` -kubectl port-forward svc/hdfs-namenodes 9870:9870 -``` - -Then browse to: http://localhost:9870 - - -## Accessing Web UI (via [Nginx Ingress Controller](https://github.com/kubernetes/ingress-nginx)) - -Register the FQDNs for each component in DNS e.g. -```bash -echo "127.0.0.1 hdfs.k8s.local" | sudo tee -a /etc/hosts -``` - -Update the HDFS deployment to route ingress based on FQDNs: -```bash -helm upgrade hdfs . -f ./values-host-based-ingress.yaml --reuse-values -``` - -Set up port forwarding to the nginx ingress controller: -```bash -sudo KUBECONFIG=$HOME/.kube/config kubectl port-forward -n ingress-nginx svc/ingress-nginx 80:80 -``` - -Then browse to: http://hdfs.k8s.local From 664def58ae978b642743f41081c51150d42b292c Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:57:37 +0000 Subject: [PATCH 4/9] Gh-332: Update actions versions (#333) * Update actions versions * Added copyright * Remove unsupported actions * New release notes * Copyright --- .github/release-notes.yml | 19 +++++++++++++- .github/workflows/continuous-integration.yaml | 2 +- .github/workflows/create-hotfix-branch.yaml | 25 +++---------------- .github/workflows/create-release-branch.yaml | 25 +++---------------- .github/workflows/integration-test.yaml | 2 +- .github/workflows/link-issue.yaml | 16 +++++++++++- .github/workflows/release.yaml | 14 +++++------ 7 files changed, 50 insertions(+), 53 deletions(-) diff --git a/.github/release-notes.yml b/.github/release-notes.yml index 8edbf0d1..3bae10e4 100644 --- a/.github/release-notes.yml +++ b/.github/release-notes.yml @@ -1,9 +1,26 @@ +# Copyright 2020-2023 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. + releasenotes: sections: - title: "Headliners" emoji: ":star:" labels: [ "headliner" ] - title: "New Features" + emoji: ":gift:" + labels: [ "feature" ] + - title: "Enhancements" emoji: ":sparkles:" labels: [ "enhancement" ] - title: "Bugs Fixed" @@ -14,4 +31,4 @@ releasenotes: labels: "documentation" - title: "Automation" emoji: ":robot:" - labels: [ "automation" ] \ No newline at end of file + labels: [ "automation" ] diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 2bd04488..d55dba4f 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -33,7 +33,7 @@ jobs: remove-android: 'true' overprovision-lvm: 'true' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/create-hotfix-branch.yaml b/.github/workflows/create-hotfix-branch.yaml index 6dff2e81..8a02ce65 100644 --- a/.github/workflows/create-hotfix-branch.yaml +++ b/.github/workflows/create-hotfix-branch.yaml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout master - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -46,29 +46,12 @@ jobs: if: ${{ !github.event.inputs.version }} run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^v//')" >> $GITHUB_ENV - - name: Bump latest tag variable + - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-bump-semver@v1 - id: bump-semver - with: - current_version: ${{ env.CURRENT_VERSION }} - level: patch - - - name: Set version automatically - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ steps.bump-semver.outputs.new_version }} )" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.\2.$((\3+1))/' | sh)" >> $GITHUB_ENV - name: Verify version regex - uses: actions-ecosystem/action-regex-match@v2 - id: regex-match - with: - text: ${{ env.RELEASE_VERSION }} - # Ensure version doesn't end in .0 - regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.([1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - - name: Fail if incorrect version - if: ${{ !steps.regex-match.outputs.match }} - run: exit 1 + run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - name: Set hotfix branch run: echo "BRANCH_NAME=$(echo hotfix/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index 63810e47..7782110b 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout develop - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -46,29 +46,12 @@ jobs: if: ${{ !github.event.inputs.version }} run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^v//')" >> $GITHUB_ENV - - name: Bump latest tag variable + - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-bump-semver@v1 - id: bump-semver - with: - current_version: ${{ env.CURRENT_VERSION }} - level: minor - - - name: Set version automatically - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ steps.bump-semver.outputs.new_version }} )" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.$((\2+1)).0/' | sh)" >> $GITHUB_ENV - name: Verify version regex - uses: actions-ecosystem/action-regex-match@v2 - id: regex-match - with: - text: ${{ env.RELEASE_VERSION }} - # Ensure valid semver version - regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - - name: Fail if incorrect version - if: ${{ !steps.regex-match.outputs.match }} - run: exit 1 + run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - name: Set release branch run: echo "BRANCH_NAME=$(echo release/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index af6c07fc..439ed099 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -25,7 +25,7 @@ jobs: GAFFER_VERSION: develop GAFFER_TESTER_VERSION: develop steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run Integration Tests run: | diff --git a/.github/workflows/link-issue.yaml b/.github/workflows/link-issue.yaml index a177ca96..e13ea9be 100644 --- a/.github/workflows/link-issue.yaml +++ b/.github/workflows/link-issue.yaml @@ -1,3 +1,17 @@ +# Copyright 2020-2023 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. + name: 'Issue Links' on: pull_request: @@ -7,7 +21,7 @@ jobs: issue-links: runs-on: ubuntu-latest steps: - - uses: tkt-actions/add-issue-links@v1.6.0 + - uses: tkt-actions/add-issue-links@v1.8.2 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' branch-prefix: 'gh-' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bce357cc..24584f3f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout master - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -47,7 +47,7 @@ jobs: - name: Output branch name id: branch - run: echo "::set-output name=branch_name::$BRANCH_NAME" + run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - name: Fail if no branch found if: ${{ !env.BRANCH_NAME }} @@ -76,7 +76,7 @@ jobs: - create-release-tag steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ matrix.branch }} token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -101,7 +101,7 @@ jobs: - update-branches steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: develop @@ -129,7 +129,7 @@ jobs: release_upload_url: ${{ steps.upload_notes.outputs.upload_url }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: develop @@ -167,7 +167,7 @@ jobs: - gaffer-jhub steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: develop @@ -206,7 +206,7 @@ jobs: steps: - name: Checkout gh-pages - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: gh-pages token: ${{ secrets.ADMIN_GITHUB_TOKEN }} From 291502f33af2b873360e051a4982eb4bc47e28d8 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:54:41 +0000 Subject: [PATCH 5/9] Update gafferpy references (#331) --- docker/gaffer-pyspark-notebook/Dockerfile | 8 ++++---- docker/gaffer-pyspark-notebook/README.md | 2 +- docker/gaffer-pyspark-notebook/docker-compose.yaml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/gaffer-pyspark-notebook/Dockerfile b/docker/gaffer-pyspark-notebook/Dockerfile index ddebb210..8bce231a 100644 --- a/docker/gaffer-pyspark-notebook/Dockerfile +++ b/docker/gaffer-pyspark-notebook/Dockerfile @@ -60,12 +60,12 @@ ARG KUBECTL_VERSION=1.23.0 RUN curl -fLo /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \ chmod +x /bin/kubectl -ARG GAFFERPY_VERSION=gaffer-tools-2.0.0 -RUN git clone -b ${GAFFERPY_VERSION} --depth 1 https://github.com/gchq/gaffer-tools && \ - pushd gaffer-tools/python-shell && \ +ARG GAFFERPY_VERSION=gafferpy-2.0.0 +RUN git clone -b ${GAFFERPY_VERSION} --depth 1 https://github.com/gchq/gafferpy && \ + pushd gafferpy && \ python setup.py install && \ popd && \ - rm -rf gaffer-tools + rm -rf gafferpy RUN jupyter labextension install jupyterlab-plotly@5.5.0 && \ rm -rf "/home/${NB_USER}/.cache/yarn" diff --git a/docker/gaffer-pyspark-notebook/README.md b/docker/gaffer-pyspark-notebook/README.md index 372f7304..f64fb119 100644 --- a/docker/gaffer-pyspark-notebook/README.md +++ b/docker/gaffer-pyspark-notebook/README.md @@ -8,7 +8,7 @@ This extends [scipy-notebook](https://github.com/jupyter/docker-stacks/tree/mast * Hadoop * Spark * `kubectl` and the `kubernetes` python package -* [gafferpy](https://github.com/gchq/gaffer-tools/tree/master/python-shell) +* [gafferpy](https://github.com/gchq/gafferpy/tree/main/) Some example notebooks that demonstrate how to query Gaffer and use Spark are available at [`/examples`](examples/). diff --git a/docker/gaffer-pyspark-notebook/docker-compose.yaml b/docker/gaffer-pyspark-notebook/docker-compose.yaml index 90b947de..4423e9a6 100644 --- a/docker/gaffer-pyspark-notebook/docker-compose.yaml +++ b/docker/gaffer-pyspark-notebook/docker-compose.yaml @@ -222,7 +222,7 @@ services: args: HADOOP_VERSION: ${HADOOP_VERSION} SPARK_VERSION: ${SPARK_VERSION} - GAFFERPY_VERSION: gaffer-tools-${GAFFERPY_VERSION} + GAFFERPY_VERSION: gafferpy-${GAFFERPY_VERSION} KUBECTL_VERSION: ${KUBECTL_VERSION} ports: - 8888:8888 From 1db51cc7a12e0c373519251683cf545f99f6f9f9 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:10:20 +0000 Subject: [PATCH 6/9] Gh-252: Kerberos integration tests (#335) * Add docker compose and config files for Integration tests with Kerberos * Improve dockerfile apt install commands This prevents getting stuck on installer messages which prompt for user input --- .../gaffer-integration-tests-krb/.env | 17 ++ .../gaffer-integration-tests-krb/Dockerfile | 32 +++ .../gaffer-integration-tests-krb/README.md | 19 ++ .../accumulo-int-entrypoint.sh | 42 ++++ .../conf/accumulo-shell-client.properties | 28 +++ .../conf/core-site.xml | 31 +++ .../conf/hdfs-site.xml | 23 ++ .../conf/log4j.xml | 33 +++ .../docker-compose.yaml | 229 ++++++++++++++++++ .../krb-entrypoint.sh | 73 ++++++ .../native/.gitkeep | 0 docker/gaffer-kerberos/gaffer-krb/Dockerfile | 11 +- docker/gaffer-kerberos/hdfs-krb/Dockerfile | 12 +- docker/gaffer-kerberos/kdc/Dockerfile | 15 +- .../gaffer-kerberos/zookeeper-krb/Dockerfile | 11 +- 15 files changed, 553 insertions(+), 23 deletions(-) create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/.env create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/Dockerfile create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/README.md create mode 100755 docker/gaffer-kerberos/gaffer-integration-tests-krb/accumulo-int-entrypoint.sh create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/accumulo-shell-client.properties create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/core-site.xml create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/hdfs-site.xml create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/log4j.xml create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/docker-compose.yaml create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/krb-entrypoint.sh create mode 100644 docker/gaffer-kerberos/gaffer-integration-tests-krb/native/.gitkeep diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env b/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env new file mode 100644 index 00000000..3845e902 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env @@ -0,0 +1,17 @@ +GAFFER_VERSION=2.0.0 +GAFFER_KRB_PASSWORD=change-password-for-gaffer +GAFFER_TESTER_VERSION=2.0.0 + +ZOOKEEPER_VERSION=3.7.1 +ZOOKEEPER_KRB_PASSWORD=change-password-for-zookeeper + +ACCUMULO_VERSION=1.9.3 +ACCUMULO_CONF_DIR=/etc/accumulo/conf +ACCUMULO_KRB_PASSWORD=change-password-for-accumulo + +HADOOP_VERSION=3.2.2 +HADOOP_CONF_DIR=/etc/hadoop/conf +HADOOP_KRB_PASSWORD=change-password-for-hadoop + +DEBUG=0 +GAFFER_DEBUG=0 diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/Dockerfile b/docker/gaffer-kerberos/gaffer-integration-tests-krb/Dockerfile new file mode 100644 index 00000000..9271d57d --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/Dockerfile @@ -0,0 +1,32 @@ +# Copyright 2021-2023 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 GAFFER_VERSION=develop +ARG ACCUMULO_VERSION=1.9.3 + +ARG BASE_IMAGE_NAME=gchq/gaffer-integration-tests +ARG BASE_IMAGE_TAG=${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + +FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -qq update && \ + apt-get -qq install -y krb5-kdc && \ + apt-get -qq clean && \ + rm -rf /var/lib/apt/lists/* + +COPY ./native /tmp/hadoop/native +COPY ./krb-entrypoint.sh . +ENTRYPOINT ["/bin/bash","./krb-entrypoint.sh"] diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/README.md b/docker/gaffer-kerberos/gaffer-integration-tests-krb/README.md new file mode 100644 index 00000000..4e727c77 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/README.md @@ -0,0 +1,19 @@ +Gaffer Kerberos Integration Tests +================================= +This folder contains a Dockerfile for running integration tests against an Accumulo cluster which uses Kerberos authentication. + +For more information on the integration tests, please see the primary Gaffer Docker integration tests README. + +# Prerequisites +For the HDFS tests to work, you must acquire and place the HDFS native libraries into the `native` directory. +You must also have built the Gaffer with Kerberos containers in the directory above and the non-kerberos +version of the integration tests container image. + +# Running Locally +These services can be built and run using docker compose: +```bash +docker compose up +``` + +# Issues +HDFS tests fail with Accumulo 2.0.0. They pass with Accumulo 1.9.3. This problem has been raised as [Gaffer issue #3134](https://github.com/gchq/Gaffer/issues/3134). \ No newline at end of file diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/accumulo-int-entrypoint.sh b/docker/gaffer-kerberos/gaffer-integration-tests-krb/accumulo-int-entrypoint.sh new file mode 100755 index 00000000..99b9fac8 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/accumulo-int-entrypoint.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# Copyright 2023 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. + +# Wait for Accumulo to be started and working (uses same approach as compose healthcheck) +until cat /proc/net/tcp | grep 270F; do + sleep 15 +done + +# Grant required permissions and auths to Gaffer user for integration tests + +PRINCIPAL="accumulo/$(hostname)" +FULL_PRINCIPAL="$PRINCIPAL@GAFFER.DOCKER" +GAFFER_FULL_PRINCIPAL=$1 + +kinit -k -t /etc/accumulo/conf/accumulo.keytab $FULL_PRINCIPAL + +echo "\nGranting permissions for Gaffer integration tests\n" + +if echo "$ACCUMULO_VERSION" | grep -q "^2.*$"; then + ACCUMULO_SHELL_CMD="accumulo shell --config-file accumulo-shell-client.properties -e" +else + ACCUMULO_SHELL_CMD="accumulo shell -e" +fi + +$ACCUMULO_SHELL_CMD "createuser $GAFFER_FULL_PRINCIPAL" +$ACCUMULO_SHELL_CMD "grant System.CREATE_TABLE -s -u $GAFFER_FULL_PRINCIPAL" +$ACCUMULO_SHELL_CMD "grant System.DROP_TABLE -s -u $GAFFER_FULL_PRINCIPAL" +$ACCUMULO_SHELL_CMD "grant System.ALTER_TABLE -s -u $GAFFER_FULL_PRINCIPAL" +$ACCUMULO_SHELL_CMD "setauths -s vis1,vis2,publicVisibility,privateVisibility,public,private -u $GAFFER_FULL_PRINCIPAL" diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/accumulo-shell-client.properties b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/accumulo-shell-client.properties new file mode 100644 index 00000000..efe7ae12 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/accumulo-shell-client.properties @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +## Required to set Zookeeper host +instance.zookeepers=zookeeper.gaffer:2181 +## Required to set Accumulo Instance name +instance.name = accumulo +## Required to get Kerberos to be used +auth.type = kerberos +auth.principal = accumulo/accumulo-master.gaffer@GAFFER.DOCKER +auth.token = /etc/accumulo/conf/accumulo.keytab + +## Further Kerberos Config +sasl.enabled = true +sasl.qop = auth +sasl.kerberos.server.primary = accumulo diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/core-site.xml b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/core-site.xml new file mode 100644 index 00000000..74c0b946 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/core-site.xml @@ -0,0 +1,31 @@ + + + + + + hadoop.security.authentication + kerberos + + + hadoop.security.authorization + true + + + fs.defaultFS + hdfs://hdfs-namenode.gaffer:9000 + + diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/hdfs-site.xml b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/hdfs-site.xml new file mode 100644 index 00000000..e95a2110 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/hdfs-site.xml @@ -0,0 +1,23 @@ + + + + + + yarn.resourcemanager.principalgaffer/gaffer-int.gaffer@GAFFER.DOCKER + + dfs.namenode.kerberos.principalhadoop/hdfs-namenode.gaffer@GAFFER.DOCKER + diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/log4j.xml b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/log4j.xml new file mode 100644 index 00000000..2edc3a86 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/conf/log4j.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/docker-compose.yaml b/docker/gaffer-kerberos/gaffer-integration-tests-krb/docker-compose.yaml new file mode 100644 index 00000000..86a47e72 --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/docker-compose.yaml @@ -0,0 +1,229 @@ +# Copyright 2023 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" + +networks: + default: + name: gaffer + +services: + + kdc-server: + image: gchq/kerberos-kdc-server:0.1 + healthcheck: + test: ps -aux | grep krb5kdc + retries: 5 + interval: 1s + timeout: 5s + container_name: kdc-server + hostname: kdc-server + environment: + - HADOOP_KRB_PASSWORD=${HADOOP_KRB_PASSWORD} + - ZOOKEEPER_KRB_PASSWORD=${ZOOKEEPER_KRB_PASSWORD} + - ACCUMULO_KRB_PASSWORD=${ACCUMULO_KRB_PASSWORD} + - GAFFER_KRB_PASSWORD=${GAFFER_KRB_PASSWORD} + volumes: + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - ../kdc/conf/kdc.conf:/etc/kdc.conf:ro + + zookeeper: + depends_on: + kdc-server: + condition: service_healthy + healthcheck: + test: echo ruok | nc 127.0.0.1 2181 | grep imok + interval: 30s + timeout: 5s + retries: 3 + start_period: 5s + image: zookeeper:${ZOOKEEPER_VERSION}-krb + container_name: zookeeper + hostname: zookeeper + environment: + - ZOOKEEPER_KRB_PASSWORD=${ZOOKEEPER_KRB_PASSWORD} + volumes: + - ../zookeeper-krb/conf/jaas.conf:/conf/jaas.conf:ro + - ../zookeeper-krb/conf/java.env:/conf/java.env:ro + - ../zookeeper-krb/conf/zoo.cfg:/conf/zoo.cfg:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /data + - /datalog + + hdfs-namenode: + depends_on: + zookeeper: + condition: service_healthy + image: gchq/hdfs-krb:${HADOOP_VERSION} + healthcheck: + test: curl -f http://localhost:9870 || exit 1 + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s + command: namenode + container_name: hdfs-namenode + hostname: hdfs-namenode.gaffer + environment: + - HADOOP_CONF_DIR=${HADOOP_CONF_DIR} + - HADOOP_KRB_PASSWORD=${HADOOP_KRB_PASSWORD} + - DEBUG=${DEBUG} + ports: + - "9870:9870" + volumes: + - ../hdfs-krb/conf:${HADOOP_CONF_DIR}:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /var/log/hadoop + - /data1 + - /data2 + + hdfs-datanode: + depends_on: + hdfs-namenode: + condition: service_healthy + image: gchq/hdfs-krb:${HADOOP_VERSION} + command: datanode + container_name: hdfs-datanode + hostname: hdfs-datanode.gaffer + environment: + - HADOOP_CONF_DIR=${HADOOP_CONF_DIR} + - HADOOP_KRB_PASSWORD=${HADOOP_KRB_PASSWORD} + - DEBUG=${DEBUG} + volumes: + - ../hdfs-krb/conf:${HADOOP_CONF_DIR}:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /var/log/hadoop + - /data1 + - /data2 + + accumulo-master: + depends_on: + hdfs-namenode: + condition: service_healthy + image: gchq/gaffer-krb:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + healthcheck: + test: cat /proc/net/tcp | grep 270F + interval: 30s + timeout: 5s + retries: 3 + start_period: 20s + # When calling entrypoint, also call a script to + # correctly setup auths so that tests can run + entrypoint: bash -c "/int-entrypoint.sh gaffer/gaffer-int.gaffer@GAFFER.DOCKER & /krb-entrypoint.sh accumulo master" + container_name: accumulo-master + hostname: accumulo-master.gaffer + environment: + - ACCUMULO_KRB_PASSWORD=${ACCUMULO_KRB_PASSWORD} + - ACCUMULO_VERSION=${ACCUMULO_VERSION} + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + - ACCUMULO_AS_ROOT=1 + - DEBUG=${DEBUG} + volumes: + - ../gaffer-krb/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/krb:ro + - ../gaffer-krb/conf-common/core-site.xml:${ACCUMULO_CONF_DIR}/core-site.xml:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/non-krb:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - ./accumulo-int-entrypoint.sh:/int-entrypoint.sh:ro + - ./conf/accumulo-shell-client.properties:/accumulo-shell-client.properties:ro + - /var/log/accumulo + + accumulo-tserver: + depends_on: + accumulo-master: + condition: service_healthy + image: gchq/gaffer-krb:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + healthcheck: + test: cat /proc/net/tcp | grep 270D + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s + command: tserver + container_name: accumulo-tserver + hostname: accumulo-tserver.gaffer + environment: + - ACCUMULO_KRB_PASSWORD=${ACCUMULO_KRB_PASSWORD} + - ACCUMULO_VERSION=${ACCUMULO_VERSION} + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + - DEBUG=${DEBUG} + volumes: + - ../gaffer-krb/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/krb:ro + - ../gaffer-krb/conf-common/core-site.xml:${ACCUMULO_CONF_DIR}/core-site.xml:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/non-krb:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /var/log/accumulo + + accumulo-monitor: + depends_on: + accumulo-master: + condition: service_healthy + image: gchq/gaffer-krb:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + command: monitor + container_name: accumulo-monitor + hostname: accumulo-monitor.gaffer + environment: + - ACCUMULO_KRB_PASSWORD=${ACCUMULO_KRB_PASSWORD} + - ACCUMULO_VERSION=${ACCUMULO_VERSION} + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + - DEBUG=${DEBUG} + ports: + - "9995:9995" + volumes: + - ../gaffer-krb/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/krb:ro + - ../gaffer-krb/conf-common/core-site.xml:${ACCUMULO_CONF_DIR}/core-site.xml:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/non-krb:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /var/log/accumulo + + accumulo-gc: + depends_on: + accumulo-master: + condition: service_healthy + image: gchq/gaffer-krb:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + command: gc + container_name: accumulo-gc + hostname: accumulo-gc.gaffer + environment: + - ACCUMULO_KRB_PASSWORD=${ACCUMULO_KRB_PASSWORD} + - ACCUMULO_VERSION=${ACCUMULO_VERSION} + - ACCUMULO_CONF_DIR=${ACCUMULO_CONF_DIR} + - DEBUG=${DEBUG} + volumes: + - ../gaffer-krb/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/krb:ro + - ../gaffer-krb/conf-common/core-site.xml:${ACCUMULO_CONF_DIR}/core-site.xml:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}/non-krb:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro + - /var/log/accumulo + + gaffer-integration-tests: + image: gchq/gaffer-integration-tests-krb:${GAFFER_TESTER_VERSION}-accumulo-${ACCUMULO_VERSION} + build: + context: . + args: + GAFFER_VERSION: ${GAFFER_TESTER_VERSION} + ACCUMULO_VERSION: ${ACCUMULO_VERSION} + container_name: gaffer-int + hostname: gaffer-int.gaffer + environment: + - GAFFER_KRB_PASSWORD=${GAFFER_KRB_PASSWORD} + - GAFFER_DEBUG=${GAFFER_DEBUG} + - DEBUG=${DEBUG} + volumes: + - ../gaffer-rest-krb/conf/store.properties:/tests/conf/store.properties:ro + - ./conf/log4j.xml:/tests/conf/log4j.xml:ro + - ./conf/core-site.xml:/opt/hadoop/conf/core-site.xml:ro + - ./conf/hdfs-site.xml:/opt/hadoop/conf/hdfs-site.xml:ro + - ../gaffer-krb/conf-1.9.3/client.conf:/etc/accumulo/client.conf:ro + - ../gaffer-krb/conf-2.0.1/accumulo-client.properties:/etc/accumulo/accumulo-client.properties:ro + - ../kdc/conf/krb5.conf:/etc/krb5.conf:ro diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/krb-entrypoint.sh b/docker/gaffer-kerberos/gaffer-integration-tests-krb/krb-entrypoint.sh new file mode 100644 index 00000000..9044f75b --- /dev/null +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/krb-entrypoint.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# Copyright 2020-2023 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. + +set -ex + +# Show verbose Hadoop Kerberos auth information +if [ $DEBUG -eq 1 ]; then + export HADOOP_JAAS_DEBUG=true + export HADOOP_OPTS="-Djava.net.preferIPv4Stack=true -Dsun.security.krb5.debug=true -Dsun.security.spnego.debug" + echo "Debugging flag enabled (DEBUG=$DEBUG), additional Kerberos details will be printed" +fi + +KEYTAB_PATH=/tmp/gaffer.keytab +PRINCIPAL=gaffer/$(hostname) +FULL_PRINCIPAL=gaffer/$(hostname)@GAFFER.DOCKER + +{ +echo "add_entry -password -p $PRINCIPAL -k 1 -e aes256-cts"; sleep 0.2 +echo $GAFFER_KRB_PASSWORD; sleep 0.2 +echo list; sleep 0.2 +echo "write_kt $KEYTAB_PATH"; sleep 0.2 +echo exit +} | ktutil + +# Update store properties files to point to the location of the Accumulo store to test against: +accumulo_instance=$(cat conf/store.properties | grep accumulo.instance | sed -e 's/.*=\(.*\)/\1/') +accumulo_zookeepers=$(cat conf/store.properties | grep accumulo.zookeepers | sed -e 's/.*=\(.*\)/\1/') +store_properties=$(find /tmp/gaffer/store-implementation/accumulo-store/src/test/resources -name *.properties | grep -v cache) + +for store in $store_properties; do +sed -i'' -e "s/gaffer.store.class=\(.*\)Mini\(.*\)/gaffer.store.class=\1\2/" $store +sed -i'' -e "s/accumulo.instance=.*/accumulo.instance=$accumulo_instance/" $store +sed -i'' -e "s/accumulo.zookeepers=.*/accumulo.zookeepers=$accumulo_zookeepers/" $store +echo accumulo.kerberos.principal=$FULL_PRINCIPAL >> $store +echo accumulo.kerberos.keytab=$KEYTAB_PATH >> $store +echo accumulo.kerberos.enable=true >> $store +done + +# Needed for AddElementsFromHdfs tests +cp /opt/hadoop/conf/core-site.xml /tmp/gaffer/store-implementation/accumulo-store/src/test/resources/ +cp /opt/hadoop/conf/hdfs-site.xml /tmp/gaffer/store-implementation/accumulo-store/src/test/resources/ + +# Required for Hadoop to find its Native Libraries which Kerberos auth cannot work without +cp /tmp/hadoop/native/lib* /usr/lib/ + +# Set correct LEGACY var based on Accumulo version +if echo "$ACCUMULO_VERSION" | grep -q "^1.*$"; then LEGACY=true; else LEGACY=false; fi + +# Run Integration Tests +cd /tmp/gaffer +# Compile Tests +mvn -q clean install -Dlegacy=$LEGACY -pl :accumulo-store -am -Pquick +# Run Tests without quiet output if GAFFER_DEBUG enabled +if [ $GAFFER_DEBUG -eq 1 ]; then + # Replace log config with a config which uses INFO level, this additional info may help for Gaffer ticket #3134 + cp /tests/conf/log4j.xml /tmp/gaffer/store-implementation/accumulo-store/src/test/resources/ + mvn verify -Dlegacy=$LEGACY -ntp -Dskip.surefire.tests -Dmaven.test.failure.ignore=true -Dmaven.main.skip=true -DtrimStackTrace=false -DuseFile=false -Pcoverage -pl :accumulo-store +else + mvn -q verify -Dlegacy=$LEGACY -Dskip.surefire.tests -pl :accumulo-store -ff +fi diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/native/.gitkeep b/docker/gaffer-kerberos/gaffer-integration-tests-krb/native/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/docker/gaffer-kerberos/gaffer-krb/Dockerfile b/docker/gaffer-kerberos/gaffer-krb/Dockerfile index 1c34a676..13127da5 100644 --- a/docker/gaffer-kerberos/gaffer-krb/Dockerfile +++ b/docker/gaffer-kerberos/gaffer-krb/Dockerfile @@ -20,12 +20,13 @@ ARG GROUP=accumulo FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} +ENV DEBIAN_FRONTEND=noninteractive + USER root -RUN apt -qq update && \ - apt -qq install -y \ - krb5-user && \ - apt -qq clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get -qq update && \ + apt-get -qq install -y krb5-kdc && \ + apt-get -qq clean && \ + rm -rf /var/lib/apt/lists/* USER ${USER} COPY ./krb-entrypoint.sh / diff --git a/docker/gaffer-kerberos/hdfs-krb/Dockerfile b/docker/gaffer-kerberos/hdfs-krb/Dockerfile index 6a9b2cfd..925eeea8 100644 --- a/docker/gaffer-kerberos/hdfs-krb/Dockerfile +++ b/docker/gaffer-kerberos/hdfs-krb/Dockerfile @@ -20,13 +20,13 @@ ARG GROUP=hadoop FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} +ENV DEBIAN_FRONTEND=noninteractive + USER root -RUN apt -qq update && \ - apt -qq install -y \ - krb5-user \ - jsvc && \ - apt -qq clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get -qq update && \ + apt-get -qq install -y krb5-kdc && \ + apt-get -qq clean && \ + rm -rf /var/lib/apt/lists/* RUN chown -R ${USER}:${GROUP} /opt/hadoop/etc/hadoop && \ echo "export HDFS_DATANODE_SECURE_USER=hadoop" >> /opt/hadoop/etc/hadoop/hadoop-env.sh && \ diff --git a/docker/gaffer-kerberos/kdc/Dockerfile b/docker/gaffer-kerberos/kdc/Dockerfile index 495757c8..f7a3a47e 100644 --- a/docker/gaffer-kerberos/kdc/Dockerfile +++ b/docker/gaffer-kerberos/kdc/Dockerfile @@ -17,13 +17,14 @@ ARG BASE_IMAGE_TAG=focal-20230412 FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} -RUN apt -qq update && \ - apt -qq install -y \ - krb5-kdc \ - krb5-admin-server \ - procps && \ - apt -qq clean \ - && rm -rf /var/lib/apt/lists/* +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -qq update && \ + apt-get -qq install -y \ + krb5-kdc krb5-admin-server \ + procps && \ + apt-get -qq clean && \ + rm -rf /var/lib/apt/lists/* COPY ./entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/gaffer-kerberos/zookeeper-krb/Dockerfile b/docker/gaffer-kerberos/zookeeper-krb/Dockerfile index c5f7bca6..dd05d794 100644 --- a/docker/gaffer-kerberos/zookeeper-krb/Dockerfile +++ b/docker/gaffer-kerberos/zookeeper-krb/Dockerfile @@ -17,11 +17,12 @@ ARG BASE_IMAGE_TAG=3.7.1 FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} -RUN apt -qq update && \ - apt -qq install -y \ - krb5-kdc && \ - apt -qq clean \ - && rm -rf /var/lib/apt/lists/* +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -qq update && \ + apt-get -qq install -y krb5-kdc && \ + apt-get -qq clean && \ + rm -rf /var/lib/apt/lists/* COPY ./krb-entrypoint.sh / ENTRYPOINT ["/krb-entrypoint.sh"] From a893cce85d0ca0c6cb568cd230fb9c0b8cfd317a Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:59:46 +0000 Subject: [PATCH 7/9] Gh-338: Updating Gaffer version to 2.1.0 (#339) * Updating Gaffer version to 2.1.0 * Removed double slash causing spring error * Update type schema for road-traffic-data-loader Changed in Gaffer PR 2966 * Hotfix for missing sketches classes See Gaffer issue #3159 * Free extra disk space in Actions runner Update settings for build space action in continuous-integration.yaml --------- Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> --- .github/workflows/continuous-integration.yaml | 8 ++++++-- docker/accumulo1.env | 6 +++--- docker/accumulo2.env | 6 +++--- docker/gaffer-federated-integration-tests/.env | 4 ++-- docker/gaffer-integration-tests/.env | 4 ++-- docker/gaffer-kerberos/.env | 2 +- .../gaffer-kerberos/gaffer-integration-tests-krb/.env | 4 ++-- docker/gaffer-kerberos/gaffer-krb/Dockerfile | 4 ++-- docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile | 4 ++-- docker/gaffer-pyspark-notebook/.env | 4 ++-- docker/gaffer-pyspark-notebook/Dockerfile | 4 ++-- docker/gaffer-rest/.env | 2 +- docker/gaffer-rest/Dockerfile | 4 ++-- docker/gaffer-road-traffic-loader/.env | 2 +- docker/gaffer-road-traffic-loader/Dockerfile | 4 ++-- .../config/schema/types.json | 6 +++--- docker/gaffer/.env | 2 +- docker/gaffer/Dockerfile | 8 ++++++-- docker/gremlin-gaffer/.env | 2 +- docker/gremlin-gaffer/Dockerfile | 4 ++-- kubernetes/accumulo/Chart.yaml | 6 +++--- kubernetes/gaffer-jhub/Chart.yaml | 4 ++-- kubernetes/gaffer-jhub/values.yaml | 8 ++++---- kubernetes/gaffer-road-traffic/Chart.yaml | 8 ++++---- kubernetes/gaffer-road-traffic/values.yaml | 10 +++++----- kubernetes/gaffer/Chart.yaml | 8 ++++---- .../gaffer/templates/graph-status-check-hook.yaml | 4 ++-- kubernetes/gaffer/values.yaml | 6 +++--- kubernetes/hdfs/Chart.yaml | 4 ++-- 29 files changed, 75 insertions(+), 67 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index d55dba4f..fc97fbc4 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -27,10 +27,14 @@ jobs: steps: - name: Maximize build space - uses: easimon/maximize-build-space@v4 + uses: easimon/maximize-build-space@v10 with: remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-docker-images: 'true' + swap-size-mb: 1024 overprovision-lvm: 'true' - uses: actions/checkout@v4 diff --git a/docker/accumulo1.env b/docker/accumulo1.env index 570967fb..5de87e9e 100644 --- a/docker/accumulo1.env +++ b/docker/accumulo1.env @@ -3,7 +3,7 @@ HADOOP_VERSION=3.2.2 ACCUMULO_VERSION=1.9.3 HADOOP_CONF_DIR=/etc/hadoop/conf ACCUMULO_CONF_DIR=/etc/accumulo/conf -GAFFER_VERSION=2.0.0 -GAFFER_TESTER_VERSION=2.0.0 -GAFFERPY_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 +GAFFER_TESTER_VERSION=2.1.0 +GAFFERPY_VERSION=2.1.0 SPARK_VERSION=3.1.2 diff --git a/docker/accumulo2.env b/docker/accumulo2.env index d4d48ddb..e415ae8f 100644 --- a/docker/accumulo2.env +++ b/docker/accumulo2.env @@ -3,7 +3,7 @@ HADOOP_VERSION=3.3.3 ACCUMULO_VERSION=2.0.1 HADOOP_CONF_DIR=/etc/hadoop/conf ACCUMULO_CONF_DIR=/etc/accumulo/conf -GAFFER_VERSION=2.0.0 -GAFFER_TESTER_VERSION=2.0.0 -GAFFERPY_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 +GAFFER_TESTER_VERSION=2.1.0 +GAFFERPY_VERSION=2.1.0 SPARK_VERSION=3.1.2 diff --git a/docker/gaffer-federated-integration-tests/.env b/docker/gaffer-federated-integration-tests/.env index ba332c25..798f9bf3 100644 --- a/docker/gaffer-federated-integration-tests/.env +++ b/docker/gaffer-federated-integration-tests/.env @@ -1,6 +1,6 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 -GAFFER_TESTER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 +GAFFER_TESTER_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 ACCUMULO_CONF_DIR=/etc/accumulo/conf diff --git a/docker/gaffer-integration-tests/.env b/docker/gaffer-integration-tests/.env index ba332c25..798f9bf3 100644 --- a/docker/gaffer-integration-tests/.env +++ b/docker/gaffer-integration-tests/.env @@ -1,6 +1,6 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 -GAFFER_TESTER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 +GAFFER_TESTER_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 ACCUMULO_CONF_DIR=/etc/accumulo/conf diff --git a/docker/gaffer-kerberos/.env b/docker/gaffer-kerberos/.env index 32fa884d..79a080fa 100644 --- a/docker/gaffer-kerberos/.env +++ b/docker/gaffer-kerberos/.env @@ -1,4 +1,4 @@ -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 GAFFER_KRB_PASSWORD=change-password-for-gaffer ZOOKEEPER_VERSION=3.7.1 diff --git a/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env b/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env index 3845e902..f6e0cfd2 100644 --- a/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env +++ b/docker/gaffer-kerberos/gaffer-integration-tests-krb/.env @@ -1,6 +1,6 @@ -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 GAFFER_KRB_PASSWORD=change-password-for-gaffer -GAFFER_TESTER_VERSION=2.0.0 +GAFFER_TESTER_VERSION=2.1.0 ZOOKEEPER_VERSION=3.7.1 ZOOKEEPER_KRB_PASSWORD=change-password-for-zookeeper diff --git a/docker/gaffer-kerberos/gaffer-krb/Dockerfile b/docker/gaffer-kerberos/gaffer-krb/Dockerfile index 13127da5..396b30e0 100644 --- a/docker/gaffer-kerberos/gaffer-krb/Dockerfile +++ b/docker/gaffer-kerberos/gaffer-krb/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2023 Crown Copyright +# 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. @@ -13,7 +13,7 @@ # limitations under the License. ARG BASE_IMAGE_NAME=gchq/gaffer -ARG BASE_IMAGE_TAG=2.0.0 +ARG BASE_IMAGE_TAG=2.1.0 ARG USER=accumulo ARG GROUP=accumulo diff --git a/docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile b/docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile index da98bf20..d504fec5 100644 --- a/docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile +++ b/docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2023 Crown Copyright +# 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. @@ -13,7 +13,7 @@ # limitations under the License. ARG BASE_IMAGE_NAME=gchq/gaffer-rest -ARG BASE_IMAGE_TAG=2.0.0 +ARG BASE_IMAGE_TAG=2.1.0 FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} diff --git a/docker/gaffer-pyspark-notebook/.env b/docker/gaffer-pyspark-notebook/.env index b0556850..2c1f748c 100644 --- a/docker/gaffer-pyspark-notebook/.env +++ b/docker/gaffer-pyspark-notebook/.env @@ -1,6 +1,6 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 -GAFFERPY_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 +GAFFERPY_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 SPARK_VERSION=3.1.2 diff --git a/docker/gaffer-pyspark-notebook/Dockerfile b/docker/gaffer-pyspark-notebook/Dockerfile index 8bce231a..616c2682 100644 --- a/docker/gaffer-pyspark-notebook/Dockerfile +++ b/docker/gaffer-pyspark-notebook/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -60,7 +60,7 @@ ARG KUBECTL_VERSION=1.23.0 RUN curl -fLo /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \ chmod +x /bin/kubectl -ARG GAFFERPY_VERSION=gafferpy-2.0.0 +ARG GAFFERPY_VERSION=gafferpy-2.1.0 RUN git clone -b ${GAFFERPY_VERSION} --depth 1 https://github.com/gchq/gafferpy && \ pushd gafferpy && \ python setup.py install && \ diff --git a/docker/gaffer-rest/.env b/docker/gaffer-rest/.env index c1bc9e35..f2fcf3c5 100644 --- a/docker/gaffer-rest/.env +++ b/docker/gaffer-rest/.env @@ -1,2 +1,2 @@ -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 diff --git a/docker/gaffer-rest/Dockerfile b/docker/gaffer-rest/Dockerfile index ab66de1b..27fe7735 100644 --- a/docker/gaffer-rest/Dockerfile +++ b/docker/gaffer-rest/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -21,7 +21,7 @@ ARG BASE_IMAGE_TAG=8-jre-alpine FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder ARG ACCUMULO_VERSION=2.0.1 -ARG GAFFER_VERSION=2.0.0 +ARG GAFFER_VERSION=2.1.0 ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 diff --git a/docker/gaffer-road-traffic-loader/.env b/docker/gaffer-road-traffic-loader/.env index dc4cb998..fcb7759e 100644 --- a/docker/gaffer-road-traffic-loader/.env +++ b/docker/gaffer-road-traffic-loader/.env @@ -1,5 +1,5 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 ACCUMULO_CONF_DIR=/etc/accumulo/conf diff --git a/docker/gaffer-road-traffic-loader/Dockerfile b/docker/gaffer-road-traffic-loader/Dockerfile index 454c7552..e2220ef9 100644 --- a/docker/gaffer-road-traffic-loader/Dockerfile +++ b/docker/gaffer-road-traffic-loader/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -20,7 +20,7 @@ ARG BASE_IMAGE_TAG=8u322-jre-slim-bullseye FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder -ARG GAFFER_VERSION=2.0.0 +ARG GAFFER_VERSION=2.1.0 ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 diff --git a/docker/gaffer-road-traffic-loader/config/schema/types.json b/docker/gaffer-road-traffic-loader/config/schema/types.json index ecb051c7..a0deb5bc 100644 --- a/docker/gaffer-road-traffic-loader/config/schema/types.json +++ b/docker/gaffer-road-traffic-loader/config/schema/types.json @@ -100,12 +100,12 @@ } }, "hllp": { - "class": "com.clearspring.analytics.stream.cardinality.HyperLogLogPlus", + "class": "org.apache.datasketches.hll.HllSketch", "aggregateFunction": { - "class": "uk.gov.gchq.gaffer.sketches.clearspring.cardinality.binaryoperator.HyperLogLogPlusAggregator" + "class": "uk.gov.gchq.gaffer.sketches.datasketches.cardinality.binaryoperator.HllSketchAggregator" }, "serialiser": { - "class": "uk.gov.gchq.gaffer.sketches.clearspring.cardinality.serialisation.HyperLogLogPlusSerialiser" + "class": "uk.gov.gchq.gaffer.sketches.datasketches.cardinality.serialisation.HllSketchSerialiser" } }, "counts.freqmap": { diff --git a/docker/gaffer/.env b/docker/gaffer/.env index dc4cb998..fcb7759e 100644 --- a/docker/gaffer/.env +++ b/docker/gaffer/.env @@ -1,5 +1,5 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 ACCUMULO_CONF_DIR=/etc/accumulo/conf diff --git a/docker/gaffer/Dockerfile b/docker/gaffer/Dockerfile index fe17e0ea..ffbb9fd5 100644 --- a/docker/gaffer/Dockerfile +++ b/docker/gaffer/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -21,7 +21,7 @@ ARG BASE_IMAGE_TAG=2.0.1 FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder ARG BASE_IMAGE_TAG -ARG GAFFER_VERSION=2.0.0 +ARG GAFFER_VERSION=2.1.0 ARG GAFFER_LIBS=bitmap-library,sketches-library,time-library ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git @@ -60,5 +60,9 @@ RUN allFilesDownloaded="TRUE" && \ done \ fi +# Hotfix for Gaffer 2.1.0, see Gaffer issue #3159 +RUN wget -nv "${GAFFER_DOWNLOAD_URL}/org/apache/datasketches/datasketches-memory/2.2.0/datasketches-memory-2.2.0.jar" +RUN wget -nv "${GAFFER_DOWNLOAD_URL}/org/apache/datasketches/datasketches-java/4.0.0/datasketches-java-4.0.0.jar" + FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} COPY --from=builder --chown=root:root /jars/*.jar /opt/accumulo/lib/ext/ diff --git a/docker/gremlin-gaffer/.env b/docker/gremlin-gaffer/.env index b9a28848..e273dcd5 100644 --- a/docker/gremlin-gaffer/.env +++ b/docker/gremlin-gaffer/.env @@ -1,5 +1,5 @@ ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.0.0 +GAFFER_VERSION=2.1.0 GREMLIN_VERSION=3.6.4 ACCUMULO_VERSION=2.0.1 HADOOP_VERSION=3.3.3 diff --git a/docker/gremlin-gaffer/Dockerfile b/docker/gremlin-gaffer/Dockerfile index ffb80399..d654c610 100644 --- a/docker/gremlin-gaffer/Dockerfile +++ b/docker/gremlin-gaffer/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2023 Crown Copyright +# 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. @@ -21,7 +21,7 @@ ARG BASE_IMAGE_TAG=3.6.4 FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder ARG BASE_IMAGE_TAG -ARG GAFFER_VERSION=2.0.0 +ARG GAFFER_VERSION=2.1.0 ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git diff --git a/kubernetes/accumulo/Chart.yaml b/kubernetes/accumulo/Chart.yaml index c961ae08..51372a23 100644 --- a/kubernetes/accumulo/Chart.yaml +++ b/kubernetes/accumulo/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -15,7 +15,7 @@ apiVersion: v2 name: accumulo description: A Key-Value Accumulo store type: application -version: 2.0.0 # managed version +version: 2.1.0 # managed version appVersion: 2.0.1 home: https://github.com/gchq/Gaffer sources: @@ -26,6 +26,6 @@ dependencies: repository: https://charts.helm.sh/incubator/ condition: zookeeper.enabled - name: hdfs - version: ^2.0.0 # managed version + version: ^2.1.0 # managed version repository: file://../hdfs/ condition: hdfs.enabled diff --git a/kubernetes/gaffer-jhub/Chart.yaml b/kubernetes/gaffer-jhub/Chart.yaml index e2737f8b..0946d215 100644 --- a/kubernetes/gaffer-jhub/Chart.yaml +++ b/kubernetes/gaffer-jhub/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -15,7 +15,7 @@ apiVersion: v2 name: gaffer-jhub description: A Jupyter Hub instance, with Gaffer integrations type: application -version: 2.0.0 # managed version +version: 2.1.0 # managed version home: https://github.com/gchq/Gaffer sources: - https://github.com/gchq/gaffer-docker diff --git a/kubernetes/gaffer-jhub/values.yaml b/kubernetes/gaffer-jhub/values.yaml index b6c8b35f..2c441a3f 100644 --- a/kubernetes/gaffer-jhub/values.yaml +++ b/kubernetes/gaffer-jhub/values.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -65,7 +65,7 @@ jupyterhub: kubespawner_override: image: jupyter/minimal-notebook:399cbb986c6b - display_name: "Gaffer pySpark Notebook" - description: "Python 3, Hadoop 3.3.3, Spark 3.1.2, AWS CLI 2, kubectl 1.23.0, gafferpy 2.0.0" # managed + description: "Python 3, Hadoop 3.3.3, Spark 3.1.2, AWS CLI 2, kubectl 1.23.0, gafferpy 2.1.0" # managed slug: "gaffer-pyspark" default: true enable_hdfs: true @@ -74,7 +74,7 @@ jupyterhub: spark_image: gchq/spark-py:3.1.2 # managed spark_ingress_host: "{{USERNAME}}-{{SERVERNAME}}.spark.example.com" kubespawner_override: - image: gchq/gaffer-pyspark-notebook:2.0.0 # managed + image: gchq/gaffer-pyspark-notebook:2.1.0 # managed optionsServer: replicaCount: 1 image: @@ -141,4 +141,4 @@ optionsServer: testImages: python: repository: gchq/gaffer-pyspark-notebook - tag: 2.0.0 # managed version + tag: 2.1.0 # managed version diff --git a/kubernetes/gaffer-road-traffic/Chart.yaml b/kubernetes/gaffer-road-traffic/Chart.yaml index cb2cb126..6f56a838 100644 --- a/kubernetes/gaffer-road-traffic/Chart.yaml +++ b/kubernetes/gaffer-road-traffic/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -15,13 +15,13 @@ apiVersion: v2 name: gaffer-road-traffic description: A Gaffer instance containing sample GB road traffic data from the Department of Transport type: application -version: 2.0.0 # managed version -appVersion: 2.0.0 # managed version +version: 2.1.0 # managed version +appVersion: 2.1.0 # managed version home: https://github.com/gchq/Gaffer sources: - https://github.com/gchq/gaffer-docker - https://data.gov.uk/dataset/208c0e7b-353f-4e2d-8b7a-1a7118467acc/gb-road-traffic-counts dependencies: - name: gaffer - version: ^2.0.0 # managed version + version: ^2.1.0 # managed version repository: file://../gaffer/ diff --git a/kubernetes/gaffer-road-traffic/values.yaml b/kubernetes/gaffer-road-traffic/values.yaml index a89f66cb..38978710 100644 --- a/kubernetes/gaffer-road-traffic/values.yaml +++ b/kubernetes/gaffer-road-traffic/values.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -17,7 +17,7 @@ labels: {} loader: image: repository: gchq/gaffer-road-traffic-loader - tag: 2.0.0 # managed version + tag: 2.1.0 # managed version pullPolicy: IfNotPresent pullSecrets: [] resources: {} @@ -206,12 +206,12 @@ gaffer: } }, "hllp": { - "class": "com.clearspring.analytics.stream.cardinality.HyperLogLogPlus", + "class": "org.apache.datasketches.hll.HllSketch", "aggregateFunction": { - "class": "uk.gov.gchq.gaffer.sketches.clearspring.cardinality.binaryoperator.HyperLogLogPlusAggregator" + "class": "uk.gov.gchq.gaffer.sketches.datasketches.cardinality.binaryoperator.HllSketchAggregator" }, "serialiser": { - "class": "uk.gov.gchq.gaffer.sketches.clearspring.cardinality.serialisation.HyperLogLogPlusSerialiser" + "class": "uk.gov.gchq.gaffer.sketches.datasketches.cardinality.serialisation.HllSketchSerialiser" } }, "counts.freqmap": { diff --git a/kubernetes/gaffer/Chart.yaml b/kubernetes/gaffer/Chart.yaml index 01018758..03fcc118 100644 --- a/kubernetes/gaffer/Chart.yaml +++ b/kubernetes/gaffer/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -15,13 +15,13 @@ apiVersion: v2 name: gaffer description: A large-scale entity and relation database supporting aggregation of properties type: application -version: 2.0.0 # managed version -appVersion: 2.0.0 +version: 2.1.0 # managed version +appVersion: 2.1.0 home: https://github.com/gchq/Gaffer sources: - https://github.com/gchq/gaffer-docker dependencies: - name: accumulo - version: ^2.0.0 # managed version + version: ^2.1.0 # managed version repository: file://../accumulo/ condition: accumulo.enabled diff --git a/kubernetes/gaffer/templates/graph-status-check-hook.yaml b/kubernetes/gaffer/templates/graph-status-check-hook.yaml index e3ee3ad9..d0b70e13 100644 --- a/kubernetes/gaffer/templates/graph-status-check-hook.yaml +++ b/kubernetes/gaffer/templates/graph-status-check-hook.yaml @@ -1,6 +1,6 @@ {{- /* -Copyright 2020 Crown Copyright +Copyright 2020-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. @@ -31,6 +31,6 @@ spec: containers: - name: curl image: {{ .Values.test.images.curl.repository }}:{{ .Values.test.images.curl.tag}} - command: ["/bin/sh", "-c", "statusCode=-1 && until [ \"${statusCode}\" = \"200\" ] || [ $(( ATTEMPTS++ )) -gt 300 ]; do sleep 1; statusCode=$(curl -f -s -o /dev/null -w \"%{http_code}\" http://{{ include "gaffer.fullname" . }}-api:80/{{ pluck "server.context-path" .Values.graph.applicationProperties | first }}/graph/status); echo \"$(date) - http://{{ include "gaffer.fullname" . }}-api:80{{ pluck "server.context-path" .Values.graph.applicationProperties | first }}/graph/status : ${statusCode}\"; done; [ \"${statusCode}\" != \"200\" ] && exit 1; exit 0"] + command: ["/bin/sh", "-c", "statusCode=-1 && until [ \"${statusCode}\" = \"200\" ] || [ $(( ATTEMPTS++ )) -gt 300 ]; do sleep 1; statusCode=$(curl -f -s -o /dev/null -w \"%{http_code}\" http://{{ include "gaffer.fullname" . }}-api:80{{ pluck "server.context-path" .Values.graph.applicationProperties | first }}/graph/status); echo \"$(date) - http://{{ include "gaffer.fullname" . }}-api:80{{ pluck "server.context-path" .Values.graph.applicationProperties | first }}/graph/status : ${statusCode}\"; done; [ \"${statusCode}\" != \"200\" ] && exit 1; exit 0"] restartPolicy: Never {{- end }} diff --git a/kubernetes/gaffer/values.yaml b/kubernetes/gaffer/values.yaml index 6f9fafea..f5ee5e43 100644 --- a/kubernetes/gaffer/values.yaml +++ b/kubernetes/gaffer/values.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -31,7 +31,7 @@ api: replicaCount: 1 image: repository: gchq/gaffer-rest - tag: 2.0.0-accumulo-2.0.1 # managed version + tag: 2.1.0-accumulo-2.0.1 # managed version pullPolicy: IfNotPresent pullSecrets: [] resources: {} @@ -61,7 +61,7 @@ accumulo: enabled: false image: repository: gchq/gaffer - tag: 2.0.0-accumulo-2.0.1 # managed version + tag: 2.1.0-accumulo-2.0.1 # managed version config: postInstallCommands: - users diff --git a/kubernetes/hdfs/Chart.yaml b/kubernetes/hdfs/Chart.yaml index bccd15d1..6f57041a 100644 --- a/kubernetes/hdfs/Chart.yaml +++ b/kubernetes/hdfs/Chart.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -15,5 +15,5 @@ apiVersion: v2 name: hdfs description: Deploys the Hadoop Distributed File System (HDFS) type: application -version: 2.0.0 # managed version +version: 2.1.0 # managed version appVersion: 3.3.3 # managed version From c20dee1fd2ae9233fc2a9b043f802043f8e557df Mon Sep 17 00:00:00 2001 From: tb06904 <141412860+tb06904@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:41:27 +0000 Subject: [PATCH 8/9] Gh-334: Smoother gaffer gremlin deployment (#337) * 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> --- .github/workflows/continuous-integration.yaml | 4 +- .gitignore | 3 +- cd/build_images.sh | 25 +++++---- cd/deploy_to_kind.sh | 10 +++- cd/publish_images.sh | 3 +- cd/update_versions.sh | 6 +- docker/accumulo2.env | 2 + docker/gaffer-gremlin/Dockerfile | 28 ++++++++++ docker/gaffer-gremlin/README.md | 56 +++++++++++++++++++ docker/gaffer-gremlin/build.sh | 38 +++++++++++++ docker/gaffer-gremlin/compose.yaml | 25 +++++++++ .../conf/gaffer-gremlin-server.yaml} | 16 ++++-- .../conf/gaffer/store.properties | 20 +++++++ .../conf/gafferpop/gafferpop.properties} | 6 +- .../example/compose.yaml} | 52 ++++------------- .../example/conf}/gaffer/schema/elements.json | 0 .../example/conf}/gaffer/schema/types.json | 0 .../conf/gaffer/store-accumulo.properties} | 4 +- .../conf/gafferpop/gafferpop.properties | 20 +++++++ .../gremlin-gaffer-modern-example.ipynb | 29 +++++++--- docker/gaffer-gremlin/pom.xml | 46 +++++++++++++++ docker/gremlin-gaffer/.env | 7 --- docker/gremlin-gaffer/Dockerfile | 51 ----------------- docker/gremlin-gaffer/README.md | 39 ------------- docker/gremlin-gaffer/conf/graphConfig.json | 3 - docker/gremlin-gaffer/files/.gitignore | 2 - 26 files changed, 314 insertions(+), 181 deletions(-) create mode 100644 docker/gaffer-gremlin/Dockerfile create mode 100644 docker/gaffer-gremlin/README.md create mode 100755 docker/gaffer-gremlin/build.sh create mode 100644 docker/gaffer-gremlin/compose.yaml rename docker/{gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml => gaffer-gremlin/conf/gaffer-gremlin-server.yaml} (74%) create mode 100644 docker/gaffer-gremlin/conf/gaffer/store.properties rename docker/{gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties => gaffer-gremlin/conf/gafferpop/gafferpop.properties} (81%) rename docker/{gremlin-gaffer/docker-compose.yaml => gaffer-gremlin/example/compose.yaml} (77%) rename docker/{gremlin-gaffer/conf/gafferpop => gaffer-gremlin/example/conf}/gaffer/schema/elements.json (100%) rename docker/{gremlin-gaffer/conf/gafferpop => gaffer-gremlin/example/conf}/gaffer/schema/types.json (100%) rename docker/{gremlin-gaffer/conf/gafferpop/gaffer/store.properties => gaffer-gremlin/example/conf/gaffer/store-accumulo.properties} (92%) create mode 100644 docker/gaffer-gremlin/example/conf/gafferpop/gafferpop.properties rename docker/{gremlin-gaffer => gaffer-gremlin/example}/gremlin-gaffer-modern-example.ipynb (86%) create mode 100644 docker/gaffer-gremlin/pom.xml delete mode 100644 docker/gremlin-gaffer/.env delete mode 100644 docker/gremlin-gaffer/Dockerfile delete mode 100644 docker/gremlin-gaffer/README.md delete mode 100644 docker/gremlin-gaffer/conf/graphConfig.json delete mode 100644 docker/gremlin-gaffer/files/.gitignore diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index fc97fbc4..d59a82b1 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -58,8 +58,8 @@ jobs: run: ./cd/lint_charts.sh - name: Deploy to Kubernetes - run: ./cd/deploy_to_kind.sh - + run: ./cd/deploy_to_kind.sh ./docker/accumulo2.env + - name: Run gaffer-road-traffic Tests run: helm test gaffer || (kubectl get po && kubectl describe po && kubectl logs -l app.kubernetes.io/component=test --tail=-1 && df -h && false) diff --git a/.gitignore b/.gitignore index 597bd3b1..f795c987 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -21,3 +21,4 @@ **/.DS_Store kubernetes/*/Chart.lock kubernetes/*/charts/ +target/ diff --git a/cd/build_images.sh b/cd/build_images.sh index 9a8b4a08..f69b9ab5 100755 --- a/cd/build_images.sh +++ b/cd/build_images.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -18,22 +18,23 @@ # Required for variables from sourced env file to automatically be visible to docker compose. set -e -a -root_directory="$( cd $(dirname $(dirname $0)) > /dev/null 2>&1 && pwd )" -cd $root_directory +ROOT_DIR="$(readlink -f "$(dirname "$(dirname "${0}")")")" -if [ ! -z "$1" ]; then - ENV_FILE=$1 -else - echo "Error - Environment file not set"; exit 1; -fi +pushd "${ROOT_DIR}" || exit 1 -# The following command sets: +# The following env file will be sourced to set: # HADOOP_VERSION # GAFFER_VERSION # GAFFERPY_VERSION # ACCUMULO_VERSION # SPARK_VERSION -source "${ENV_FILE}" +# TINKERPOP_VERSION +if [[ -f "${1}" ]]; then + source "${1}" +else + echo "Error - Environment file not set" + exit 1 +fi # Builds all of the Gaffer and Accumulo related images: docker compose --project-directory ./docker/accumulo/ -f ./docker/accumulo/docker-compose.yaml build @@ -41,8 +42,12 @@ docker compose --project-directory ./docker/gaffer-road-traffic-loader/ -f ./doc # Builds all of the notebook related images: docker compose --project-directory ./docker/gaffer-pyspark-notebook/ -f ./docker/gaffer-pyspark-notebook/docker-compose.yaml build notebook docker compose --project-directory ./docker/spark-py/ -f ./docker/spark-py/docker-compose.yaml build +# Builds the Gaffer Gremlin server +./docker/gaffer-gremlin/build.sh # Set $JHUB_OPTIONS_SERVER_VERSION source ./docker/gaffer-jhub-options-server/get-version.sh # Builds the jhub options server: docker compose --project-directory ./docker/gaffer-jhub-options-server/ -f ./docker/gaffer-jhub-options-server/docker-compose.yaml build + +popd || exit 1 diff --git a/cd/deploy_to_kind.sh b/cd/deploy_to_kind.sh index 68c7cfa8..12846083 100755 --- a/cd/deploy_to_kind.sh +++ b/cd/deploy_to_kind.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -22,7 +22,13 @@ kind create cluster --quiet --config ./cd/kind.yaml --image kindest/node:v1.24.4 # HADOOP_VERSION # GAFFER_VERSION # SPARK_VERSION -source ./docker/gaffer-pyspark-notebook/.env +# KUBECTL_VERSION +if [[ -f "${1}" ]]; then + source "${1}" +else + echo "Error - Environment file not set" + exit 1 +fi # JHUB_OPTIONS_SERVER_VERSION source ./docker/gaffer-jhub-options-server/get-version.sh diff --git a/cd/publish_images.sh b/cd/publish_images.sh index 86c26061..90adcff5 100755 --- a/cd/publish_images.sh +++ b/cd/publish_images.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -101,6 +101,7 @@ pushContainer gchq/accumulo "${ACCUMULO_VERSION}" pushContainer gchq/gaffer "${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION}" pushContainer gchq/gaffer-rest "${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION}" pushContainer gchq/gaffer-road-traffic-loader "${GAFFER_VERSION}" +pushContainer gchq/gaffer-gremlin "${GAFFER_VERSION}" pushContainer gchq/gaffer-pyspark-notebook "${GAFFER_VERSION}" pushContainer gchq/gaffer-jhub-options-server "${JHUB_OPTIONS_SERVER_VERSION}" pushContainer gchq/spark-py "${SPARK_VERSION}" diff --git a/cd/update_versions.sh b/cd/update_versions.sh index 2479bd1c..d96f1c81 100755 --- a/cd/update_versions.sh +++ b/cd/update_versions.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2020-2023 Crown Copyright +# Copyright 2020-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. @@ -23,9 +23,9 @@ fi # GAFFER_VERSION # GAFFERPY_VERSION # SPARK_VERSION -source ./docker/gaffer-pyspark-notebook/.env +source ./docker/accumulo2.env # JHUB_OPTIONS_SERVER_VERSION -source docker/gaffer-jhub-options-server/get-version.sh +source ./docker/gaffer-jhub-options-server/get-version.sh # hdfs [ ! -z "${APP_VERSION}" ] && yq eval ".version = \"${APP_VERSION}\"" -i ./kubernetes/hdfs/Chart.yaml diff --git a/docker/accumulo2.env b/docker/accumulo2.env index e415ae8f..585fa420 100644 --- a/docker/accumulo2.env +++ b/docker/accumulo2.env @@ -7,3 +7,5 @@ GAFFER_VERSION=2.1.0 GAFFER_TESTER_VERSION=2.1.0 GAFFERPY_VERSION=2.1.0 SPARK_VERSION=3.1.2 +TINKERPOP_VERSION=3.7.1 +KUBECTL_VERSION=1.23.0 diff --git a/docker/gaffer-gremlin/Dockerfile b/docker/gaffer-gremlin/Dockerfile new file mode 100644 index 00000000..5fa93c14 --- /dev/null +++ b/docker/gaffer-gremlin/Dockerfile @@ -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"] diff --git a/docker/gaffer-gremlin/README.md b/docker/gaffer-gremlin/README.md new file mode 100644 index 00000000..0dfd36a0 --- /dev/null +++ b/docker/gaffer-gremlin/README.md @@ -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 +``` diff --git a/docker/gaffer-gremlin/build.sh b/docker/gaffer-gremlin/build.sh new file mode 100755 index 00000000..a35b6872 --- /dev/null +++ b/docker/gaffer-gremlin/build.sh @@ -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" diff --git a/docker/gaffer-gremlin/compose.yaml b/docker/gaffer-gremlin/compose.yaml new file mode 100644 index 00000000..ad8370f6 --- /dev/null +++ b/docker/gaffer-gremlin/compose.yaml @@ -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 diff --git a/docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml b/docker/gaffer-gremlin/conf/gaffer-gremlin-server.yaml similarity index 74% rename from docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml rename to docker/gaffer-gremlin/conf/gaffer-gremlin-server.yaml index 0fae7ec1..acebb348 100644 --- a/docker/gremlin-gaffer/conf/gremlin-server-empty-gaffer.yaml +++ b/docker/gaffer-gremlin/conf/gaffer-gremlin-server.yaml @@ -1,4 +1,4 @@ -# Copyright 2023 Crown Copyright +# 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. @@ -16,21 +16,27 @@ host: localhost port: 8182 evaluationTimeout: 30000 graphs: { - graph: conf/gafferpop/gafferpop-tinkerpop-modern.properties} + graph: conf/gafferpop/gafferpop.properties +} scriptEngines: { gremlin-groovy: { plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, uk.gov.gchq.gaffer.tinkerpop.gremlinplugin.GafferPopGremlinPlugin: {}, org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {enableThreadInterrupt: true}, org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}} + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]} + } } } serializers: - - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} # application/vnd.graphbinary-v1.0-stringd + # application/vnd.graphbinary-v1.0 + - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1 } + # application/vnd.graphbinary-v1.0-stringd + - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} metrics: { - slf4jReporter: {enabled: true, interval: 180000}} + slf4jReporter: {enabled: true, interval: 180000} +} strictTransactionManagement: false idleConnectionTimeout: 0 keepAliveInterval: 0 diff --git a/docker/gaffer-gremlin/conf/gaffer/store.properties b/docker/gaffer-gremlin/conf/gaffer/store.properties new file mode 100644 index 00000000..6dad3cd4 --- /dev/null +++ b/docker/gaffer-gremlin/conf/gaffer/store.properties @@ -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 diff --git a/docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties b/docker/gaffer-gremlin/conf/gafferpop/gafferpop.properties similarity index 81% rename from docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties rename to docker/gaffer-gremlin/conf/gafferpop/gafferpop.properties index 2bb1fbfb..e4e662b0 100644 --- a/docker/gremlin-gaffer/conf/gafferpop/gafferpop-tinkerpop-modern.properties +++ b/docker/gaffer-gremlin/conf/gafferpop/gafferpop.properties @@ -1,5 +1,5 @@ # -# Copyright 2016-2023 Crown Copyright +# 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. @@ -15,6 +15,6 @@ # gremlin.graph=uk.gov.gchq.gaffer.tinkerpop.GafferPopGraph gaffer.graphId=graph1 -gaffer.storeproperties=conf/gafferpop/gaffer/store.properties -gaffer.schemas=conf/gafferpop/gaffer/schema/ +gaffer.storeproperties=conf/gaffer/store.properties +gaffer.schemas=conf/gaffer/schema/ gaffer.userId=user01 diff --git a/docker/gremlin-gaffer/docker-compose.yaml b/docker/gaffer-gremlin/example/compose.yaml similarity index 77% rename from docker/gremlin-gaffer/docker-compose.yaml rename to docker/gaffer-gremlin/example/compose.yaml index 4bb32592..51c34e44 100644 --- a/docker/gremlin-gaffer/docker-compose.yaml +++ b/docker/gaffer-gremlin/example/compose.yaml @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Crown Copyright +# 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. @@ -42,10 +42,6 @@ services: interval: 30s timeout: 10s retries: 3 - build: - context: ../hdfs/ - args: - HADOOP_VERSION: ${HADOOP_VERSION} command: namenode container_name: hdfs-namenode hostname: hdfs-namenode @@ -54,7 +50,7 @@ services: ports: - 9870:9870 volumes: - - ../hdfs/conf:${HADOOP_CONF_DIR}:ro + - ../../hdfs/conf:${HADOOP_CONF_DIR}:ro - /var/log/hadoop - /data1 - /data2 @@ -70,7 +66,7 @@ services: environment: - HADOOP_CONF_DIR=${HADOOP_CONF_DIR} volumes: - - ../hdfs/conf:${HADOOP_CONF_DIR}:ro + - ../../hdfs/conf:${HADOOP_CONF_DIR}:ro - /var/log/hadoop - /data1 - /data2 @@ -86,12 +82,6 @@ services: timeout: 5s retries: 3 start_period: 10s - build: - context: . - args: - GAFFER_VERSION: ${GAFFER_VERSION} - BASE_IMAGE_NAME: gchq/accumulo - BASE_IMAGE_TAG: ${ACCUMULO_VERSION} command: master container_name: accumulo-master hostname: accumulo-master @@ -103,7 +93,7 @@ services: # accumulo to "auth" with HDFS as the super user so that it can: - HADOOP_USER_NAME=hadoop volumes: - - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro - /var/log/accumulo accumulo-tserver: @@ -127,7 +117,7 @@ services: # accumulo to "auth" with HDFS as the super user so that it can: - HADOOP_USER_NAME=hadoop volumes: - - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro - /var/log/accumulo accumulo-monitor: @@ -148,7 +138,7 @@ services: ports: - 9995:9995 volumes: - - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro - /var/log/accumulo accumulo-gc: @@ -167,37 +157,17 @@ services: # accumulo to "auth" with HDFS as the super user so that it can: - HADOOP_USER_NAME=hadoop volumes: - - ../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro + - ../../accumulo/conf-${ACCUMULO_VERSION}:${ACCUMULO_CONF_DIR}:ro - /var/log/accumulo - gaffer-rest: - image: gchq/gaffer-rest:${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION} + gaffer-gremlin: + image: gchq/gaffer-gremlin:${GAFFER_VERSION}-gremlin-${TINKERPOP_VERSION} depends_on: accumulo-tserver: condition: service_healthy - build: - context: ../gaffer-rest/ - args: - GAFFER_VERSION: ${GAFFER_VERSION} - ACCUMULO_VERSION: ${ACCUMULO_VERSION} - ports: - - 8080:8080 - volumes: - - ./conf/graphConfig.json:/gaffer/graph/graphConfig.json:ro - - ./conf/gafferpop/gaffer/store.properties:/gaffer/store/store.properties:ro - - ./conf/gafferpop/gaffer/schema:/gaffer/schema:ro - - gremlin-gaffer: - image: gchq/gremlin-gaffer:${GREMLIN_VERSION}-gaffer-${GAFFER_VERSION} - depends_on: - accumulo-tserver: - condition: service_healthy - build: - context: . - args: - GAFFER_VERSION: ${GAFFER_VERSION} - GREMLIN_VERSION: ${GREMLIN_VERSION} ports: - 8182:8182 volumes: - ./conf/gafferpop:/opt/gremlin-server/conf/gafferpop:ro + - ./conf/gaffer/store-accumulo.properties:/opt/gremlin-server/conf/gaffer/store.properties:ro + - ./conf/gaffer/schema:/opt/gremlin-server/conf/gaffer/schema:ro diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json b/docker/gaffer-gremlin/example/conf/gaffer/schema/elements.json similarity index 100% rename from docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/elements.json rename to docker/gaffer-gremlin/example/conf/gaffer/schema/elements.json diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json b/docker/gaffer-gremlin/example/conf/gaffer/schema/types.json similarity index 100% rename from docker/gremlin-gaffer/conf/gafferpop/gaffer/schema/types.json rename to docker/gaffer-gremlin/example/conf/gaffer/schema/types.json diff --git a/docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties b/docker/gaffer-gremlin/example/conf/gaffer/store-accumulo.properties similarity index 92% rename from docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties rename to docker/gaffer-gremlin/example/conf/gaffer/store-accumulo.properties index efb5b466..212615d9 100644 --- a/docker/gremlin-gaffer/conf/gafferpop/gaffer/store.properties +++ b/docker/gaffer-gremlin/example/conf/gaffer/store-accumulo.properties @@ -1,5 +1,5 @@ # -# Copyright 2016-2023 Crown Copyright +# 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. @@ -21,4 +21,4 @@ accumulo.user=root accumulo.password=secret # General store config gaffer.cache.service.class=uk.gov.gchq.gaffer.cache.impl.HashMapCacheService -gaffer.store.job.tracker.enabled=true +gaffer.store.job.tracker.enabled=true \ No newline at end of file diff --git a/docker/gaffer-gremlin/example/conf/gafferpop/gafferpop.properties b/docker/gaffer-gremlin/example/conf/gafferpop/gafferpop.properties new file mode 100644 index 00000000..e4e662b0 --- /dev/null +++ b/docker/gaffer-gremlin/example/conf/gafferpop/gafferpop.properties @@ -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. +# +gremlin.graph=uk.gov.gchq.gaffer.tinkerpop.GafferPopGraph +gaffer.graphId=graph1 +gaffer.storeproperties=conf/gaffer/store.properties +gaffer.schemas=conf/gaffer/schema/ +gaffer.userId=user01 diff --git a/docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb b/docker/gaffer-gremlin/example/gremlin-gaffer-modern-example.ipynb similarity index 86% rename from docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb rename to docker/gaffer-gremlin/example/gremlin-gaffer-modern-example.ipynb index d0a6bb79..00d5643c 100644 --- a/docker/gremlin-gaffer/gremlin-gaffer-modern-example.ipynb +++ b/docker/gaffer-gremlin/example/gremlin-gaffer-modern-example.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -30,9 +30,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Create gremlin client to run gremlin scripts directly\n", "client = Client('ws://localhost:8182/gremlin', 'g')\n", @@ -42,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -52,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -70,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -79,7 +90,7 @@ "[0.5]" ] }, - "execution_count": 15, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -91,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -100,7 +111,7 @@ "[path[v[1], v[3]], path[v[1], v[4], v[3]]]" ] }, - "execution_count": 16, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } diff --git a/docker/gaffer-gremlin/pom.xml b/docker/gaffer-gremlin/pom.xml new file mode 100644 index 00000000..65f525f3 --- /dev/null +++ b/docker/gaffer-gremlin/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + + uk.gov.gchq.gaffer.docker + gaffer-gremlin + 0.0.1-SNAPSHOT + pom + + + + 2.1.0 + 2.36 + + + + + + uk.gov.gchq.gaffer + tinkerpop + ${gaffer.version} + + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + + + diff --git a/docker/gremlin-gaffer/.env b/docker/gremlin-gaffer/.env deleted file mode 100644 index e273dcd5..00000000 --- a/docker/gremlin-gaffer/.env +++ /dev/null @@ -1,7 +0,0 @@ -ZOOKEEPER_VERSION=3.7.1 -GAFFER_VERSION=2.1.0 -GREMLIN_VERSION=3.6.4 -ACCUMULO_VERSION=2.0.1 -HADOOP_VERSION=3.3.3 -ACCUMULO_CONF_DIR=/etc/accumulo/conf -HADOOP_CONF_DIR=/etc/hadoop/conf diff --git a/docker/gremlin-gaffer/Dockerfile b/docker/gremlin-gaffer/Dockerfile deleted file mode 100644 index d654c610..00000000 --- a/docker/gremlin-gaffer/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# 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 BUILDER_IMAGE_NAME=maven -ARG BUILDER_IMAGE_TAG=3.8.4-jdk-8 - -ARG BASE_IMAGE_NAME=tinkerpop/gremlin-server -ARG BASE_IMAGE_TAG=3.6.4 - -FROM ${BUILDER_IMAGE_NAME}:${BUILDER_IMAGE_TAG} as builder - -ARG BASE_IMAGE_TAG -ARG GAFFER_VERSION=2.1.0 -ARG GAFFER_DOWNLOAD_URL=https://repo1.maven.org/maven2 -ARG GAFFER_GIT_REPO=https://github.com/gchq/Gaffer.git - -WORKDIR /jars - -# Allow users to provide their own JAR files -COPY ./files/ . -# Try to download required version from Maven Central, otherwise build from source -RUN allFilesDownloaded="TRUE" && \ - if [ ! -f "./tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" ] && [ "${allFilesDownloaded}" = "TRUE" ]; then \ - wget -nv "${GAFFER_DOWNLOAD_URL}/uk/gov/gchq/gaffer/tinkerpop/${GAFFER_VERSION}/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" || allFilesDownloaded="FALSE"; \ - fi && \ - if [ "${allFilesDownloaded}" = "FALSE" ]; then \ - git clone ${GAFFER_GIT_REPO} /tmp/gaffer && \ - cd /tmp/gaffer && \ - git checkout ${GAFFER_VERSION} || git checkout gaffer2-${GAFFER_VERSION} && \ - mvn clean package -Pquick -pl :tinkerpop && \ - if [ ! -f "/jars/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar" ]; then \ - cp ./library/tinkerpop/target/tinkerpop-${GAFFER_VERSION}-jar-with-dependencies.jar /jars; \ - fi \ - fi - -FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} -COPY --from=builder --chown=root:root /jars/*.jar ext/gafferpop/plugin/ -COPY ./conf/gafferpop/ conf/gafferpop/ -COPY ./conf/gremlin-server-empty-gaffer.yaml conf/gremlin-server-empty-gaffer.yaml -CMD ["conf/gremlin-server-empty-gaffer.yaml"] diff --git a/docker/gremlin-gaffer/README.md b/docker/gremlin-gaffer/README.md deleted file mode 100644 index 018e76d6..00000000 --- a/docker/gremlin-gaffer/README.md +++ /dev/null @@ -1,39 +0,0 @@ -Gremlin Gaffer Plugin -====== -In this folder you can find the required files for building and running a gremlin-server with the Gaffer plugin loaded. - -The Docker image uses TinkerPop's gremlin-server with GafferPop config and plugin jars added in. -When run with docker compose it will provide you a full accumulo ecosystem complete with [hdfs](../hdfs) and the [Gaffer REST API](../gaffer-rest). - -# Running Locally -The easiest way to build and run these services is to use docker compose, by running the following from this directory: -```bash -docker compose up -``` - -## Example Notebook -See `gremlin-gaffer-modern-example.ipynb` for an example using the "TinkerPop Modern" demo graph. - -## Customising the build -Custom Gaffer TinkerPop plugin jars can be added in the files directory. The Gaffer schema, store properties and gafferpop properties can be found in `conf/gafferpop` and are customised in a docker compose build using volumes. The `gremlin-server-empty-gaffer.yaml` cannot be overwritten in a volume, it must be built into the image. - -## Containers that are started: -* Zookeeper -* HDFS - * Datanode - * Namenode -* Accumulo - * Monitor - * GC - * tserver - * Master -* Gaffer REST -* Gremlin Server with GafferPop - -Access the HDFS NameNode web UI at: http://localhost:9870 - -Access the Accumulo Monitor UI at: http://localhost:9995 - -Access the Gaffer REST API at: http://localhost:8080/rest/ - -Access the Gremlin Server with GafferPop at: http://localhost:8182/ diff --git a/docker/gremlin-gaffer/conf/graphConfig.json b/docker/gremlin-gaffer/conf/graphConfig.json deleted file mode 100644 index 57f97103..00000000 --- a/docker/gremlin-gaffer/conf/graphConfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "graphId": "graph1" -} \ No newline at end of file diff --git a/docker/gremlin-gaffer/files/.gitignore b/docker/gremlin-gaffer/files/.gitignore deleted file mode 100644 index fd807ac5..00000000 --- a/docker/gremlin-gaffer/files/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.tar.gz -*.jar From 53cbf18b5d428d4893ff548733100d8ed27d15e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:11:44 +0000 Subject: [PATCH 9/9] prepare release v2.1.0