-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move to a unified start script and readonly example
- Loading branch information
Showing
7 changed files
with
194 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
docker/gaffer-gremlin/example/conf/gaffer/data/tinkerpop-modern.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"class": "AddElements", | ||
"input": [ | ||
{ | ||
"class": "Entity", | ||
"group": "person", | ||
"vertex": "1", | ||
"properties": { | ||
"name": "marko", | ||
"age": 29 | ||
} | ||
}, | ||
{ | ||
"class": "Entity", | ||
"group": "person", | ||
"vertex": "2", | ||
"properties": { | ||
"name": "vadas", | ||
"age": 27 | ||
} | ||
}, | ||
{ | ||
"class": "Entity", | ||
"group": "person", | ||
"vertex": "4", | ||
"properties": { | ||
"name": "josh", | ||
"age": 32 | ||
} | ||
}, | ||
{ | ||
"class": "Entity", | ||
"group": "person", | ||
"vertex": "6", | ||
"properties": { | ||
"name": "peter", | ||
"age": 35 | ||
} | ||
}, | ||
{ | ||
"class": "Entity", | ||
"group": "software", | ||
"vertex": "3", | ||
"properties": { | ||
"name": "lop", | ||
"lang": "java" | ||
} | ||
}, | ||
{ | ||
"class": "Entity", | ||
"group": "software", | ||
"vertex": "5", | ||
"properties": { | ||
"name": "ripple", | ||
"lang": "java" | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "knows", | ||
"source": "1", | ||
"destination": "2", | ||
"directed": true, | ||
"properties": { | ||
"weight": 0.5 | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "created", | ||
"source": "1", | ||
"destination": "3", | ||
"directed": true, | ||
"properties": { | ||
"weight": 0.4 | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "knows", | ||
"source": "1", | ||
"destination": "4", | ||
"directed": true, | ||
"properties": { | ||
"weight": 1.0 | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "created", | ||
"source": "4", | ||
"destination": "3", | ||
"directed": true, | ||
"properties": { | ||
"weight": 0.4 | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "created", | ||
"source": "4", | ||
"destination": "5", | ||
"directed": true, | ||
"properties": { | ||
"weight": 1.0 | ||
} | ||
}, | ||
{ | ||
"class": "Edge", | ||
"group": "created", | ||
"source": "6", | ||
"destination": "3", | ||
"directed": true, | ||
"properties": { | ||
"weight": 0.2 | ||
} | ||
} | ||
], | ||
"skipInvalidElements": false, | ||
"validate": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/sh | ||
# 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. | ||
|
||
CURRENT_DIR="$(dirname "$(readlink -f "${0}")")" | ||
TINKERPOP_MODERN_JSON="${CURRENT_DIR}/conf/gaffer/data/tinkerpop-modern.json" | ||
GAFFER_REST_URL="http://localhost:8080" | ||
|
||
# Make sure we have an evironment file for the image versions | ||
if [ ! -f "${1}" ]; then | ||
echo "Error - Environment file not set" | ||
echo "Example: ${0} <envfile>.env" | ||
exit 1 | ||
fi | ||
|
||
# Remove any existing containers | ||
docker compose --env-file "${1}" -f "${CURRENT_DIR}/compose.yaml" down | ||
|
||
# Start new deployment | ||
echo "-----------------------------------" | ||
echo "Starting new deployment..." | ||
docker compose --env-file "${1}" -f "${CURRENT_DIR}/compose.yaml" up --detach | ||
|
||
# Check can connect to instance | ||
echo "-----------------------------------" | ||
echo "Attempting to connect to Gaffer instance..." | ||
if ! docker run --rm --network=host curlimages/curl:latest \ | ||
curl --retry 20 \ | ||
--retry-delay 5 \ | ||
--retry-all-errors "${GAFFER_REST_URL}"/rest/graph/status | ||
then | ||
echo "Failed to connect to Gaffer instance" | ||
exit 1 | ||
fi | ||
|
||
# Load dataset | ||
echo "-----------------------------------" | ||
echo "Loading data into Gaffer instance..." | ||
if ! docker run --rm --network=host curlimages/curl:latest \ | ||
curl -H "Content-Type: application/json" \ | ||
--data "$(cat "${TINKERPOP_MODERN_JSON}")" "${GAFFER_REST_URL}"/rest/graph/operations/execute | ||
then | ||
echo "Failed to load tinkerpop modern JSON: ${TINKERPOP_MODERN_JSON}" | ||
exit 1 | ||
fi | ||
|
||
echo "-----------------------------------" | ||
echo "Deployment started!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters