mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 15:01:00 +02:00
Feature/memgraph (#182)
* Add database override to bolt output, default is neo4j * Add memgraph templates
This commit is contained in:
parent
b2f7b34529
commit
9c97ca32f6
6 changed files with 171 additions and 5 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
"graph-rag": import "components/graph-rag.jsonnet",
|
"graph-rag": import "components/graph-rag.jsonnet",
|
||||||
"triple-store-cassandra": import "components/cassandra.jsonnet",
|
"triple-store-cassandra": import "components/cassandra.jsonnet",
|
||||||
"triple-store-neo4j": import "components/neo4j.jsonnet",
|
"triple-store-neo4j": import "components/neo4j.jsonnet",
|
||||||
|
"triple-store-memgraph": import "components/memgraph.jsonnet",
|
||||||
"llamafile": import "components/llamafile.jsonnet",
|
"llamafile": import "components/llamafile.jsonnet",
|
||||||
"ollama": import "components/ollama.jsonnet",
|
"ollama": import "components/ollama.jsonnet",
|
||||||
"openai": import "components/openai.jsonnet",
|
"openai": import "components/openai.jsonnet",
|
||||||
|
|
@ -34,6 +35,7 @@
|
||||||
// FIXME: Dupes
|
// FIXME: Dupes
|
||||||
"cassandra": import "components/cassandra.jsonnet",
|
"cassandra": import "components/cassandra.jsonnet",
|
||||||
"neo4j": import "components/neo4j.jsonnet",
|
"neo4j": import "components/neo4j.jsonnet",
|
||||||
|
"memgraph": import "components/memgraph.jsonnet",
|
||||||
"qdrant": import "components/qdrant.jsonnet",
|
"qdrant": import "components/qdrant.jsonnet",
|
||||||
"pinecone": import "components/pinecone.jsonnet",
|
"pinecone": import "components/pinecone.jsonnet",
|
||||||
"milvus": import "components/milvus.jsonnet",
|
"milvus": import "components/milvus.jsonnet",
|
||||||
|
|
|
||||||
81
templates/components/memgraph.jsonnet
Normal file
81
templates/components/memgraph.jsonnet
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
local base = import "base/base.jsonnet";
|
||||||
|
local images = import "values/images.jsonnet";
|
||||||
|
local url = import "values/url.jsonnet";
|
||||||
|
local memgraph = import "stores/memgraph.jsonnet";
|
||||||
|
|
||||||
|
memgraph + {
|
||||||
|
|
||||||
|
"memgraph-url":: "bolt://memgraph:7687",
|
||||||
|
"memgraph-database":: "memgraph",
|
||||||
|
|
||||||
|
"store-triples" +: {
|
||||||
|
|
||||||
|
create:: function(engine)
|
||||||
|
|
||||||
|
local container =
|
||||||
|
engine.container("store-triples")
|
||||||
|
.with_image(images.trustgraph)
|
||||||
|
.with_command([
|
||||||
|
"triples-write-neo4j",
|
||||||
|
"-p",
|
||||||
|
url.pulsar,
|
||||||
|
"-g",
|
||||||
|
$["memgraph-url"],
|
||||||
|
"--database",
|
||||||
|
$["memgraph-database"],
|
||||||
|
])
|
||||||
|
.with_limits("0.5", "128M")
|
||||||
|
.with_reservations("0.1", "128M");
|
||||||
|
|
||||||
|
local containerSet = engine.containers(
|
||||||
|
"store-triples", [ container ]
|
||||||
|
);
|
||||||
|
|
||||||
|
local service =
|
||||||
|
engine.internalService(containerSet)
|
||||||
|
.with_port(8080, 8080, "metrics");
|
||||||
|
|
||||||
|
engine.resources([
|
||||||
|
containerSet,
|
||||||
|
service,
|
||||||
|
])
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
"query-triples" +: {
|
||||||
|
|
||||||
|
create:: function(engine)
|
||||||
|
|
||||||
|
local container =
|
||||||
|
engine.container("query-triples")
|
||||||
|
.with_image(images.trustgraph)
|
||||||
|
.with_command([
|
||||||
|
"triples-query-neo4j",
|
||||||
|
"-p",
|
||||||
|
url.pulsar,
|
||||||
|
"-g",
|
||||||
|
$["memgraph-url"],
|
||||||
|
"--database",
|
||||||
|
$["memgraph-database"],
|
||||||
|
])
|
||||||
|
.with_limits("0.5", "128M")
|
||||||
|
.with_reservations("0.1", "128M");
|
||||||
|
|
||||||
|
local containerSet = engine.containers(
|
||||||
|
"query-triples", [ container ]
|
||||||
|
);
|
||||||
|
|
||||||
|
local service =
|
||||||
|
engine.internalService(containerSet)
|
||||||
|
.with_port(8080, 8080, "metrics");
|
||||||
|
|
||||||
|
engine.resources([
|
||||||
|
containerSet,
|
||||||
|
service,
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
65
templates/stores/memgraph.jsonnet
Normal file
65
templates/stores/memgraph.jsonnet
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
local base = import "base/base.jsonnet";
|
||||||
|
local images = import "values/images.jsonnet";
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
"memgraph" +: {
|
||||||
|
|
||||||
|
create:: function(engine)
|
||||||
|
|
||||||
|
local container =
|
||||||
|
engine.container("memgraph")
|
||||||
|
.with_image(images.memgraph_mage)
|
||||||
|
.with_limits("1.0", "1000M")
|
||||||
|
.with_reservations("0.5", "1000M")
|
||||||
|
.with_port(7474, 7474, "api")
|
||||||
|
.with_port(7687, 7687, "api2");
|
||||||
|
|
||||||
|
local containerSet = engine.containers(
|
||||||
|
"memgraph", [ container ]
|
||||||
|
);
|
||||||
|
|
||||||
|
local service =
|
||||||
|
engine.service(containerSet)
|
||||||
|
.with_port(7474, 7474, "api")
|
||||||
|
.with_port(7687, 7687, "api2");
|
||||||
|
|
||||||
|
engine.resources([
|
||||||
|
containerSet,
|
||||||
|
service,
|
||||||
|
])
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
"memgraph-lab" +: {
|
||||||
|
|
||||||
|
create:: function(engine)
|
||||||
|
|
||||||
|
local container =
|
||||||
|
engine.container("lab")
|
||||||
|
.with_image(images.memgraph_lab)
|
||||||
|
.with_environment({
|
||||||
|
QUICK_CONNECT_MG_HOST: "memgraph",
|
||||||
|
QUICK_CONNECT_MG_PORT: "7687",
|
||||||
|
})
|
||||||
|
.with_limits("1.0", "512M")
|
||||||
|
.with_reservations("0.5", "512M")
|
||||||
|
.with_port(3010, 3000, "http");
|
||||||
|
|
||||||
|
local containerSet = engine.containers(
|
||||||
|
"lab", [ container ]
|
||||||
|
);
|
||||||
|
|
||||||
|
local service =
|
||||||
|
engine.service(containerSet)
|
||||||
|
.with_port(3010, 3010, "http");
|
||||||
|
|
||||||
|
engine.resources([
|
||||||
|
containerSet,
|
||||||
|
service,
|
||||||
|
])
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -10,5 +10,7 @@ local version = import "version.jsonnet";
|
||||||
prometheus: "docker.io/prom/prometheus:v2.53.2",
|
prometheus: "docker.io/prom/prometheus:v2.53.2",
|
||||||
grafana: "docker.io/grafana/grafana:11.1.4",
|
grafana: "docker.io/grafana/grafana:11.1.4",
|
||||||
trustgraph: "docker.io/trustgraph/trustgraph-flow:" + version,
|
trustgraph: "docker.io/trustgraph/trustgraph-flow:" + version,
|
||||||
qdrant: "docker.io/qdrant/qdrant:v1.11.1"
|
qdrant: "docker.io/qdrant/qdrant:v1.11.1",
|
||||||
|
memgraph_mage: "docker.io/memgraph/memgraph-mage:1.22-memgraph-2.22",
|
||||||
|
memgraph_lab: "docker.io/memgraph/lab:2.19.1",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ default_subscriber = module
|
||||||
default_graph_host = 'bolt://neo4j:7687'
|
default_graph_host = 'bolt://neo4j:7687'
|
||||||
default_username = 'neo4j'
|
default_username = 'neo4j'
|
||||||
default_password = 'password'
|
default_password = 'password'
|
||||||
|
default_database = 'neo4j'
|
||||||
|
|
||||||
class Processor(ConsumerProducer):
|
class Processor(ConsumerProducer):
|
||||||
|
|
||||||
|
|
@ -31,7 +32,8 @@ class Processor(ConsumerProducer):
|
||||||
subscriber = params.get("subscriber", default_subscriber)
|
subscriber = params.get("subscriber", default_subscriber)
|
||||||
graph_host = params.get("graph_host", default_graph_host)
|
graph_host = params.get("graph_host", default_graph_host)
|
||||||
username = params.get("username", default_username)
|
username = params.get("username", default_username)
|
||||||
password = params.get("passowrd", default_password)
|
password = params.get("password", default_password)
|
||||||
|
database = params.get("database", default_database)
|
||||||
|
|
||||||
super(Processor, self).__init__(
|
super(Processor, self).__init__(
|
||||||
**params | {
|
**params | {
|
||||||
|
|
@ -44,7 +46,7 @@ class Processor(ConsumerProducer):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.db = "neo4j"
|
self.db = database
|
||||||
|
|
||||||
self.io = GraphDatabase.driver(graph_host, auth=(username, password))
|
self.io = GraphDatabase.driver(graph_host, auth=(username, password))
|
||||||
|
|
||||||
|
|
@ -342,6 +344,12 @@ class Processor(ConsumerProducer):
|
||||||
help=f'Neo4j password (default: {default_password})'
|
help=f'Neo4j password (default: {default_password})'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--database',
|
||||||
|
default=default_database,
|
||||||
|
help=f'Neo4j database (default: {default_database})'
|
||||||
|
)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
||||||
Processor.start(module, __doc__)
|
Processor.start(module, __doc__)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ default_subscriber = module
|
||||||
default_graph_host = 'bolt://neo4j:7687'
|
default_graph_host = 'bolt://neo4j:7687'
|
||||||
default_username = 'neo4j'
|
default_username = 'neo4j'
|
||||||
default_password = 'password'
|
default_password = 'password'
|
||||||
|
default_database = 'neo4j'
|
||||||
|
|
||||||
class Processor(Consumer):
|
class Processor(Consumer):
|
||||||
|
|
||||||
|
|
@ -33,7 +34,8 @@ class Processor(Consumer):
|
||||||
subscriber = params.get("subscriber", default_subscriber)
|
subscriber = params.get("subscriber", default_subscriber)
|
||||||
graph_host = params.get("graph_host", default_graph_host)
|
graph_host = params.get("graph_host", default_graph_host)
|
||||||
username = params.get("username", default_username)
|
username = params.get("username", default_username)
|
||||||
password = params.get("passowrd", default_password)
|
password = params.get("password", default_password)
|
||||||
|
database = params.get("database", default_database)
|
||||||
|
|
||||||
super(Processor, self).__init__(
|
super(Processor, self).__init__(
|
||||||
**params | {
|
**params | {
|
||||||
|
|
@ -44,7 +46,7 @@ class Processor(Consumer):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.db = "neo4j"
|
self.db = database
|
||||||
|
|
||||||
self.io = GraphDatabase.driver(graph_host, auth=(username, password))
|
self.io = GraphDatabase.driver(graph_host, auth=(username, password))
|
||||||
|
|
||||||
|
|
@ -152,6 +154,12 @@ class Processor(Consumer):
|
||||||
help=f'Neo4j password (default: {default_password})'
|
help=f'Neo4j password (default: {default_password})'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--database',
|
||||||
|
default=default_database,
|
||||||
|
help=f'Neo4j database (default: {default_database})'
|
||||||
|
)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
||||||
Processor.start(module, __doc__)
|
Processor.start(module, __doc__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue