From 76d47b85587ee8d40bc0cba0daa8c7160717e0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Fri, 8 Mar 2024 13:06:57 +0100 Subject: [PATCH] fix: fixes devcontainer.json and docker compose for local dev [skip ci] --- .devcontainer/blazegraph/RWStore.properties | 50 ++++++++++++++++++++ .devcontainer/devcontainer.json | 5 +- .devcontainer/docker-compose-standalone.yml | 52 +++++++++++++++++++++ .devcontainer/docker-compose.yml | 9 ++-- .vscode/launch.json | 17 ++++++- 5 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 .devcontainer/blazegraph/RWStore.properties create mode 100644 .devcontainer/docker-compose-standalone.yml diff --git a/.devcontainer/blazegraph/RWStore.properties b/.devcontainer/blazegraph/RWStore.properties new file mode 100644 index 0000000..ed357ed --- /dev/null +++ b/.devcontainer/blazegraph/RWStore.properties @@ -0,0 +1,50 @@ +# +# Note: These options are applied when the journal and the triple store are +# first created. + +## +## Journal options. +## + +# The backing file. This contains all your data. You want to put this someplace +# safe. The default locator will wind up in the directory from which you start +# your servlet container. +com.bigdata.journal.AbstractJournal.file=bigdata.jnl + +# The persistence engine. Use 'Disk' for the WORM or 'DiskRW' for the RWStore. +com.bigdata.journal.AbstractJournal.bufferMode=DiskRW + +# Setup for the RWStore recycler rather than session protection. +com.bigdata.service.AbstractTransactionService.minReleaseAge=1 + +# Enable group commit. See http://wiki.blazegraph.com/wiki/index.php/GroupCommit +# Note: Group commit is a beta feature in BlazeGraph release 1.5.1. +#com.bigdata.journal.Journal.groupCommit=true + +com.bigdata.btree.writeRetentionQueue.capacity=4000 +com.bigdata.btree.BTree.branchingFactor=128 + +# 200M initial extent. +com.bigdata.journal.AbstractJournal.initialExtent=209715200 +com.bigdata.journal.AbstractJournal.maximumExtent=209715200 + +## +## Setup for QUADS mode without the full text index. +## +com.bigdata.rdf.sail.truthMaintenance=false +com.bigdata.rdf.store.AbstractTripleStore.quads=true +com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false +com.bigdata.rdf.store.AbstractTripleStore.textIndex=true +com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms + +# Bump up the branching factor for the lexicon indices on the default kb. +com.bigdata.namespace.kb.lex.com.bigdata.btree.BTree.branchingFactor=400 + +# Bump up the branching factor for the statement indices on the default kb. +com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor=1024 + +# Uncomment to enable collection of OS level performance counters. When +# collected they will be self-reported through the /counters servlet and +# the workbench "Performance" tab. +# +# com.bigdata.journal.Journal.collectPlatformStatistics=true \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b791a17..928eed4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -30,9 +30,8 @@ //Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [ 8000, - 8080, - 9999 + 8080 ] // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" -} \ No newline at end of file +} diff --git a/.devcontainer/docker-compose-standalone.yml b/.devcontainer/docker-compose-standalone.yml new file mode 100644 index 0000000..d1ad77b --- /dev/null +++ b/.devcontainer/docker-compose-standalone.yml @@ -0,0 +1,52 @@ +version: '3' + +services: + intavia_backend_app: + build: + context: .. + dockerfile: Dockerfile + args: + # [Choice] Python version: 3, 3.8, 3.7, 3.6 + VARIANT: "3.10" + # [Choice] Install Node.js + # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000. + INSTALL_DEV: "true" + USER_UID: 1000 + USER_GID: 1000 + + #- /home/sennierer/.ssh:/home/vscode/.ssh:cached + + # Overrides default command so things don't shut down after the process ends. + # command: sleep infinity + + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + # network_mode: service:db + env_file: + - development-standalone.env + + ports: + - "5000:5000" + + # Uncomment the next line to use a non-root user for all processes. + # user: vscode + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + db: + image: lyrasis/blazegraph:2.1.5 + environment: + JAVA_XMS: 512m + JAVA_XMX: 1g + volumes: + - ./blazegraph/data:/data + - ./blazegraph/RWStore.properties:/RWStore.properties + ports: + - "8889:8889" + + redis: + image: bitnami/redis:latest + environment: + - ALLOW_EMPTY_PASSWORD=yes + # network_mode: service:db + # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 16d3ddc..aee8106 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -25,21 +25,20 @@ services: network_mode: service:db env_file: - development.env + # Uncomment the next line to use a non-root user for all processes. # user: vscode # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. # (Adding the "ports" property to this file will not forward from a Codespace.) db: - image: nawer/blazegraph + image: lyrasis/blazegraph:2.1.5 environment: JAVA_XMS: 512m JAVA_XMX: 1g volumes: - - ./var/blazegraph:/var/lib/blazegraph - - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - ports: - - "9999:9999" + - ./blazegraph/data:/data + - ./blazegraph/RWStore.properties:/RWStore.properties redis: image: bitnami/redis:latest diff --git a/.vscode/launch.json b/.vscode/launch.json index e0900b2..5be22da 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Python: FastAPI", + "name": "local blazegraph", "type": "python", "request": "launch", "module": "uvicorn", @@ -13,7 +13,20 @@ "intavia_backend.main:app" ], "jinja": true, - "justMyCode": true + "justMyCode": true, + "env": {"SPARQL_ENDPOINT": "http://db:8080/bigdata/sparql"}, + }, + { + "name": "InTaVia production blazegraph", + "type": "python", + "request": "launch", + "module": "uvicorn", + "args": [ + "intavia_backend.main:app" + ], + "jinja": true, + "justMyCode": true, + "env": {"SPARQL_ENDPOINT": "https://intavia-ts.acdh-dev.oeaw.ac.at/sparql"}, } ] } \ No newline at end of file