Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# runtime
blazegraph/
researchspace/
data_oxigraph/
basic/test.json
/basic/researchspace
/full-setup/researchspace
/custom/researchspace/runtime-data/data/repositories/tests/lock
/custom/researchspace/runtime-data/data/repositories/tests/lock
16 changes: 7 additions & 9 deletions full-setup/.env
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# (required). Hostname on which ResearchSpace instance should be available.
RESEARCHSPACE_HOST_NAME=
RESEARCHSPACE_HOST_NAME=localhost

# (required) your project name, to have nice container names in the docker-compose setup.
# see https://docs.docker.com/compose/reference/envvars/#compose_project_name
COMPOSE_PROJECT_NAME=
COMPOSE_PROJECT_NAME=graceful17

# (required) memory limits for docker containers

# Total amount of memory available for containers
RESEARCHSPACE_MEMORY=1g
BLAZEGRAPH_MEMORY=1g
RESEARCHSPACE_MEMORY=10g
DIGILIB_MEMORY=500m

OXIGRAPH_DATA=./data_oxigraph

# (optional) additional ReseearchSpace runtime options.
# By default increases jetty upload limit to ~100mb
RESEARCHSPACE_OPTS=-Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000

# (optional) additional JVM opts for various applications
# WARNING! Don't set Xmx here, use memory variables above. We use -XX:+UseContainerSupport, see https://merikan.com/2019/04/jvm-in-a-container/ for more details about memory management of Java apps inside docker.
RESEARCHSPACE_JAVA_OPTS=
BLAZEGRAPH_JAVA_OPTS=
DIGILIB_JAVA_OPTS=

# docker images
RESEARCHSPACE_IMAGE=researchspace/platform-ci:latest
BLAZEGRAPH_IMAGE=researchspace/blazegraph:latest
DIGILIB_IMAGE=robcast/digilib:latest

OXIGRAPH_IMAGE=oxigraph/oxigraph:latest
DIGILIB_IMAGE=researchspace/digilib:2.9.1-12m
56 changes: 22 additions & 34 deletions full-setup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ services:
restart: unless-stopped
mem_limit: ${RESEARCHSPACE_MEMORY}
mem_reservation: ${RESEARCHSPACE_MEMORY}
# ports:
# - "10214:8080" # routed via nginx to RESEARCHSPACE_HOST_NAME
environment:
# 1. Connect researchspace instance to blazegraph instance, in this case we use internal hostname available only inside docker-compose create network.
# 2. Set default logging profile to log4j2, other possible options are log4j2-debug.xml, log4j2-trace.xml
# 3-5. Create storage needed for image upload functionality
# 6-8. Create temp storage needed for image upload functionality
# 7. Additional options provided in .env file
PLATFORM_OPTS: >-
-Dconfig.environment.sparqlEndpoint=http://blazegraph:8080/blazegraph/sparql
-Dconfig.environment.sparqlEndpoint=http://oxigraph:7878/query
-Dlog4j.configurationFile=classpath:org/researchspace/logging/log4j2.xml
-Dconfig.storage.images.type=nonVersionedFile
-Dconfig.storage.images.mutable=true
Expand All @@ -34,42 +36,13 @@ services:
# mount folder where temporary files should be stored
- ./researchspace/data/tmp:/tmp-data:rw

# mount folder where apps should be stored
- ./researchspace/apps:/apps:rw

# runtime data folder with config files and ad-hoc templates
- ./researchspace/runtime-data:/runtime-data
depends_on:
- blazegraph
- digilib
logging:
driver: json-file
options:
max-size: "200k"
max-file: "10"

blazegraph:
image: ${BLAZEGRAPH_IMAGE}
restart: unless-stopped
mem_limit: ${BLAZEGRAPH_MEMORY}
mem_reservation: ${BLAZEGRAPH_MEMORY}
environment:
JAVA_OPTS: ${BLAZEGRAPH_JAVA_OPTS}
volumes:
- ./blazegraph/:/blazegraph-data
logging:
driver: json-file
options:
max-size: "200k"
max-file: "10"

