Configuration and deployment¶
What you need¶
| Component | Requirement |
|---|---|
| PostgreSQL | Used for all data. Developed against version 17. The schema is created and migrated automatically with Flyway. |
| OIDC identity provider | Keycloak. Developed against version 26. |
| Graph database (optional) | Neo4j 5 Community, version 5.9 or later. Developed against version 5.26. |
Run the container¶
The repository's Dockerfile packages an already built JAR:
mvn clean package -DskipTests
docker build -t marmotgraph-core .
docker run -p 8000:8000 --env-file core.env marmotgraph-core
The application listens on port 8000 and runs as a non-root user.
To include this documentation, build the JAR with mvn clean package -DskipTests -Pdocs, which requires
Zensical. It's then publicly available at /docs and linked from
the start page. Diagrams load Mermaid from unpkg in the reader's browser, so they need internet access.
Required settings¶
| Variable | Description |
|---|---|
POSTGRES |
Host and port, for example db:5432 |
POSTGRES_DB_NAME |
Database name |
POSTGRES_USER, POSTGRES_PWD |
Database credentials |
KEYCLOAK_ISSUER_URI |
Issuer URL of the realm, for example https://id.example.org/realms/marmotgraph |
KEYCLOAK_CLIENT |
Client ID for interactive logins. This must be a public client. |
ACTUATOR_PWD |
Password for the monitoring endpoints |
Graph engine¶
Set the Spring profile with SPRING_PROFILES_ACTIVE to choose how queries are executed:
| Profile | Query execution | Trade-offs |
|---|---|---|
nograph (default) |
Directly in PostgreSQL | Nothing else to operate and always consistent, but slower for large types |
neo4j |
In Neo4j | Faster for large graphs, but it's a second database, needs a reindex when first set up and adds time to each write |
For neo4j:
| Variable | Default |
|---|---|
NEO4J_HOST |
localhost |
NEO4J_PORT |
7687 |
NEO4J_USR |
neo4j |
NEO4J_PWD |
empty |
When you switch to Neo4j, run a reindex to populate the graph.
Scopes are always evaluated in PostgreSQL.
Application settings¶
| Variable or property | Default | Description |
|---|---|---|
EXTERNAL_PORT |
8000 |
HTTP port |
MARMOTGRAPH_NAMESPACE |
https://kg.ebrains.eu/api/instances/ |
Namespace for identifiers |
org.marmotgraph.instance.namespace |
empty | Namespace prefixed to UUIDs in the identifiers of instances |
org.marmotgraph.authentication.adminGroup |
marmotgraph-admins |
Group granting global ADMIN |
org.marmotgraph.authentication.adminClaim |
groups |
Claim containing the group |
INVITATIONS_EXPIRATION |
30d |
Lifetime of invitation links |
INVITATIONS_CLEANUP_CRON |
0 30 3 * * * |
Removal of expired invitations |
SUMMARY_RECONCILIATION_CRON |
0 0 3 * * * |
Reconciliation of the statistics tables |
org.marmotgraph.batch.maxItems |
10000 |
Maximum number of items of a batch |
org.marmotgraph.batch.chunkSize |
500 |
Number of items of a batch processed within one transaction |
org.marmotgraph.batch.maxConcurrentJobs |
2 |
Batches processed in the background at the same time |
org.marmotgraph.batch.maxQueuedJobs |
20 |
Background batches waiting to be processed - further ones are rejected with 503 |
org.marmotgraph.batch.retention |
7d |
How long finished batch jobs are kept |
org.marmotgraph.batch.cleanupCron |
0 45 3 * * * |
Removal of expired batch jobs |
org.marmotgraph.runtimeMetrics |
false |
Enables additional runtime metrics logging |
spring.datasource.hikari.maximum-pool-size |
Spring default | Size of the connection pool, which also determines write throttling |
These are Spring properties, so they can be set through the environment or any other Spring configuration source.
Choose namespaces before loading data
Namespaces end up in stored identifiers. Changing them later affects existing data.
Core is set up to work behind a reverse proxy and honors the Forwarded and X-Forwarded-* headers.