What is the problem
I have tried setting up an instance of the wikibase-docker container but I encountered a problem with the Wikidata Query Service GUI. In http://localhost:8282/ I get the following error message in my browser's console: CONFIG.getConfig is not a function.
Steps to reproduce it
I am trying to run the container on an Ubuntu virtual machine in VM VirtualBox inside a Windows 10 Host.
Windows version: 1809 (Build: 17763.503) VM VirtualBox version: 6.0.8 r130520 (Qt5.6.2)y Ubuntu version: Linux VirtualBox 4.15.0-45-generic #48-Ubuntu x86_64 x86_64 x86_64 GNU/Linux
what I have done:
git clone https://github.com/wmde/wikibase-docker.git # commit ID when cloned 57f4d1509375ace2cef6e2c73210f3934895fb75 # repository state when cloned https://github.com/wmde/wikibase-docker/tree/57f4d1509375ace2cef6e2c73210f3934895fb75 cd wikibase-docker/ docker-compose pull docker-compose up
I wait until I see the messages:
Got no real changes Sleeping for 10 secs
so I assume every thing is ready.
However, when I go to http://localhost:8282/, The icon in top left is not loaded and the items on the left side bar do not exist, and in the console I found the following error: CONFIG.getConfig is not a function.
Expected behaviour
A normal functioning page should appear just like the official Query Service Page
What is (possibly) causing the problem.
Note: Since this docker container is a composition of a lot of repos and other containers, all of the links in the coming sections are permalinks to Github at the specific state when I encountered the problem. I will also state the commit ID when possible. All of this happened on the 28/05/2019.
Please excuse some of the naivety in my approach, I am a beginner when it comes to docker.
Checking the file config.js reveals that the function itself does not exist.
After some digging, I found out that the docker image for this is wikibase/wdqs-frontend.
Checking the Dockerfile in wdqs-frontend reveals the following:
# ... ADD https://github.com/wikimedia/wikidata-query-gui/archive/master.zip ./master.zip # Creates /wikidata-query-gui-master RUN unzip master.zip && rm master.zip # ... COPY --from=fetcher /wikidata-query-gui-master /tmp/wikidata-query-gui-master WORKDIR /tmp/wikidata-query-gui-master # ... COPY --from=builder /tmp/wikidata-query-gui-master /usr/share/nginx/html RUN echo "" > style.css COPY entrypoint.sh /entrypoint.sh COPY config.js /templates/config.js COPY default.conf /templates/default.conf
So the code for the actual GUI is in the repo https://github.com/wikimedia/wikidata-query-gui and it always downloads the most updated version of that repo.
However, the config file in the wikidata-query-gui repo does have the getConfig() method that is missing.
(commit for the link is 70ed8ec97f3aeb892dd99f5d9320232c41af95af)
So going back to the Dockerfile in wdqs-frontend, the last couple of lines do the following:
COPY entrypoint.sh /entrypoint.sh COPY config.js /templates/config.js # ... ENTRYPOINT ["/entrypoint.sh"]
The script actually copies another config.js file from wdqs-frontend/latest.
This file does not have the getConfig() function and looks like an older version of the other (valid) config.js file in wikidata-query-gui.
The copying is done to /templates/config.js. However, in the entypoint.sh file that is also copied, I found the following:
envsubst < /templates/config.js > /usr/share/nginx/html/wikibase/config.js
And when this script runs, it will override the valid config.js file with the invalid one.