CommunitySolidServer / CommunitySolidServer

An open and modular implementation of the Solid specifications
https://communitysolidserver.github.io/CommunitySolidServer/
MIT License
514 stars 124 forks source link

Any SPARQL endpoint connect not working #1545

Closed qertis closed 1 year ago

qertis commented 1 year ago

Environment

compose.yaml
version: "3.8"
services:

  fuseki:
    image: 'secoresearch/fuseki'
    container_name: 'fuseki'
    ports:
      - '3030:3030'
    volumes:
      - fuseki-data:/fuseki-base

  solid:
    image: 'solidproject/community-server:edge'
    platform: linux/amd64
    depends_on:
      - fuseki
    environment:
      - CSS_LOGGING_LEVEL=debug
    ports:
      - '3000:3000'
    entrypoint:
      - node
      - bin/server.js
      - -c
      - config/sparql-endpoint-no-setup.json
      - --sparqlEndpoint
      - http://0.0.0.0:3030/ds/sparql
    volumes:
      - solid-config:/config

volumes:
  fuseki-data:
  solid-config:
SPARQL Endpoint
image

Output

fuseki                | 09:18:37 INFO  Server          :: Apache Jena Fuseki 4.6.1
fuseki                | 09:18:38 INFO  Config          :: FUSEKI_HOME=/jena-fuseki
fuseki                | 09:18:38 INFO  Config          :: FUSEKI_BASE=/fuseki-base
fuseki                | 09:18:38 INFO  Config          :: Shiro file: file:///fuseki-base/shiro.ini
fuseki                | 09:18:38 INFO  Config          :: Loaded fi.seco.silk.arq.SilkFunctions
fuseki                | Jan 10, 2023 9:18:39 AM org.silkframework.plugins.distance.numeric.NumMetric <init>
fuseki                | INFO: Blocking disabled for numeric comparison as minValue and maxValue is not defined
fuseki                | 09:18:39 INFO  Config          :: Load configuration: file:///fuseki-base/configuration/assembler.ttl
fuseki                | 09:18:40 INFO  Server          :: Configuration file: /fuseki-base/config.ttl
fuseki                | 09:18:40 INFO  Server          :: Path = /ds
fuseki                | 09:18:40 INFO  Server          :: System
fuseki                | 09:18:40 INFO  Server          ::   Memory: 732.0 MiB
fuseki                | 09:18:40 INFO  Server          ::   Java:   19
fuseki                | 09:18:40 INFO  Server          ::   OS:     Linux 5.15.49-linuxkit aarch64
fuseki                | 09:18:40 INFO  Server          ::   PID:    1
fuseki                | 09:18:40 INFO  Server          :: Started 2023/01/10 09:18:40 UTC on port 3030
landing-page-solid-1  | oidc-provider WARNING: Unsupported Node.js runtime version. Use ^12.19.0, ^14.15.0, or ^16.13.0
landing-page-solid-1  | 2023-01-10T09:18:46.792Z [Components.js] info: Initiating component discovery from /community-server/
landing-page-solid-1  | 2023-01-10T09:18:48.884Z [Components.js] info: Discovered 158 component packages within 1295 packages
landing-page-solid-1  | 2023-01-10T09:18:48.898Z [Components.js] info: Initiating component loading
landing-page-solid-1  | 2023-01-10T09:19:25.143Z [Components.js] debug: Registered a module https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql without components.
landing-page-solid-1  | 2023-01-10T09:19:25.421Z [Components.js] info: Registered 745 components
landing-page-solid-1  | 2023-01-10T09:19:25.424Z [Components.js] info: Loaded configs
landing-page-solid-1  | 2023-01-10T09:19:44.668Z [UnsecureWebSocketsProtocol] {Primary} warn: The chosen configuration includes Solid WebSockets API 0.1, which is unauthenticated.
landing-page-solid-1  | 2023-01-10T09:19:44.674Z [UnsecureWebSocketsProtocol] {Primary} warn: This component will be removed from default configurations in future versions.
landing-page-solid-1  | 2023-01-10T09:19:44.684Z [ContainerInitializer] {Primary} info: Initializing container http://localhost:3000/
landing-page-solid-1  | 2023-01-10T09:19:44.717Z [ExtensionBasedMapper] {Primary} debug: Container filepath /community-server/templates/root/empty maps to URL http://localhost:3000/
landing-page-solid-1  | 2023-01-10T09:19:44.730Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.acl maps to URL http://localhost:3000/.acl
landing-page-solid-1  | 2023-01-10T09:19:44.758Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.meta maps to URL http://localhost:3000/.meta
landing-page-solid-1  | 2023-01-10T09:19:44.775Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
landing-page-solid-1  | 2023-01-10T09:19:44.779Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 1 locks active.
landing-page-solid-1  | 2023-01-10T09:19:44.784Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.write
landing-page-solid-1  | 2023-01-10T09:19:44.787Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.write. 2 locks active.
landing-page-solid-1  | 2023-01-10T09:19:44.790Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 1 active locks remaining.
landing-page-solid-1  | 2023-01-10T09:19:44.796Z [SingleRootIdentifierStrategy] {Primary} debug: Identifier http://localhost:3000/ is part of http://localhost:3000/
landing-page-solid-1  | 2023-01-10T09:19:44.812Z [SparqlDataAccessor] {Primary} info: Sending SPARQL CONSTRUCT query to http://0.0.0.0:3030/ds/sparql: CONSTRUCT { ?s ?p ?o. }
landing-page-solid-1  | WHERE { GRAPH <meta:http://localhost:3000/> { ?s ?p ?o. } }
landing-page-solid-1  | 2023-01-10T09:19:45.131Z [SparqlDataAccessor] {Primary} error: SPARQL endpoint http://0.0.0.0:3030/ds/sparql error: fetch failed
landing-page-solid-1  | 2023-01-10T09:19:45.136Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
landing-page-solid-1  | 2023-01-10T09:19:45.137Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 2 locks active.
landing-page-solid-1  | 2023-01-10T09:19:45.142Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.write. 1 active locks remaining.
landing-page-solid-1  | 2023-01-10T09:19:45.144Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 0 active locks remaining.
landing-page-solid-1  | 2023-01-10T09:19:45.148Z [AppRunner] {Primary} error: Could not start the server: fetch failed
landing-page-solid-1  | Could not start the server
landing-page-solid-1  | Cause: fetch failed
landing-page-solid-1  | TypeError: fetch failed
landing-page-solid-1  |     at Object.fetch (node:internal/deps/undici/undici:14062:11)
landing-page-solid-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
landing-page-solid-1  |     at async SparqlEndpointFetcher.handleFetchCall (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:177:30)
landing-page-solid-1  |     at async SparqlEndpointFetcher.fetchTriples (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:116:28)
landing-page-solid-1  |     at async SparqlDataAccessor.sendSparqlConstruct (/community-server/dist/storage/accessors/SparqlDataAccessor.js:281:53)
landing-page-solid-1  |     at async SparqlDataAccessor.getMetadata (/community-server/dist/storage/accessors/SparqlDataAccessor.js:66:24)
landing-page-solid-1  |     at async DataAccessorBasedStore.hasResource (/community-server/dist/storage/DataAccessorBasedStore.js:65:13)
landing-page-solid-1  |     at async runWithTimeout (/community-server/dist/util/locking/WrappedExpiringReadWriteLocker.js:51:24)
landing-page-solid-1  |     at async GreedyReadWriteLocker.withReadLock (/community-server/dist/util/locking/GreedyReadWriteLocker.js:35:20)
landing-page-solid-1  |     at async TemplatedResourcesGenerator.generateResource (/community-server/dist/pods/generate/TemplatedResourcesGenerator.js:107:73)
landing-page-solid-1 exited with code 1
joachimvh commented 1 year ago

Can't deduce anything specific from the logs besides that fetching failed for some reason, so my guess is that either the SPARQL endpoint is not reachable from the CSS container or the URL is incorrect.

qertis commented 1 year ago

Can't deduce anything specific from the logs besides that fetching failed for some reason, so my guess is that either the SPARQL endpoint is not reachable from the CSS container or the URL is incorrect.

Thanks. Could you pleasure to make any SPARQL endpoint for example?

joachimvh commented 1 year ago

I don't have a running instance but for our tests we use virtuoso which might help: https://github.com/CommunitySolidServer/CommunitySolidServer/blob/473902b85dce2123d847e6b4ffaac2e11a86178b/.github/workflows/npm-test.yml#L67-L72

qertis commented 1 year ago

Not working with virtuoso-opensource

Run falling:

2023-01-19 14:58:57 solid                           | oidc-provider WARNING: Unsupported Node.js runtime version. Use ^12.19.0, ^14.15.0, or ^16.13.0
2023-01-19 14:59:01 solid                           | 2023-01-19T11:59:01.385Z [Components.js] info: Initiating component discovery from /community-server/
2023-01-19 14:59:02 solid                           | 2023-01-19T11:59:02.737Z [Components.js] info: Discovered 158 component packages within 1296 packages
2023-01-19 14:59:02 solid                           | 2023-01-19T11:59:02.747Z [Components.js] info: Initiating component loading
2023-01-19 14:59:25 solid                           | 2023-01-19T11:59:25.170Z [Components.js] debug: Registered a module https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql without components.
2023-01-19 14:59:25 solid                           | 2023-01-19T11:59:25.342Z [Components.js] info: Registered 745 components
2023-01-19 14:59:25 solid                           | 2023-01-19T11:59:25.353Z [Components.js] info: Loaded configs
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.654Z [UnsecureWebSocketsProtocol] {Primary} warn: The chosen configuration includes Solid WebSockets API 0.1, which is unauthenticated.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.658Z [UnsecureWebSocketsProtocol] {Primary} warn: This component will be removed from default configurations in future versions.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.666Z [ContainerInitializer] {Primary} info: Initializing container http://localhost:3000/
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.690Z [ExtensionBasedMapper] {Primary} debug: Container filepath /community-server/templates/root/empty maps to URL http://localhost:3000/
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.699Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.acl maps to URL http://localhost:3000/.acl
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.716Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.meta maps to URL http://localhost:3000/.meta
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.728Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.730Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 1 locks active.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.733Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.write
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.735Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.write. 2 locks active.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.736Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 1 active locks remaining.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.741Z [SingleRootIdentifierStrategy] {Primary} debug: Identifier http://localhost:3000/ is part of http://localhost:3000/
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.751Z [SparqlDataAccessor] {Primary} info: Sending SPARQL CONSTRUCT query to http://localhost:4000/sparql/: CONSTRUCT { ?s ?p ?o. }
2023-01-19 14:59:37 solid                           | WHERE { GRAPH <meta:http://localhost:3000/> { ?s ?p ?o. } }
2023-01-19 14:59:37 solid                           | (node:1) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
2023-01-19 14:59:37 solid                           | (Use `node --trace-warnings ...` to show where the warning was created)
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.949Z [SparqlDataAccessor] {Primary} error: SPARQL endpoint http://localhost:4000/sparql/ error: fetch failed
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.954Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.955Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 2 locks active.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.958Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.write. 1 active locks remaining.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.960Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 0 active locks remaining.
2023-01-19 14:59:37 solid                           | 2023-01-19T11:59:37.962Z [AppRunner] {Primary} error: Could not start the server: fetch failed
2023-01-19 14:59:37 solid                           | Could not start the server
2023-01-19 14:59:37 solid                           | Cause: fetch failed
2023-01-19 14:59:37 solid                           | TypeError: fetch failed
2023-01-19 14:59:37 solid                           |     at Object.fetch (node:internal/deps/undici/undici:11118:11)
2023-01-19 14:59:37 solid                           |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-01-19 14:59:37 solid                           |     at async SparqlEndpointFetcher.handleFetchCall (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:177:30)
2023-01-19 14:59:37 solid                           |     at async SparqlEndpointFetcher.fetchTriples (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:116:28)
2023-01-19 14:59:37 solid                           |     at async SparqlDataAccessor.sendSparqlConstruct (/community-server/dist/storage/accessors/SparqlDataAccessor.js:281:53)
2023-01-19 14:59:37 solid                           |     at async SparqlDataAccessor.getMetadata (/community-server/dist/storage/accessors/SparqlDataAccessor.js:66:24)
2023-01-19 14:59:37 solid                           |     at async DataAccessorBasedStore.hasResource (/community-server/dist/storage/DataAccessorBasedStore.js:65:13)
2023-01-19 14:59:37 solid                           |     at async runWithTimeout (/community-server/dist/util/locking/WrappedExpiringReadWriteLocker.js:51:24)
2023-01-19 14:59:37 solid                           |     at async GreedyReadWriteLocker.withReadLock (/community-server/dist/util/locking/GreedyReadWriteLocker.js:35:20)
2023-01-19 14:59:37 solid                           |     at async TemplatedResourcesGenerator.generateResource (/community-server/dist/pods/generate/TemplatedResourcesGenerator.js:107:73)

components.yaml

version: "3.8"
services:

  solid:
    image: 'solidproject/community-server'
    platform: linux/amd64
    container_name: 'solid'
    environment:
      - CSS_LOGGING_LEVEL=debug # remove in prod
    ports:
      - '3000:3000'
    entrypoint:
      - node
      - bin/server.js
      - -c
      - config/sparql-endpoint-no-setup.json
      - --sparqlEndpoint
      - http://localhost:4000/sparql/
    volumes:
      - solid-config:/config

  sparql-endpoint:
    image: tenforce/virtuoso
    platform: linux/amd64
    environment:
      SPARQL_UPDATE: true
    ports:
      - '4000:8890'

  redis:
    container_name: redis
    image: redis:7.0.7
    ports:
      - '6379:6379'
    command: ["redis-server", "--bind", "redis", "--port", "6379", "--maxmemory-policy", "noeviction"]

Screenshot 2023-01-24 at 15 13 38

TallTed commented 1 year ago

@joachimvh @qertis —

image: tenforce/virtuoso

You may want to switch to the "official" Docker image(s) made by OpenLink Software, creator and maintainer of Virtuoso...

joachimvh commented 1 year ago

@qertis can you try again while using Node 16.x? I noticed the fetch error messages don't get shown when using 18.

qertis commented 1 year ago

@qertis can you try again while using Node 16.x? I noticed the fetch error messages don't get shown when using 18.

I use official docker images with Node 18

qertis commented 1 year ago

@joachimvh @qertis —

image: tenforce/virtuoso

You may want to switch to the "official" Docker image(s) made by OpenLink Software, creator and maintainer of Virtuoso...

I tried this, but unsuccessful

qertis commented 1 year ago

I don't have a running instance but for our tests we use virtuoso which might help:

https://github.com/CommunitySolidServer/CommunitySolidServer/blob/473902b85dce2123d847e6b4ffaac2e11a86178b/.github/workflows/npm-test.yml#L67-L72

You can try it without docker compose and see bug again. Just try 3 commands:

SPARQL DOCKER:

docker run -d --name mysparql -p 127.0.0.1:8890:8890/tcp --expose 8890 --env DBA_PASSWORD=mysecret --platform linux/amd64 openlink/virtuoso-opensource-7

SOLID DOCKER

docker run --name sss --link mysparql -p 127.0.0.1:3000:3000/tcp --expose 3000 --env CSS_LOGGING_LEVEL=debug --platform linux/amd64 -it solidproject/community-server

And after into solid docker press:

node bin/server.js -c config/sparql-endpoint-no-setup.json --sparqlEndpoint http://127.0.0.1:8890/sparql

You see Screenshot 2023-01-24 at 15 15 32

TallTed commented 1 year ago

The reported error suggests that Virtuoso is not running.

Are you able to confirm that http://127.0.0.1:8890/sparql is a live endpoint? Any web browser should be able to load that page. If limited to command line, you could curl -LI http://127.0.0.1:8890/sparql

If not, are you able to confirm that http://127.0.0.1:8890/conductor and/or http://127.0.0.1:8890/ are live? Again, any web browser should be able to connect, as should —

curl -LI http://127.0.0.1:8890/sparql
curl -LI http://127.0.0.1:8890/

Checking the content of the Virtuoso log (default is virtuoso.log, alongside the default virtuoso.db and virtuoso.ini) may also reveal something helpful.

joachimvh commented 1 year ago

I use official docker images with Node 18

The reason that I ask is that in Node 18 there are some changes to how fetch works which causes the error to be less clear. In Node 16 there should be a more clearer message describing why exactly the fetching failed.

My guess is still that the endpoint is simply not reachable from the CSS container like Ted suggests as well. The CI integration tests run for SPARQL and I just did a quick local test without Docker to make sure that a server can start with a SPARQL backend, so the problem has to be somewhere in the Docker setup. But it's not something I use often myself so I can't immediately tell you what might be wrong with your setup.

MisterTimn commented 1 year ago

Following is a working example in docker compose

version: "3.8"
services:

  virtuoso:
    image: tenforce/virtuoso:latest
    ports:
      - 8890:8890
    environment:
      - SPARQL_UPDATE=true
    volumes:
      - virtuoso-data:/data

  solid:
    image: solidproject/community-server:edge
    environment:
      - CSS_LOGGING_LEVEL=debug
      - CSS_CONFIG=@css:config/sparql-endpoint-no-setup.json
      - CSS_SPARQL_ENDPOINT=http://virtuoso:8890/sparql
    ports:
      - 3000:3000

volumes:
  virtuoso-data:

You can use the virtual network that compose creates to address services directly with their given names, and also its easier/less error prone to use the env variables variant for config setup when using docker, as demonstrated.

MisterTimn commented 1 year ago

Managed to get it working with fuseki/secoresearch as well, the sparql endpoints needs to bet set to /ds instead of /ds/sparql since the latter isn't used for updates, only queries. Also the ENABLE_UPDATE env var needs to be set to true.

version: "3.8"
services:

  fuseki:
    image: secoresearch/fuseki
    ports:
      - 3030:3030
    volumes:
      - fuseki-data:/fuseki-base
    environment:
      - ENABLE_UPDATE=true

  solid:
    depends_on:
      - fuseki
    image: solidproject/community-server:edge
    environment:
      - CSS_LOGGING_LEVEL=debug
      - CSS_CONFIG=@css:config/sparql-endpoint-no-setup.json
      - CSS_SPARQL_ENDPOINT=http://fuseki:3030/ds
    ports:
      - 3000:3000

volumes:
  fuseki-data:
qertis commented 1 year ago

@MisterTimn Thank you so much! You saved my week.