Skip to content

Commit

Permalink
Create /dracor dataset after server start
Browse files Browse the repository at this point in the history
This removes support for the FUSEKI_DATASET_* env variable since we don't need it.
  • Loading branch information
cmil committed Dec 4, 2022
1 parent d20a7c5 commit ddd7e0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ which is a [SPARQL 1.1](http://www.w3.org/TR/sparql11-overview/) server with a
web interface, backed by the
[Apache Jena TDB](https://jena.apache.org/documentation/tdb/) RDF triple store.

The entrypoint for this image creates an empty dataset `/dracor` after starting
the Fuseki server.

## License

Different licenses apply to files added by different Docker layers:
Expand Down Expand Up @@ -111,14 +114,6 @@ volume `fuseki-data` as recommended above, do:
docker rm fuseki
docker run -d --name fuseki -p 3030:3030 --volumes-from fuseki-data dracor/fuseki

## Create empty datasets

You can create empty datasets at startup with:

docker run -d --name fuseki -p 3030:3030 -e FUSEKI_DATASET_1=mydataset -e FUSEKI_DATASET_2=otherdataset dracor/fuseki

This will create 2 empty datasets: mydataset and otherdataset.

## Customizing Fuseki configuration

If you need to modify Fuseki's configuration further, you can use the equivalent of:
Expand Down
14 changes: 4 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ if [ -n "$ADMIN_PASSWORD" ] ; then
export ADMIN_PASSWORD
envsubst '${ADMIN_PASSWORD}' < "$FUSEKI_BASE/shiro.ini" > "$FUSEKI_BASE/shiro.ini.$$" && \
mv "$FUSEKI_BASE/shiro.ini.$$" "$FUSEKI_BASE/shiro.ini"
unset ADMIN_PASSWORD # Don't keep it in memory
export ADMIN_PASSWORD
fi

# fork
Expand All @@ -62,14 +60,10 @@ while [[ $(curl -I http://localhost:3030 2>/dev/null | head -n 1 | cut -d$' ' -f
done

# Convert env to datasets
printenv | egrep "^FUSEKI_DATASET_" | while read env_var
do
dataset=$(echo $env_var | egrep -o "=.*$" | sed 's/^=//g')
curl -s 'http://localhost:3030/$/datasets'\
-H "Authorization: Basic $(echo -n admin:${ADMIN_PASSWORD} | base64)" \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'\
--data "dbName=${dataset}&dbType=${TDB_VERSION}"
done
curl -s 'http://localhost:3030/$/datasets'\
-H "Authorization: Basic $(echo -n admin:${ADMIN_PASSWORD} | base64)" \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'\
--data "dbName=/dracor&dbType=${TDB_VERSION}"

# rejoin our exec
wait

0 comments on commit ddd7e0a

Please sign in to comment.