Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 87f5d48

Browse files
tb06904cn337131p29876
authored
Gh-381: Migrate and update examples (#382)
* Move examples to common location * clear notebooks * update proxy example * update main readme * remove gaffer-gremlin build * Apply suggestions from code review Co-authored-by: cn337131 <[email protected]> Co-authored-by: p29876 <[email protected]> * address comments --------- Co-authored-by: cn337131 <[email protected]> Co-authored-by: p29876 <[email protected]>
1 parent a7210bb commit 87f5d48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+444
-444
lines changed

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
# Gaffer Docker
22

33
This repo contains the code needed to run Gaffer using Docker or Kubernetes.
4-
There are two main sub-folders, 'docker' and 'kubernetes' which contain the project files you need for starting Gaffer using those services.
4+
There are two main sub-folders, 'docker' and 'kubernetes', which contain the
5+
project files you need for starting Gaffer using those services.
56

6-
# Running Gaffer Using Docker
7+
## Running Gaffer Using Docker
78

8-
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/)
9+
For information on how to run Gaffer using Docker containers please see the
10+
documentation: [Gaffer Docker Docs](https://gchq.github.io/gaffer-doc/latest/administration-guide/gaffer-deployment/gaffer-docker/gaffer-images.html)
911

10-
# Running Gaffer Using Kubernetes
12+
We also provide some example deployments with different store backings
13+
to help you get started learning and testing Gaffer. Please see the
14+
[example deployments](./docker/example-deployments/) directory for more
15+
details.
1116

12-
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/)
17+
## Running Gaffer Using Kubernetes
1318