digilib:
image: ${DIGILIB_IMAGE}
restart: unless-stopped
mem_limit: ${DIGILIB_MEMORY}
mem_reservation: ${DIGILIB_MEMORY}
environment:
BASEDIR_LIST: /var/lib/images
IIIF_IMAGE_BASE_URL: "https://${RESEARCHSPACE_HOST_NAME}/proxy/IIIF/"
volumes:
- ./researchspace/data/images/file:/var/lib/images:rw
- oxigraph
logging:
driver: json-file
options:
Expand Down Expand Up @@ -119,3 +92,18 @@ services:
max-size: "200k"
max-file: "10"

digilib:
image: ${DIGILIB_IMAGE}
restart: unless-stopped
mem_limit: ${DIGILIB_MEMORY}
mem_reservation: ${DIGILIB_MEMORY}
environment:
BASEDIR_LIST: /var/lib/images
IIIF_IMAGE_BASE_URL: "http://localhost:10214/proxy/IIIF/"
volumes:
- ./researchspace/data/images/file:/var/lib/images:rw
logging:
driver: json-file
options:
max-size: "200k"
max-file: "10"
16 changes: 8 additions & 8 deletions full-setup/fix-folder-permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -e

RUNTIME_DATA=./researchspace
BLAZEGRAPH_DATA=./blazegraph
OXIGRAPH_DATA=./data_oxigraph

echo "Creating storage folders"

Expand All @@ -14,19 +14,19 @@ mkdir -p ${RUNTIME_DATA}/data/tmp/file
echo "Changing ownership of the ResearchSpace runtime-data folder: ${RUNTIME_DATA}"

# change ownership of the runtime-data folder to uid/guid that is used inside researchspace docker container
chown -R 100:0 ${RUNTIME_DATA}
sudo chown -R 100:0 ${RUNTIME_DATA}

# make sure that folder has correct write permissions and new files that are created inside the folder inherit ownership
chmod -R g+ws ${RUNTIME_DATA}
sudo chmod -R g+ws ${RUNTIME_DATA}

echo "Creating blazegraph journal folder: ${BLAZEGRAPH_DATA}"
echo "Creating oxigraph store folder: ${OXIGRAPH_DATA}"

# create folder for blazegraph journal file
mkdir -p ${BLAZEGRAPH_DATA}
mkdir -p ${OXIGRAPH_DATA}

# change ownership of the blazegraph data folder to uid/guid that is used inside blazegraph docker container
chown -R 999:999 ${BLAZEGRAPH_DATA}
sudo chown -R $USER:$USER ${OXIGRAPH_DATA}
sudo chmod -R 775 ${OXIGRAPH_DATA}

# make sure that folder has correct write permissions and new files that are created inside the folder inherit ownership
chmod -R g+ws ${RUNTIME_DATA}

