stain / jena-docker

Docker image for Apache Jena riot
Apache License 2.0
99 stars 86 forks source link

Update to a newer version 4.1.0, 4.2.0, 4.3.0 aso.? #70

Closed infinite-dao closed 1 year ago

infinite-dao commented 2 years ago

Hi,

is it possible to update to a newer version?

I have an issue to move huge named GRAPH and the recommendation is to update to version 4.3.2 or 4.4.0 (see lists.apache.org thread “MOVE GRAPH … TO GRAPH … ~  Server Error 500 Iterator: started at 5, now 6 (SPARQL Update)”).

Or is it otherwise possible to easily update fuseki itself? (probably from the Dockerfile or so, I’m not familiar with that)

Kind regards, Andreas

CarMoreno commented 1 year ago

There is a PR to update the version but it has not been merged yet 😞

kuzeko commented 1 year ago

This should have been fixed now @infinite-dao

infinite-dao commented 1 year ago

This should have been fixed now @infinite-dao

OK, I see now in master, that it is set to FUSEKI_VERSION=4.4.0, fine. I guess I have to build it on my own then, I tried (even for a higher Fuseki version):

docker build --build-arg FUSEKI_VERSION="4.7.0" \
  --build-arg FUSEKI_SHA512="9646343a23c2563357207f559cb7437aa91b52d02b87e70d77b746b609e93ed0ad9dce06e072f864d53422946f24aa8ee60d9c594c1f82e8f2ab226eba56e474" \
  --tag jena-fuseki-master-20231201 \
  https://github.com/stain/jena-docker.git#master:jena-fuseki
# …
# [Warning] One or more build-args [FUSEKI_SHA512 FUSEKI_VERSION] were not consumed
# …

… well at least the build was Fuseki version 4.4.0 then as expected from the env variable in Dockerfile. The Fuseki interface did work.

Is there any easy way to overwrite FUSEKI_SHA512 and FUSEKI_VERSION on and during build time? (The hard way would be probably to check out the git repo locally, modify it, and then build it upon the made modifications … I guess)

Edit: --build-arg FUSEKI_VERSION="4.7.0" will not work this way as it needs in Dockerfile also ARG … but there are only ENV definded at the present, you could study the tutorial of https://phoenixnap.com/kb/docker-environment-variables)

kuzeko commented 1 year ago

Sorry, I don't understand the issue, can you elaborate a bit more what is the issue now?

infinite-dao commented 1 year ago

I also commented this, as at this present time the documented way of running (docker run -p 3030:3030 stain/jena-fuseki) has not yet the update of the PR in it, so one has to know the very details on which docker level one can change default settings and on what it is not possible, or use other work arounds.

I’m not so familiar and experienced with docker aso., and it is difficult for me to see what command argument sets what variable on docker build (build time) or later on docker run --env … or even with docker compose.

Your afore mentioned example (https://phoenixnap.com/kb/docker-environment-variables#ftoc-heading-4) describes well the differences of ARG and ENV from which I can learn. My question aimed at a complete minimum example of how to setup a higher fuseki version than in this git repo, but I guess there is no magical easy way to do it (I assumed I could set docker run … --env FUSEKI_VERSION="4.7.0" FUSEKI_SHA512="…" but that was a misinterpreted assumption from my own thinking, so), except to:

  1. clone the git repo locally
  2. modify ENV in Dockerfile
  3. do docker build with that modified Dockerfile
  4. create the fuseki app by docker run …

A documentation on README (https://github.com/stain/jena-docker/tree/master/jena-fuseki#readme) of how to setup different Fuseki versions would be nice, but perhaps it is not intended (as this repo seems to address more the professional developers).

infinite-dao commented 1 year ago

So here is one way to setup an(y) other Fuseki version for the first time (not fully tested, but it worked at the time of writing):

custom_git_base=/my/custom/git-base4Jena-Apache/custom-setup

mkdir --parents "${custom_git_base}" \
  && cd "${custom_git_base}"

git clone https://github.com/stain/jena-docker.git

# copy original Dockerfile …
cd "${custom_git_base}"/jena-docker/jena-fuseki/ \
  && cp Dockerfile Dockerfile-fuseki-4-7-0
  # modify in Dockerfile-fuseki-4-7-0: FUSEKI_VERSION 4.7.0, FUSEKI_SHA512 …

# within the modified git directory use the modified Dockerfile
docker build --file Dockerfile-fuseki-4-7-0 \
  --tag jena-fuseki_customized-4-7-0 .
# Successfully tagged jena-fuseki_customized-4-7-0:latest

FUSEKI_APP=fuseki-app_test_fuseki_4-7-0
FUSEKI_DATA_APP=fuseki-data_test_fuseki_4-7-0

# set up data container
docker run --name "$FUSEKI_DATA_APP" --volume /fuseki busybox

# set up port 8080 on localhost:8080 for testing (`--publish portoutside:portinternal`)
docker run --name "$FUSEKI_APP" --detach --publish 8080:3030 \
  --log-opt max-size=300m \
  --log-opt max-file=3 \
  --log-opt compress=true \
  --env ADMIN_PASSWORD="my-super-secret-password" \
  --env JVM_ARGS="-Xmx2g -Dlog4j2.formatMsgNoLookups=true"\
  --volume /path/to/my/import/data:/import-data \
  --volumes-from "$FUSEKI_DATA_APP" \
  jena-fuseki_customized-4-7-0:latest

docker logs "$FUSEKI_APP"
# ###################################
# Initializing Apache Jena Fuseki
# 
# 
# ###################################
# 14:56:17 INFO  Server          :: Apache Jena Fuseki 4.7.0
# 14:56:17 INFO  Config          :: FUSEKI_HOME=/jena-fuseki
# 14:56:17 INFO  Config          :: FUSEKI_BASE=/fuseki
# 14:56:17 INFO  Config          :: Shiro file: file:///fuseki/shiro.ini
# 14:56:18 INFO  Server          ::   Memory: 2.0 GiB
# 14:56:18 INFO  Server          ::   Java:   11.0.16
# 14:56:18 INFO  Server          ::   OS:     Linux 5.15.85-1-MANJARO amd64
# 14:56:18 INFO  Server          ::   PID:    11
# 14:56:18 INFO  Server          :: Started 2023/01/12 14:56:18 UTC on port 3030

Now the Fuseki Server should run as 4.7.0.

And remove the entire test 4.7.0 Fuseki (including data):

FUSEKI_APP=fuseki-app_test_fuseki_4-7-0
FUSEKI_DATA_APP=fuseki-data_test_fuseki_4-7-0

# stop running containers
docker stop "$FUSEKI_APP"
docker stop "$FUSEKI_DATA_APP"

# remove containers
docker rm "$FUSEKI_APP" "$FUSEKI_DATA_APP"

# check what images are still there, and remove unused ones 
# (here our custom jena-fuseki_customized-4-7-0)
docker images --all 
docker rmi jena-fuseki_customized-4-7-0 # remove also the afore bulit images
infinite-dao commented 1 year ago

Just a follow up: With version 4.7.0 I got it not working, the UI error was «Last ping returned "AxiosError: Request failed with status code 404" in 13ms», it seems the problem with the jena fuseki 4.7.0, but version 4.4.0 and 4.6.0 worked as expected.