14-
# Versioning
19+
For information on how to run Gaffer using Kubernetes, please see the
20+
documentation: [Gaffer Kubernetes Docs](https://gchq.github.io/gaffer-doc/latest/administration-guide/gaffer-deployment/kubernetes-guide/running-on-kubernetes.html)
1521

16-
Each of our images which is released will be tagged with the version of the software they represent. Every release,
17-
we update the `latest` tag for each image and add a new release which has the corresponding version tag.
22+
## Versioning
23+
24+
Each of the released images will be tagged with the version of the
25+
software they represent. Every release we update the `latest` tag for each
26+
image and add a new release which has the corresponding version tag.
1827

1928
If we release Gaffer version 2.1.2, the following images would be uploaded:
2029

@@ -24,17 +33,20 @@ If we release Gaffer version 2.1.2, the following images would be uploaded:
2433
- gchq/gaffer:2.1.2
2534
- gchq/gaffer:2.1.2-accumulo-2.0.1
2635

27-
We maintain mutable versions of latest, as well as the major, minor and bugfix versions of Gaffer. For reproducibility
28-
make sure to use the full version in your build metadata. For `gaffer`/`gaffer-rest` images, we also create a tag including the
29-
accumulo version, this allows for compatibility with Accumulo 1.9.3 in our tests. The `-accumulo-1.9.3` tagged images
30-
are not published but can be build locally if required.
36+
We maintain mutable versions of latest, as well as the major, minor and bugfix
37+
versions of Gaffer. For reproducibility make sure to use the full version in
38+
your build metadata. For `gaffer`/`gaffer-rest` images, we also create a tag
39+
including the accumulo version, this allows for compatibility with Accumulo
40+
1.9.3 in our tests. The `-accumulo-1.9.3` tagged images are not published but
41+
can be built locally if required.
3142

3243
The release process is automated by GitHub actions.
3344

34-
# Known Compatible Docker Versions
45+
## Known Compatible Docker Versions
3546

3647
- 20.10.23
3748

38-
# Contributing
49+
## Contributing
3950

40-
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/).
51+
We welcome contributions to this project. Detailed information on our ways of
52+
working can be found in our [developer docs](https://gchq.github.io/gaffer-doc/latest/development-guide/ways-of-working.html).

cd/build_core_images.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pushd "${ROOT_DIR}" || exit 1
2626
# HADOOP_VERSION
2727
# GAFFER_VERSION
2828
# ACCUMULO_VERSION
29-
# TINKERPOP_VERSION
3029
if [[ -f "${1}" ]]; then
3130
source "${1}"
3231
else

cd/build_images.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pushd "${ROOT_DIR}" || exit 1
2828
# GAFFERPY_VERSION
2929
# ACCUMULO_VERSION
3030
# SPARK_VERSION
31-
# TINKERPOP_VERSION
3231
if [[ -f "${1}" ]]; then
3332
source "${1}"
3433
else
@@ -42,8 +41,6 @@ docker compose --project-directory ./docker/gaffer-road-traffic-loader/ -f ./doc
4241
# Builds all of the notebook related images:
4342
docker compose --project-directory ./docker/gaffer-pyspark-notebook/ -f ./docker/gaffer-pyspark-notebook/docker-compose.yaml build notebook
4443
docker compose --project-directory ./docker/spark-py/ -f ./docker/spark-py/docker-compose.yaml build
45-
# Builds the Gaffer Gremlin server
46-
./docker/gaffer-gremlin/build.sh
4744

4845
# Set $JHUB_OPTIONS_SERVER_VERSION
4946
source ./docker/gaffer-jhub-options-server/get-version.sh

cd/publish_images.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pushContainer gchq/accumulo "${ACCUMULO_VERSION}"
102102
pushContainer gchq/gaffer "${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION}"
103103
pushContainer gchq/gaffer-rest "${GAFFER_VERSION}-accumulo-${ACCUMULO_VERSION}"
104104
pushContainer gchq/gaffer-road-traffic-loader "${GAFFER_VERSION}"
105-
pushContainer gchq/gaffer-gremlin "${GAFFER_VERSION}-gremlin-${TINKERPOP_VERSION}"
106105
pushContainer gchq/gaffer-pyspark-notebook "${GAFFER_VERSION}"
107106
pushContainer gchq/gaffer-jhub-options-server "${JHUB_OPTIONS_SERVER_VERSION}"
108107
pushContainer gchq/spark-py "${SPARK_VERSION}"

cd/update_versions.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ source ./docker/gaffer-jhub-options-server/get-version.sh
3131
find . -type f -exec sed -i "s/GAFFER_VERSION=[0-9]\.[0-9]\.[0-9]/GAFFER_VERSION=${APP_VERSION}/g" {} +
3232
find . -type f -exec sed -E -i "s/GAFFERPY_VERSION=(gafferpy-)?[0-9]\.[0-9]\.[0-9]/GAFFERPY_VERSION=\1${APP_VERSION}/g" {} +
3333
find . -type f -exec sed -i "s/GAFFER_TESTER_VERSION=[0-9]\.[0-9]\.[0-9]/GAFFER_TESTER_VERSION=${APP_VERSION}/g" {} +
34-
sed -i'' -e "s/<gaffer.version>[0-9]\.[0-9]\.[0-9]/<gaffer.version>${APP_VERSION}/g" docker/gaffer-gremlin/pom.xml
3534
sed -i'' -e "s/BASE_IMAGE_TAG=[0-9]\.[0-9]\.[0-9]/BASE_IMAGE_TAG=${APP_VERSION}/g" docker/gaffer-kerberos/gaffer-krb/Dockerfile
3635
sed -i'' -e "s/BASE_IMAGE_TAG=[0-9]\.[0-9]\.[0-9]/BASE_IMAGE_TAG=${APP_VERSION}/g" docker/gaffer-kerberos/gaffer-rest-krb/Dockerfile
3736

docker/accumulo1.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ GAFFER_VERSION=2.3.0
77
GAFFER_TESTER_VERSION=2.3.0
88
GAFFERPY_VERSION=2.3.0
99
SPARK_VERSION=3.1.2
10-
TINKERPOP_VERSION=3.7.1
1110
KUBECTL_VERSION=1.23.0

docker/accumulo2.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ GAFFER_VERSION=2.3.0
77
GAFFER_TESTER_VERSION=2.3.0
88
GAFFERPY_VERSION=2.3.0
99
SPARK_VERSION=3.1.2
10-
TINKERPOP_VERSION=3.7.1
1110
KUBECTL_VERSION=1.23.0
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Example Gaffer Deployments
2+
3+
These directories have basic examples of deploying containerised Gaffer with
4+
different store backings. Some example notebooks are also available which
5+
primarily feature the use of the Gremlin interface for interacting with the
6+
Graph.
7+
8+
All examples will provide a Gaffer REST API to start interacting with the
9+
deployed graph.
10+
11+
## Modern Example (Accumulo)
12+
13+
The modern example, which uses the [Tinkerpop modern dataset](https://tinkerpop.apache.org/docs/current/tutorials/the-gremlin-console/#toy-graphs),
14+
can be found under the `modern-example` directory which features an Accumulo
15+
store as its storage backing.
16+
17+
## Federation Example
18+
19+
A demo/example of using Gaffer REST with a Federated Store is available under
20+
the `federated-example` directory.
21+
22+
## Proxy Example
23+
24+
A demo/example of using Gaffer REST with a Proxy Store is available under the
25+
`proxy-example` directory.

docker/gaffer-gremlin/example/notebooks/graphnotebook-modern-example.ipynb renamed to docker/example-deployments/example-notebooks/graphnotebook-modern-example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"%%graph_notebook_config\n",
3939
"{\n",
4040
" \"host\": \"localhost\",\n",
41-
" \"port\": 8182,\n",
41+
" \"port\": 8080,\n",
4242
" \"ssl\": false,\n",
4343
" \"gremlin\": {\n",
4444
" \"traversal_source\": \"g\",\n",

docker/gaffer-gremlin/example/notebooks/gremlinpython-modern-example.ipynb renamed to docker/example-deployments/example-notebooks/gremlinpython-modern-example.ipynb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"# Common imports\n",
2222
"from gremlin_python.process.anonymous_traversal import traversal\n",
2323
"from gremlin_python.process.graph_traversal import __\n",
24-
"from gremlin_python.process.strategies import *\n",
25-
"from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\n",
2624
"from gremlin_python.process.traversal import *\n",
25+
"from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\n",
2726
"from gremlin_python.driver.client import Client\n",
27+
"from gremlin_python.driver.serializer import GraphSONSerializersV3d0\n",
2828
"import nest_asyncio\n",
2929
"\n",
3030
"from_ = Direction.OUT\n",
@@ -45,7 +45,11 @@
4545
"metadata": {},
4646
"outputs": [],
4747
"source": [
48-
"g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8182/gremlin', 'g'))"
48+
"# Traversal root\n",
49+
"g = traversal().with_remote(DriverRemoteConnection('ws://localhost:8080/gremlin', 'g', message_serializer=GraphSONSerializersV3d0()))\n",
50+
"\n",
51+
"# Client connection\n",
52+
"client = Client('ws://localhost:8080/gremlin', 'g', message_serializer=GraphSONSerializersV3d0())"
4953
]
5054
},
5155
{
@@ -77,7 +81,7 @@
7781
"metadata": {},
7882
"outputs": [],
7983
"source": [
80-
"g.V('1', '2').hasLabel('person').outE('knows').values().is_(lt(1)).to_list()"
84+
"g.V('1', '2').hasLabel('person').outE('knows').values().is_(P.lt(1)).to_list()"
8185
]
8286
},
8387
{
@@ -96,13 +100,21 @@
96100
"g.V('1').repeat(__.both().simplePath()).until(__.has('name', 'lop')).limit(3).path().by(__.valueMap()).to_list()"
97101
]
98102
},
103+
{
104+
"cell_type": "markdown",
105+
"metadata": {},
106+
"source": [
107+
"Run a seeded cypher query via Gremlin. Submitted as a script rather than via gremlin-python bindings"
108+
]
109+
},
99110
{
100111
"cell_type": "code",
101112
"execution_count": null,
102113
"metadata": {},
103114
"outputs": [],
104115
"source": [
105-
"g.V('1').outE().as_(\"a\").V('1').values(\"name\").to_list()"
116+
"results = client.submit(\"g.with(\\\"cypher\\\", \\\"MATCH (p:person) WHERE ID(p) = '1' RETURN p\\\").call()\")\n",
117+
"results.all().result()"
106118
]
107119
}
108120
],

0 commit comments

Comments
 (0)