Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(start-stack): use TTL files from DSP-API v24.0.8 (DEV-1580) #273

Merged
merged 5 commits into from Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions knora/dsp_tools.py
Expand Up @@ -39,7 +39,7 @@ def program(user_args: list[str]) -> None:
verbose_text = 'Verbose feedback'

# default values
default_localhost = 'http://0.0.0.0:3333'
default_localhost = 'http://localhost:3333'
default_user = 'root@example.com'
default_pw = 'test'
dsp_tools_version = version('dsp-tools')
Expand Down Expand Up @@ -85,7 +85,7 @@ def program(user_args: list[str]) -> None:
parser_upload.add_argument('-V', '--validate', action='store_true',
help='Do only validation of XML, no upload of the data')
parser_upload.add_argument('-i', '--imgdir', type=str, default='.', help='Path to folder containing the images')
parser_upload.add_argument('-S', '--sipi', type=str, default='http://0.0.0.0:1024', help='URL of SIPI server')
parser_upload.add_argument('-S', '--sipi', type=str, default='http://localhost:1024', help='URL of SIPI server')
parser_upload.add_argument('-v', '--verbose', action='store_true', help=verbose_text)
parser_upload.add_argument('-I', '--incremental', action='store_true', help='Incremental XML upload')
parser_upload.add_argument('-m', '--metrics', action='store_true', help='Write metrics into a "metrics" folder in '
Expand Down
6 changes: 3 additions & 3 deletions knora/dsplib/docker/docker-compose.yml
Expand Up @@ -31,11 +31,11 @@ services:
environment:
- TZ=Europe/Zurich
- SIPI_EXTERNAL_PROTOCOL=http
- SIPI_EXTERNAL_HOSTNAME=0.0.0.0
- SIPI_EXTERNAL_HOSTNAME=localhost
- SIPI_EXTERNAL_PORT=1024
- SIPI_WEBAPI_HOSTNAME=api
- SIPI_WEBAPI_PORT=3333
- KNORA_WEBAPI_KNORA_API_EXTERNAL_HOST=0.0.0.0
- KNORA_WEBAPI_KNORA_API_EXTERNAL_HOST=localhost
- KNORA_WEBAPI_KNORA_API_EXTERNAL_PORT=3333
command: --config=/docker/sipi.docker-config.lua

Expand All @@ -62,7 +62,7 @@ services:
- KNORA_WEBAPI_CACHE_SERVICE_REDIS_HOST=redis
- KNORA_WEBAPI_CACHE_SERVICE_REDIS_PORT=6379
- KNORA_WEBAPI_ALLOW_RELOAD_OVER_HTTP=true
- KNORA_WEBAPI_KNORA_API_EXTERNAL_HOST=0.0.0.0
- KNORA_WEBAPI_KNORA_API_EXTERNAL_HOST=localhost
- KNORA_WEBAPI_KNORA_API_EXTERNAL_PORT=3333

networks:
Expand Down
12 changes: 6 additions & 6 deletions knora/dsplib/utils/stack_handling.py
@@ -1,4 +1,3 @@
import json
import re
import subprocess
import time
Expand Down Expand Up @@ -35,9 +34,10 @@ def start_stack(
raise BaseError('The arguments "--prune" and "--no-prune" are mutually exclusive')

# get sipi.docker-config.lua
latest_release = json.loads(requests.get("https://api.github.com/repos/dasch-swiss/dsp-api/releases").text)[0]
url_prefix = f"https://github.com/dasch-swiss/dsp-api/raw/{latest_release['target_commitish']}/"
commit_of_used_api_version = "3f44354df"
url_prefix = f"https://github.com/dasch-swiss/dsp-api/raw/{commit_of_used_api_version}/"
docker_config_lua_text = requests.get(f"{url_prefix}sipi/config/sipi.docker-config.lua").text
docker_config_lua_text = docker_config_lua_text.replace("0.0.0.0", "localhost")
if max_file_size:
max_post_size_regex = r"max_post_size ?= ?[\'\"]\d+M[\'\"]"
if not re.search(max_post_size_regex, docker_config_lua_text):
Expand All @@ -54,7 +54,7 @@ def start_stack(
# wait until fuseki is up (same behaviour as dsp-api/webapi/scripts/wait-for-db.sh)
for i in range(360):
try:
response = requests.get(url="http://0.0.0.0:3030/$/server", auth=("admin", "test"))
response = requests.get(url="http://localhost:3030/$/server", auth=("admin", "test"))
if response.ok:
break
except:
Expand All @@ -65,7 +65,7 @@ def start_stack(
repo_template = requests.get(f"{url_prefix}webapi/scripts/fuseki-repository-config.ttl.template").text
repo_template = repo_template.replace("@REPOSITORY@", "knora-test")
response = requests.post(
url="http://0.0.0.0:3030/$/datasets",
url="http://localhost:3030/$/datasets",
files={"file": ("file.ttl", repo_template, "text/turtle; charset=utf8")},
auth=("admin", "test")
)
Expand All @@ -74,7 +74,7 @@ def start_stack(
"running already?")

# load some basic ontos and data into the repository
graph_prefix = "http://0.0.0.0:3030/knora-test/data?graph="
graph_prefix = "http://localhost:3030/knora-test/data?graph="
ttl_files = [
("knora-ontologies/knora-admin.ttl", "http://www.knora.org/ontology/knora-admin"),
("knora-ontologies/knora-base.ttl", "http://www.knora.org/ontology/knora-base"),
Expand Down