Skip to content

Commit

Permalink
ci[minor] : Added graphdb in docker compose for integration tests (#1…
Browse files Browse the repository at this point in the history
…7510)

This PR adds graphdb to the docker compose so it can be used in integration tests.

Co-authored-by: KARTHEEK YAKKALA <[email protected]>
  • Loading branch information
kartheekyakkala and KARTHEEK YAKKALA authored Feb 16, 2024
1 parent 0835eba commit 44db441
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ services:
- "6020:6379"
volumes:
- ./redis-volume:/data
graphdb:
image: graphdb
ports:
- "6021:7200"
5 changes: 5 additions & 0 deletions docker/graphdb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ontotext/graphdb:10.5.1
RUN mkdir -p /opt/graphdb/dist/data/repositories/langchain
COPY config.ttl /opt/graphdb/dist/data/repositories/langchain/
COPY graphdb_create.sh /run.sh
ENTRYPOINT bash /run.sh
46 changes: 46 additions & 0 deletions docker/graphdb/config.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rep: <http://www.openrdf.org/config/repository#>.
@prefix sr: <http://www.openrdf.org/config/repository/sail#>.
@prefix sail: <http://www.openrdf.org/config/sail#>.
@prefix graphdb: <http://www.ontotext.com/config/graphdb#>.

[] a rep:Repository ;
rep:repositoryID "langchain" ;
rdfs:label "" ;
rep:repositoryImpl [
rep:repositoryType "graphdb:SailRepository" ;
sr:sailImpl [
sail:sailType "graphdb:Sail" ;

graphdb:read-only "false" ;

# Inference and Validation
graphdb:ruleset "empty" ;
graphdb:disable-sameAs "true" ;
graphdb:check-for-inconsistencies "false" ;

# Indexing
graphdb:entity-id-size "32" ;
graphdb:enable-context-index "false" ;
graphdb:enablePredicateList "true" ;
graphdb:enable-fts-index "false" ;
graphdb:fts-indexes ("default" "iri") ;
graphdb:fts-string-literals-index "default" ;
graphdb:fts-iris-index "none" ;

# Queries and Updates
graphdb:query-timeout "0" ;
graphdb:throw-QueryEvaluationException-on-timeout "false" ;
graphdb:query-limit-results "0" ;

# Settable in the file but otherwise hidden in the UI and in the RDF4J console
graphdb:base-URL "http://example.org/owlim#" ;
graphdb:defaultNS "" ;
graphdb:imports "" ;
graphdb:repository-type "file-repository" ;
graphdb:storage-folder "storage" ;
graphdb:entity-index-size "10000000" ;
graphdb:in-memory-literal-properties "true" ;
graphdb:enable-literal-index "true" ;
]
].
28 changes: 28 additions & 0 deletions docker/graphdb/graphdb_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /bin/bash
REPOSITORY_ID="langchain"
GRAPHDB_URI="http://localhost:7200/"

echo -e "\nUsing GraphDB: ${GRAPHDB_URI}"

function startGraphDB {
echo -e "\nStarting GraphDB..."
exec /opt/graphdb/dist/bin/graphdb
}

function waitGraphDBStart {
echo -e "\nWaiting GraphDB to start..."
for _ in $(seq 1 5); do
CHECK_RES=$(curl --silent --write-out '%{http_code}' --output /dev/null ${GRAPHDB_URI}/rest/repositories)
if [ "${CHECK_RES}" = '200' ]; then
echo -e "\nUp and running"
break
fi
sleep 30s
echo "CHECK_RES: ${CHECK_RES}"
done
}


startGraphDB &
waitGraphDBStart
wait
12 changes: 12 additions & 0 deletions docker/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Makefile

build_graphdb:
docker build --tag graphdb ./graphdb

start_graphdb:
docker-compose up -d graphdb

down:
docker-compose down -v --remove-orphans

.PHONY: build_graphdb start_graphdb down

0 comments on commit 44db441

Please sign in to comment.