Page MenuHomePhabricator

How to customize WDQS endpoint
Closed, ResolvedPublic

Description

Preamble

As explained in the the documentation, the WDQS frontend endpoint is reachable at https://query.my-wikibase.org/proxy/wdqs/bigdata/namespace/wdq/sparql path.

The endpoint of Wikidata is reachable at a much shorter URL – https://query.wikidata.org/sparql – and the same is valid for the majority of publicly-available Wikibase on the internet; please see values of P5305 for examples.

Observation

I see the relevant path is referenced in the custom-config.json:

{
  "api": {
    "sparql": {
      "uri": "/proxy/wdqs/bigdata/namespace/wdq/sparql"
    },
    …

and then checked in docker-compose.yml:

…
healthcheck:
  test: curl --silent --fail localhost:9999/bigdata/namespace/wdq/sparql
  interval: 10s
  start_period: 2m
…

but I suppose this is only a small part of the big picture.

Question

How can we configure Wikibase Suite to customize our own frontend endpoint?
I thnk what I observed above is a couple of references to the configuration, not the configuration itself. Am I right?
If yes, where should we act in the WBS configuration to customize the endpoint URL?

Thanks in advance

Event Timeline

If yes, where should we act in the WBS configuration to customize the endpoint URL?

I am answering my own question with a method I came up on myself after asking the question. I hope someone from the Wikibase Suite Team can validate it or propose something better.

I copied the file /templates/default.conf from the wdqs-frontend container into a new file named wdqs-frontend-default.conf, I added a location to the file to intercept the /sparql URL and send it to the wdqs-proxy container:

…
    location /sparql {
        rewrite /sparql /bigdata/namespace/wdq/sparql break;
        proxy_pass http://$WDQS_HOST:80;
    }
…

then I modified the docker-compose.yml to replace the original file in wdqs-frontend upon container creation:

…
   volumes:
      - ./config/wdqs-frontend-default.conf:/templates/default.conf
…

Thanks in advance for further comments or suggestions on this topic.

roti_WMDE changed the task status from Open to In Progress.Feb 6 2025, 3:20 PM
roti_WMDE claimed this task.

Hi @lucamauri,

Thanks a lot your message and documenting your findings. This is indeed the way to do it. I am now suggesting a very similar change for wikibase suite upstream: https://github.com/wmde/wikibase-release-pipeline/pull/832/commits/74465d7144a17e4c1b5dbe39979622845b12bf71

We still have wdqs-proxy in the stack, which makes the whole picture a bit more complex. We are looking into completely removing it for simplicity.

https://github.com/wmde/wikibase-release-pipeline/pull/767
https://github.com/wmde/wikibase-release-pipeline/pull/833