sudo chmod -R g+ws ${RUNTIME_DATA}
87 changes: 87 additions & 0 deletions full-setup/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
'' $server_port;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
default upgrade;
'' close;
}
# Apply fix for very long server names
server_names_hash_bucket_size 128;
# Default dhparam
# Set appropriate X-Forwarded-Ssl header
map $scheme $proxy_x_forwarded_ssl {
default off;
https on;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers off;
# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";
server {
server_name _; # This is just an invalid value which will never trigger on a real hostname.
listen 80;
access_log /var/log/nginx/access.log vhost;
return 503;
}
# localhost
upstream localhost {
## Can be connected with "graceful17_default" network
# graceful17-researchspace-1
server 172.21.0.5:8080;
}
server {
server_name localhost;
listen 80 default_server;
access_log /var/log/nginx/access.log vhost;
location / {
proxy_pass http://localhost;
}
}
server {
server_name localhost;
listen 7878;
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Access-Control-Allow-Origin "*";
location ~ ^(/|/query)$ {
proxy_pass http://oxigraph:7878;
proxy_pass_request_headers on;
}
location ~ ^(/update|/store)$ {
auth_basic "Oxigraph Administrator's Area";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://oxigraph:7878;
proxy_pass_request_headers on;
}
}
23 changes: 23 additions & 0 deletions oxigraph/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# (required) your project name, to have nice container names in the docker-compose setup.
# see https://docs.docker.com/compose/reference/envvars/#compose_project_name
COMPOSE_PROJECT_NAME=

# (required) memory limits for docker containers

# Total amount of memory available for containers
RESEARCHSPACE_MEMORY=1g
DIGILIB_MEMORY=500m

# (optional) additional ReseearchSpace runtime options.
# By default increases jetty upload limit to ~100mb
RESEARCHSPACE_OPTS=-Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000

# (optional) additional JVM opts for various applications
# WARNING! Don't set Xmx here, use memory variables above. We use -XX:+UseContainerSupport, see https://merikan.com/2019/04/jvm-in-a-container/ for more details about memory management of Java apps inside docker.
RESEARCHSPACE_JAVA_OPTS=
DIGILIB_JAVA_OPTS=

# docker images
RESEARCHSPACE_IMAGE=researchspace/platform-ci:oxigraph-fix
DIGILIB_IMAGE=robcast/digilib:latest
OXIGRAPH_IMAGE=ghcr.io/oxigraph/oxigraph:main
15 changes: 15 additions & 0 deletions oxigraph/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# oxigraph replacing blazegraph

A docker installation if you want [oxigraph](https://github.com/oxigraph/oxigraph) instead of blazegraph to serve ResearchSpace.

## Why?

- blazegraph development is abandoned
- oxigraph is a performant in-development graph database implementing the SPARQL standard. It come with many supplementary libraries and packages to integrate it into various frameworks.

## Prerequisites

- Currently only works with ResearchSpace image `researchspace/platform-ci:oxigraph-fix`
- Make sure to enable the `--union-default-graph` flag at CLI startup
- you must create a `\researchspace\runtime-data\config\repositories\default.ttl`
- if you need to have the oxigraph service proxied (as for `full-setup`), add your nginx config at the end of `full-setup\nginx\nginx.tmpl` (see also https://github.com/oxigraph/oxigraph/tree/main/cli#run-the-web-server-with-basic-authentication)
71 changes: 71 additions & 0 deletions oxigraph/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: "2.2"
services:
researchspace:
image: ${RESEARCHSPACE_IMAGE}
restart: unless-stopped
mem_limit: ${RESEARCHSPACE_MEMORY}
mem_reservation: ${RESEARCHSPACE_MEMORY}
ports:
- "10214:8080"
environment:
# 1. Connect researchspace instance to blazegraph instance, in this case we use internal hostname available only inside docker-compose create network.
# 2. Set default logging profile to log4j2, other possible options are log4j2-debug.xml, log4j2-trace.xml
# 3-5. Create storage needed for image upload functionality
# 6-8. Create temp storage needed for image upload functionality
# 7. Additional options provided in .env file
# -Dlog4j.configurationFile=file:/runtime-data/log4j2-trace.xml
PLATFORM_OPTS: >-
-Dconfig.environment.sparqlEndpoint=http://oxigraph:7878/query
-Dlog4j.configurationFile=classpath:org/researchspace/logging/log4j2-debug.xml
-Dconfig.storage.images.type=nonVersionedFile
-Dconfig.storage.images.mutable=true
-Dconfig.storage.images.root=/images
-Dconfig.storage.tmp.type=nonVersionedFile
-Dconfig.storage.tmp.mutable=true
-Dconfig.storage.tmp.root=/tmp-data
${RESEARCHSPACE_OPTS}
JAVA_OPTS: ${RESEARCHSPACE_JAVA_OPTS}
volumes:
# mount folder where uploaded images should be stored
- ./researchspace/data/images:/images:rw

# mount folder where temporary files should be stored
- ./researchspace/data/tmp:/tmp-data:rw

# mount folder where apps should be stored
- ./researchspace/apps:/apps:rw

# runtime data folder with config files and ad-hoc templates
- ./researchspace/runtime-data:/runtime-data
depends_on:
- oxigraph
- digilib
logging:
driver: json-file
options:
max-size: "200k"
max-file: "10"

oxigraph:
image: ${OXIGRAPH_IMAGE}
ports:
- "7878:7878"
volumes:
- ./data_oxigraph:/data
command: ["serve", "--location", "/data", "--bind", "0.0.0.0:7878", "--union-default-graph", "--cors"]

digilib:
image: ${DIGILIB_IMAGE}
restart: unless-stopped
mem_limit: ${DIGILIB_MEMORY}
mem_reservation: ${DIGILIB_MEMORY}
environment:
BASEDIR_LIST: /var/lib/images
IIIF_IMAGE_BASE_URL: "http://localhost:10214/proxy/IIIF/"
volumes:
- ./researchspace/data/images/file:/var/lib/images:rw
logging:
driver: json-file
options:
max-size: "200k"
max-file: "10"
Loading