zazuko / trifid

Lightweight Linked Data Server and Proxy
Apache License 2.0
80 stars 11 forks source link

Setting DATASET_BASE_URL blocks requests #91

Closed mielvds closed 3 years ago

mielvds commented 3 years ago

I'm setting up Trifid with Blazegraph via docker-compose like so:

version: "3"

networks:
  sparql:
    driver: bridge
services:
  blazegraph:
    image: blazegraph:2.1.5
    ports:
      - "8090:8080"
    volumes:
      - "$PWD/config/RWStore.properties:/RWStore.properties"
      - "$PWD/data/:/data"
    networks:
      - sparql
  trifid:
    image: zazuko/trifid
    ports:
      - "8092:8080"
    depends_on:
      - blazegraph
    #command:
    volumes:
      - "$PWD/config/config-trifid.json:/app/config-trifid.json"
    environment:
  #    - NODE_TLS_REJECT_UNAUTHORIZED=0
      - DEBUG=trifid:*
      - TRIFID_CONFIG=/config-trifid.json
      - SPARQL_ENDPOINT_URL=http://blazegraph:8080/bigdata/namespace/organizations/sparql
      - DATASET_BASE_URL=http://data.meemoo.be/
    networks:
      - sparql

my config-trifid.json:

{
  "baseConfig": "trifid:config-sparql.json",
  "sparqlEndpointUrl": "env:SPARQL_ENDPOINT_URL",
  "datasetBaseUrl": "env:DATASET_BASE_URL"
}

When - DATASET_BASE_URL=http://data.meemoo.be/ is commented out, everything works fine. I can reach yasgui and perform queries. But when this line is active, all requests 'hang', suggesting the event loop is blocked somewhere when setting a base url. Any idea on what I'm missing?

thewilkybarkid commented 3 years ago

Run into the same problem using "datasetBaseUrl": "http://localhost:8080/" to allow connections between Docker containers.

Using cURL I can see the successful 200 OK response complete with the expected body, but seems like the response itself is never finished so it hangs.

curl -v http://localhost:8080/pigs-article
*   Trying ::1:8080...
* Connected to localhost (::1) port 8080 (#0)
> GET /pigs-article HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.76.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< connection: close
< content-type: text/turtle; charset=utf-8
< date: Fri, 30 Apr 2021 10:38:19 GMT
< Vary: Accept, Accept-Encoding
< Access-Control-Allow-Origin: *
< Cache-Control: public, max-age=120
< Transfer-Encoding: chunked
<
@prefix org:   <http://www.w3.org/ns/org#> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix frbr:  <http://purl.org/vocab/frbr/core#> .
@prefix fr:    <http://purl.org/spar/fr/> .
@prefix foaf:  <http://xmlns.com/foaf/0.1/> .
@prefix cito:  <http://purl.org/spar/cito/> .

<http://localhost:8080/pigs-article>
        a                fabio:ResearchPaper ;
        rdfs:label       "Paper about 'Determining insulin sensitivity from glucose tolerance tests in Iberian and Landrace pigs'" ;
        dcterms:creator  ( "J. M. Rodríguez-López" "M. Lachica" "L. González-Valero" "I. Fernández-Fígares" ) .

Could be Transfer-Encoding: chunked not receiving the terminating chunk?

ktk commented 3 years ago

I don't really have an idea but @bergos might have a look at it later. We plan to refactor Trifid and update quite some parts in it within the next weeks.

bergos commented 3 years ago

@ktk @sandhose can we switch to node v12 based images in Dockerfile? There are known issues with higher node versions at the moment (see #83)

ktk commented 3 years ago

Ok for me

thewilkybarkid commented 3 years ago

In case it helps I'm successfully using hijackresponse to rewrite the JSON-LD context in Node 14 (https://github.com/sciety/api-prototype/blob/1c1498a7532df1904452f1b965d18973ba25441a/trifid/src/json-ld-context.js).

mielvds commented 3 years ago

Thanks for the response all! Would the switch to node 12 resolve my issue?

mielvds commented 3 years ago

Thanks for the response all! Would the switch to node 12 resolve my issue?

it does btw

l00mi commented 3 years ago

@ludovicm67 can you please check if the docker version is version 12?

ludovicm67 commented 3 years ago

The Docker image was using node:lts-alpine as base image, which is currently providing Node v14.16.0. I updated it so that it uses node:12-alpine as base. The issue should be fixed now.

l00mi commented 3 years ago

@mielvds thanks for reporting! @ludovicm67 and @bergos thanks for solving.

l00mi commented 3 years ago

@mielvds I am curious, where do you use Trifid? Is it public?

mielvds commented 3 years ago

I work for the Flemish Institute for Archives now; we store a lot of audiovisual material from the cultural sector. I use trifid to expose the information that is stored in our KG (which is very much under-construction) in a simple en pretty way. The main reason is to demonstrate to my organisation what our metadata as KG would enable. Therefore, I am very interested in gettting the graphexplorer and SPEX plugins running as well. Currently, nothing is public for the simple reason that we are still exploring and don't have the rights to expose the metadata from our partners without consent.

l00mi commented 3 years ago

Exciting, please ping once you can show something!